MCP Pagination Module
The MCP Server V2 implements pagination fortools/list, resources/list, and prompts/list endpoints per the MCP 2025-11-25 specification.
Overview
Pagination uses opaque cursors (base64url encoded) that the server generates. Clients cannot determine page size - the server decides based on its configuration. Key Features:- Default page size: 50 items
- Maximum page size: 100 items
- Opaque cursor encoding (base64url)
- Invalid cursor validation with JSON-RPC errors
Code Usage
Basic Pagination
Custom Page Size
Cursor Utilities
Resource and Prompt Pagination
Server Handler Integration
The MCP server automatically handles pagination in the protocol handlers:Error Handling
Invalid cursors raiseValueError:
-32602 (Invalid params).
MCP Protocol Compliance
This implementation follows MCP 2025-11-25 specification:| Requirement | Implementation |
|---|---|
| Opaque cursors | Base64url encoded offset |
| Server-determined page size | Default 50, max 100 |
nextCursor in response | Included when more results exist |
| Invalid cursor handling | JSON-RPC error -32602 |
Constants
See Also
- MCP Pagination CLI - CLI commands for pagination
- MCP Tool Search - Search and filter tools
- MCP Server - Core MCP server documentation

