Skip to main content
Reference vendor/cloudflare 1 min read

mcp

MCP Integration

For new servers, prefer createMcpHandler over the deprecated McpAgent. For existing servers, check the installed SDK version and state/session requirements before choosing a migration path.

Read the relevant current documentation for implementation details and supported dependency versions:

TaskDocumentation
Build a serverHandler API — server factories, Worker entrypoint, dependencies, and examples
Migrate an existing serverMCP SDK v2 migration — stateless migration and temporary legacy paths
Connect to servers and use their toolsClient API — connections, OAuth, tools, resources, and retries
Choose a transportTransports — remote HTTP and existing RPC integrations
Secure a serverSecuring MCP servers — OAuth and proxy security