Model Context Protocol (MCP)

Open standard for exposing tools, resources and prompts to any compatible agent.

Contents

The Model Context Protocol (MCP) is an open standard for connecting agents to external capabilities. A service runs an MCP server that exposes tools, resources and prompts once, and any MCP-compatible agent (the client) can use them. The current revision is 2026-07-28, which made the protocol stateless (spec); wire-level detail is in MCP in practice.

Why it matters

  • Before MCP, every agent framework had its own tool format, so each integration was rebuilt for each framework.
  • With MCP, an integration is built once and reused everywhere. The source compares this to USB for hardware: standardise the plug and the ecosystem grows on its own (anatomy).
  • In practice, function calling declares tools inside one app, while MCP moves them into reusable servers that a host discovers at runtime, so adding an integration means pointing the host at a server rather than writing new tool code (notebook-api-mcp). Platforms go further: AgentCore Gateway turns existing APIs and Lambda functions into MCP tools (AWS).

How it works

Three roles: the host (the AI app), a client inside it holding a 1:1 connection to each server, and the server, which wraps an API, database or filesystem (notebook-api-mcp). Messages are JSON-RPC (spec).

PrimitiveControlled byWhat it is
ToolsModelFunctions with a JSON Schema input the model chooses to call
ResourcesApplicationRead-only context addressed by URI
PromptsUserReusable templated messages or workflows

Control column from notebook-api-mcp and the spec. The host still converts MCP tools into the model’s native function-calling definitions.

flowchart LR
    U["User"] --> H["Host (AI app)"]
    H --> C1["MCP client"] --> S1["Server: issue tracker"]
    H --> C2["MCP client"] --> S2["Server: database"]
    H <--> M["LLM"]

The 2026-07-28 revision

Most tutorials describe the older connection-oriented protocol. The current revision changes it (spec changelog):

  • No initialize handshake. Each request carries its protocol version and client capabilities in _meta; servers implement server/discover.
  • No sessions. Mcp-Session-Id is removed. A server that needs state mints an opaque handle passed back as a tool argument.
  • Multi Round-Trip Requests (MRTR). Instead of pushing sampling, elicitation or roots requests, a server returns resultType: "input_required" and the client retries with the answers.
  • Deprecated: Roots, Sampling, Logging and the old HTTP+SSE transport (12-month minimum window). Tasks moved to an opt-in extension. tools/list should be deterministic so tool definitions stay prompt-cache friendly.

Transports are stdio (local subprocess) and Streamable HTTP (remote); see MCP in practice.

Authorization and distribution

  • A protected remote server is an OAuth 2.1 resource server: audience-bound tokens (RFC 8707 resource), PKCE, and no token passthrough (authorization spec). Clients obtain a client_id preferably via a Client ID Metadata Document; Dynamic Client Registration is deprecated (client registration). Background: agent authentication and authorization.
  • The Enterprise-Managed Authorization extension lets the corporate IdP decide which servers employees reach, via ID-JAG tokens and no per-server consent screens (extension).
  • The official MCP Registry (preview as of 2026-11) stores metadata only. It does not host or scan code (registry docs).

Where MCP shows up

  • Managed gateways. AgentCore Gateway fronts existing MCP servers and enforces Policy rules on every tool call (AWS). Foundry Toolboxes bundle web search, code interpreter, MCP servers and OpenAPI tools behind one managed MCP endpoint with central auth (Microsoft; see Azure AI Foundry).
  • Hosted in model APIs. OpenAI’s Responses API can call remote MCP servers as a hosted tool (migration guide).
  • Code execution with MCP. Presenting MCP servers as code modules an agent imports in a sandbox, instead of loading every tool definition into context, cut one workflow from about 150k to about 2k tokens. The cost is running a secure sandbox (Anthropic).

Security

The spec requires user consent before tool use and data sharing, and treats tool descriptions and annotations as untrusted unless the server is trusted, but MCP cannot enforce this; the host must (spec). Known attacks (Invariant):

  • Tool poisoning: hidden instructions in a tool description make the agent read secrets and exfiltrate them through a parameter.
  • Shadowing: one server’s description changes how the agent uses another server’s tools.
  • Rug pull: a server changes its descriptions after the user approved it. Mitigation: pin descriptions by hash and re-approve on change.

A single server can also complete the lethal trifecta: GitHub’s MCP server read an attacker-written public issue, then leaked private repo names in a public pull request (Willison).

When not to use it

If only your own code calls your own service, plain function calling or the API is simpler; MCP pays off when many hosts reuse an integration or tools are published for other people’s agents (notebook-api-mcp). For agent-to-agent delegation with multi-turn state, A2A is the complement: MCP is “vertical” (agent to tools), A2A “horizontal” (agent to agent) (A2A docs).

Tools · Agent guardrails: content returned by MCP servers is data, not instructions (see prompt injection).

Going deeper

Sources

Suggest changes →