Anthropic MCP Specification — Protocol Reference
Official Model Context Protocol specification reference. Understand MCP architecture, message format, tool definitions, resource types, and transport protocols for building servers.
What it is
The Model Context Protocol (MCP) specification defines how AI models connect to external tools, data sources, and services through a standardized interface. Published by Anthropic, MCP provides a common protocol for tool definitions, resource access, and prompt templates.
This specification reference covers the complete protocol: JSON-RPC message format, capability negotiation, tool schemas, resource types, and transport layers (stdio and HTTP+SSE). It is the canonical document for anyone building MCP servers or clients.
How it saves time or tokens
Before MCP, every AI integration required custom API wrappers, bespoke tool definitions, and model-specific prompt formats. MCP standardizes this into a single protocol that any model and any tool can speak. Build one MCP server and it works with Claude, GPT, Gemini, and any compliant client.
The specification also reduces token waste by defining efficient message structures. Tool results flow through structured JSON rather than verbose natural language descriptions.
How to use
- Read the specification to understand the three core primitives:
Tools — Functions the model can call (with JSON Schema parameters)
Resources — Data the model can read (files, database rows, API responses)
Prompts — Reusable prompt templates with arguments
- Implement a server using the official SDK:
from mcp import Server
server = Server('my-server')
@server.tool('get_weather')
async def get_weather(city: str) -> str:
return f'Weather in {city}: 72F, sunny'
server.run()
- Connect the server to an MCP client (Claude Desktop, Claude Code, or any compliant client) via stdio or HTTP transport.
- The client discovers available tools, resources, and prompts through capability negotiation and presents them to the model.
Example
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "get_weather",
"arguments": {"city": "San Francisco"}
},
"id": 1
}
This JSON-RPC message shows a tool call request. The server processes it and returns a structured result.
Related on TokRepo
- MCP Integrations — GitHub MCP server implementation
- AI Tools for Automation — Automation tools that leverage MCP for AI integration
Common pitfalls
- Confusing MCP servers with REST APIs. MCP uses JSON-RPC over stdio or SSE, not HTTP request-response. The lifecycle and connection model are different from traditional APIs.
- Defining tools with overly broad parameters. Each tool should do one thing well with a clear JSON Schema. Models perform better when tool boundaries are sharp.
- Ignoring capability negotiation. Servers must declare which capabilities they support (tools, resources, prompts) during initialization. Skipping this step causes clients to miss available features.
Frequently Asked Questions
MCP is a standardized protocol published by Anthropic that defines how AI models connect to external tools, data sources, and services. It uses JSON-RPC messaging with three core primitives: tools (callable functions), resources (readable data), and prompts (reusable templates). Any compliant client can talk to any compliant server.
MCP is designed to be model-agnostic. Claude supports MCP natively through Claude Desktop and Claude Code. Other models can support MCP through compliant client implementations. The protocol does not depend on any specific model architecture.
MCP supports two transport layers: stdio (standard input/output) for local server processes, and HTTP with Server-Sent Events (SSE) for remote servers. Stdio is simpler for local tools. HTTP+SSE enables networked deployments and cloud-hosted servers.
Use the official MCP SDK in Python or TypeScript. Define tools with parameter schemas, implement handler functions, and run the server. The SDK handles JSON-RPC parsing, capability negotiation, and transport. A minimal server can be built in under 20 lines of code.
Yes. MCP defines resources as a separate primitive from tools. Resources represent readable data like files, database rows, or API responses. The model can browse and read resources without calling a function. This separation keeps tool calls focused on actions and resources focused on data access.
Citations (3)
- MCP Specification— MCP specification defining tools, resources, and prompts primitives
- Anthropic MCP Docs— Anthropic published the Model Context Protocol
- JSON-RPC Specification— JSON-RPC 2.0 messaging protocol
Related on TokRepo
Source & Thanks
Created by Anthropic. Licensed under MIT.
modelcontextprotocol/specification — Official MCP spec spec.modelcontextprotocol.io — Full specification