MCP ConfigsApr 8, 2026·2 min read

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.

MC
MCP Hub · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

# Start building an MCP server
npm init -y && npm install @modelcontextprotocol/sdk
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = new McpServer({ name: "my-server", version: "1.0.0" });

server.tool("hello", { name: { type: "string" } }, async ({ name }) => ({
  content: [{ type: "text", text: `Hello, ${name}!` }],
}));

const transport = new StdioServerTransport();
await server.connect(transport);

What is MCP?

The Model Context Protocol (MCP) is an open standard by Anthropic that defines how AI applications (clients) connect to external data sources and tools (servers). It standardizes the interface between LLMs and the outside world — similar to how HTTP standardized web communication. MCP enables AI agents to use tools, access resources, and receive prompts from any compliant server.

Answer-Ready: MCP (Model Context Protocol) is Anthropic's open standard for connecting AI to external tools and data. Defines tools (actions), resources (data), and prompts (templates). JSON-RPC over stdio or HTTP. Used by Claude Code, Cursor, and 200+ servers. The USB-C of AI integrations.

Best for: Developers building MCP servers or understanding the protocol. Works with: Claude Code, Cursor, Claude Desktop, any MCP client.

Protocol Architecture

Client-Server Model

AI Application (Client)          MCP Server
┌─────────────────┐         ┌─────────────────┐
│ Claude Code     │ ←JSON→  │ GitHub MCP      │
│ Cursor          │  RPC    │ Database MCP    │
│ Claude Desktop  │         │ Custom Server   │
└─────────────────┘         └─────────────────┘

Three Primitives

Primitive Direction Purpose
Tools Client → Server Actions the AI can perform (search, create, delete)
Resources Client ← Server Data the AI can read (files, DB records, API responses)
Prompts Client ← Server Reusable prompt templates with parameters

Tool Definition

server.tool(
  "search_issues",
  {
    query: { type: "string", description: "Search query" },
    state: { type: "string", enum: ["open", "closed", "all"], default: "open" },
    limit: { type: "number", default: 10 },
  },
  async ({ query, state, limit }) => {
    const results = await github.searchIssues(query, state, limit);
    return {
      content: [{ type: "text", text: JSON.stringify(results) }],
    };
  }
);

Resource Definition

server.resource(
  "file://{path}",
  async ({ path }) => ({
    contents: [{ uri: `file://${path}`, text: await readFile(path, "utf-8") }],
  })
);

Transport Protocols

Transport Use Case How
stdio Local servers Spawn as child process, communicate via stdin/stdout
HTTP+SSE Remote servers HTTP POST for requests, SSE for notifications
Streamable HTTP Modern remote Full-duplex over HTTP

stdio Configuration

{
  "mcpServers": {
    "my-server": {
      "command": "node",
      "args": ["server.js"],
      "env": { "API_KEY": "..." }
    }
  }
}

HTTP Configuration

{
  "mcpServers": {
    "remote-server": {
      "transport": "http",
      "url": "https://api.example.com/mcp"
    }
  }
}

Message Format (JSON-RPC 2.0)

// Request
{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "search_issues", "arguments": {"query": "bug"}}}

// Response
{"jsonrpc": "2.0", "id": 1, "result": {"content": [{"type": "text", "text": "..."}]}}

SDK Languages

Language Package
TypeScript @modelcontextprotocol/sdk
Python mcp
Kotlin io.modelcontextprotocol:kotlin-sdk
C# ModelContextProtocol

FAQ

Q: Is MCP only for Anthropic/Claude? A: No, MCP is an open standard. Cursor, Codex, and other tools support it.

Q: How many MCP servers exist? A: 200+ and growing. Browse at smithery.ai or the official MCP servers repo.

Q: Can I build a server in Python? A: Yes, use the mcp Python package. Same capabilities as TypeScript SDK.

🙏

Source & Thanks

Created by Anthropic. Licensed under MIT.

modelcontextprotocol/specification — Official MCP spec spec.modelcontextprotocol.io — Full specification

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets