Skip to content

Cheatsheet: Model Context Protocol

Model Context Protocol (MCP) is an open standard for connecting AI applications to external systems. Governed at modelcontextprotocol.io. Three primitive types: tools, resources, prompts. USB-C analogy: one connector, many hosts, many devices.

LayerWho owns the capabilityWho writes the schemaWho executesLesson
Custom client toolYouYouYouL4
Anthropic-providedAnthropicAnthropicAnthropic (server) or you (Anthropic-schema client)L5
MCP connectorThird partyMCP server authorConnector + MCP serverL6

Claude’s Model Context Protocol (MCP) connector feature enables you to connect to remote MCP servers directly from the Messages API without a separate MCP client (Anthropic docs, verbatim). Currently supports tool calls only. Requires beta header mcp-client-2025-11-20 (deprecated: mcp-client-2025-04-04).

response = client.beta.messages.create(
model="claude-opus-4-8",
max_tokens=1000,
messages=[{"role": "user", "content": "..."}],
mcp_servers=[
{
"type": "url",
"url": "https://example-server.modelcontextprotocol.io/sse",
"name": "example-mcp",
"authorization_token": "YOUR_OAUTH_TOKEN",
}
],
tools=[{"type": "mcp_toolset", "mcp_server_name": "example-mcp"}],
betas=["mcp-client-2025-11-20"],
)
FieldRequiredNotes
typeYesOnly "url" is supported
urlYesHTTPS; Streamable HTTP or SSE transport
nameYesUnique inside this request; must match exactly one mcp_toolset
authorization_tokenNoOAuth Bearer if the server requires it
FieldRequiredNotes
typeYesMust be "mcp_toolset"
mcp_server_nameYesMust match a server in mcp_servers
default_configNoDefaults for every tool: enabled, defer_loading
configsNoPer-tool overrides (key = tool name)
cache_controlNoPrompt-caching breakpoint (lesson 7)
FlagDefaultMeaning
enabledtrueInclude the tool
defer_loadingfalseHold the tool’s description back; surface via tool_search (L5) when relevant

Precedence (highest to lowest): configs > default_config > system defaults.

// Allowlist
{ "type": "mcp_toolset", "mcp_server_name": "s",
"default_config": { "enabled": false },
"configs": { "search_events": { "enabled": true },
"list_events": { "enabled": true } } }
// Denylist (recommended baseline for read-only / human-confirm flows)
{ "type": "mcp_toolset", "mcp_server_name": "s",
"configs": { "delete_all_events": { "enabled": false } } }
// Mixed: allowlist + per-tool defer_loading
{ "type": "mcp_toolset", "mcp_server_name": "s",
"default_config": { "enabled": false, "defer_loading": true },
"configs": { "search_events": { "enabled": true, "defer_loading": false } } }
  • Every server in mcp_servers must be referenced by exactly one mcp_toolset.
  • Every mcp_toolset must name a server that exists in mcp_servers.
  • Unknown tool names in configs log a backend warning but do not error (MCP servers may have dynamic tool availability).
{ "type": "mcp_tool_use",
"id": "mcptoolu_014Q35RayjACSWkSj4X2yov1",
"name": "echo",
"server_name": "example-mcp",
"input": { "param1": "value1" } }
{ "type": "mcp_tool_result",
"tool_use_id": "mcptoolu_014Q35RayjACSWkSj4X2yov1",
"is_error": false,
"content": [ { "type": "text", "text": "Hello" } ] }
  • Both blocks land inline in the same response. No round-trip in your code (same as L5 server tools).
  • Iterate response.content; surface text, render is_error, log execution.
QuestionYes implies
Does the tool’s code already exist as an MCP server?MCP connector (L6)
Is the capability one Anthropic provides as a server tool?L5 server tool
Is the capability one Anthropic provides with a canonical client schema (bash, computer use, memory, text_editor)?L5 Anthropic-schema client tool
Is the logic yours and not exposed as MCP anywhere?L4 custom client tool

Most production apps mix all three.

{ "mcp_servers": [
{ "type": "url", "url": "https://mcp.example1.com/sse", "name": "s1" },
{ "type": "url", "url": "https://mcp.example2.com/sse", "name": "s2" }
],
"tools": [
{ "type": "mcp_toolset", "mcp_server_name": "s1" },
{ "type": "mcp_toolset", "mcp_server_name": "s2",
"default_config": { "defer_loading": true } }
] }

For large catalogs across several servers: combine defer_loading with tool_search (L5) so only the relevant tools enter the prefix per call.

LimitImplication
Tools onlyResources + prompts require client-side TypeScript helpers (not the connector)
HTTPS transports onlyLocal STDIO servers unreachable through connector
Not on Amazon Bedrock or Vertex AIConnector available on Claude API + Claude Platform on AWS + Microsoft Foundry
Not ZDR eligibleData retained per standard policy; check before using for regulated workloads
OAuth is your jobObtain + refresh tokens application-side; npx @modelcontextprotocol/inspector helps in development

Client-side TypeScript helpers (when not connector)

Section titled “Client-side TypeScript helpers (when not connector)”
HelperUse for
mcpTools(tools, mcpClient)Convert MCP tools to Claude API tools (use with SDK tool runner)
mcpMessages(messages)Convert MCP prompt messages to Claude API message format
mcpResourceToContent(resource)Convert MCP resource to a content block
mcpResourceToFile(resource)Convert MCP resource to a file object for upload

Three when-not-to-connector cases: local STDIO transport, MCP prompts or resources needed, finer connection control needed.

FailureRecognize byFix
Forgetting the beta header400 / unsupported featureAdd betas=["mcp-client-2025-11-20"]
Server defined but no mcp_toolsetValidation errorAdd the matching toolset (one-to-one required)
Allowlist with no tools enabledModel has no MCP tools availableSet default_config.enabled false, then enable specific tools in configs
Using connector for ZDR workloadCompliance gapUse TypeScript helpers + self-hosted MCP client, or skip MCP for this path
Routing destructive tools without reviewSide-effects on third-party dataDenylist destructive tools or split into two servers (read-only + human-confirm-before-write)
Many tools across many servers without defer_loadingBloated prefix, slow cachingSet default_config.defer_loading true on the chatty servers and pair with tool_search (L5)

What this lesson does NOT cover (and where to find it)

Section titled “What this lesson does NOT cover (and where to find it)”
TopicLands at
Prompt caching on MCP tool definitionsLesson 7
Long-session context compaction with MCP resultsLesson 7
The agent loop using MCP + server + custom tools togetherLesson 8 onward
MCP server authoring (writing your own server)modelcontextprotocol.io spec
  • Anthropic public Claude docs: MCP connector at https://platform.claude.com/docs/en/agents-and-tools/mcp-connector.
  • MCP specification home: https://modelcontextprotocol.io/.
  • See references for the full anchor list.