The Model Context Protocol (MCP) is an open standard that lets AI applications such as Claude, ChatGPT, Gemini, Cursor or VS Code connect to external tools and data through one common interface, instead of a custom integration for every app and tool pair. A tool or data source is wrapped once as an MCP server, and any MCP-capable application can discover and use what it offers. Anthropic introduced MCP in November 2024, and in December 2025 donated it to the Agentic AI Foundation under the Linux Foundation.
For the original announcement and full technical specification, see Anthropic’s introduction of the Model Context Protocol and the official MCP documentation. Photo: Tobias “ToMar” Maier, Wikimedia Commons, CC BY-SA 3.0. MCP is closely related to how models request actions in the first place โ see our guide on function calling and tool use, and for how models pull in outside knowledge more generally, see what Retrieval-Augmented Generation (RAG) actually is.
This guide explains the architecture, the building blocks a server can expose, what a tool call looks like on the wire, how MCP relates to function calling, and what changed in the current specification revision (2026-07-28). It finishes with a minimal working server and a security checklist for connecting servers you did not write.
The problem MCP solves
Without a shared protocol, every AI application has to build its own connector for every tool. Five assistants and twenty tools means up to a hundred separate integrations, each with its own authentication code, data format and maintenance burden. MCP turns that into a hub: each tool vendor builds one server, each AI application implements the client side once, and any pairing works.
The specification itself says it takes some inspiration from the Language Server Protocol, which did the same thing for programming-language support in code editors. Before LSP, every editor needed its own plugin for every language; afterwards, a language team could write one server that worked in many editors.
How MCP works: hosts, clients and servers
MCP defines three roles, and confusing the first two is the most common source of misunderstanding. According to the MCP specification, all messages between them use JSON-RPC 2.0, a simple JSON format for requests, responses and notifications.
- Host: the AI application the user interacts with, such as Claude Desktop, Claude Code, an IDE or your own agent. The host owns the conversation and the language model.
- Client: a connector inside the host. The host creates one client per server it connects to.
- Server: a program that exposes capabilities, for example a GitHub server, a database server or an internal ticketing server.
Servers run in one of two ways. A local server is started by the host as a subprocess and talks over standard input and output (the stdio transport); it suits tools that need your files or local credentials. A remote server runs as a web service and talks over HTTP (the Streamable HTTP transport), usually with OAuth-based authorization; it suits SaaS products that want to offer one hosted endpoint to many users.
What a server can expose
A server offers up to three kinds of capability, and the difference between them is who decides when they are used.
| Primitive | What it is | Who triggers it | Example |
|---|---|---|---|
| Tools | Functions the model can call, with a name, description and JSON Schema for the inputs | The model, usually with user approval | create_issue, run_query, send_message |
| Resources | Readable data identified by a URI | The application or the user | A file, a database schema, a log, an API response |
| Prompts | Reusable templated messages or workflows | The user, often as a slash command or menu item | “Summarize this pull request”, “Draft a release note” |
Clients can also offer features back to servers. The main one in the current revision is elicitation, which lets a server ask the user for missing information mid-task. Sampling (a server asking the host’s model to generate text) and roots (the host telling a server which directories it may use) still exist but are now formally deprecated, as described below.
What a tool call looks like
A tool call is a short JSON-RPC exchange. The sequence below is simplified for illustration; real messages carry extra metadata, including, in the 2026-07-28 revision, the protocol version and client capabilities in a _meta field on every request.
1. Client asks what the server offers
{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}
2. Server answers with tool definitions
{"jsonrpc": "2.0", "id": 1, "result": {"resultType": "complete",
"tools": [{"name": "get_ticket",
"description": "Fetch a support ticket by its ID",
"inputSchema": {"type": "object",
"properties": {"ticket_id": {"type": "string"}},
"required": ["ticket_id"]}}]}}
3. The host gives these definitions to the model. The model decides to
call get_ticket with ticket_id "T-1042". The host asks the user to approve.
4. Client calls the tool
{"jsonrpc": "2.0", "id": 2, "method": "tools/call",
"params": {"name": "get_ticket", "arguments": {"ticket_id": "T-1042"}}}
5. Server returns the result, which the host passes back to the model
{"jsonrpc": "2.0", "id": 2, "result": {"resultType": "complete",
"content": [{"type": "text", "text": "T-1042: Login fails on SSO ..."}]}}
Step 3 is the key point: the model never talks to the server directly. It only sees tool definitions and results that the host chooses to pass along, and the host is responsible for asking the user before a tool runs.
MCP versus function calling
MCP does not replace function calling; it sits on top of it. Function calling (also called tool use) is the model capability: given tool definitions in the API request, the model outputs a structured request to call one. MCP standardizes where those tool definitions come from and how the call is executed.
| Function calling | MCP | |
|---|---|---|
| Layer | Model API feature | Protocol between an application and external services |
| Tool definitions live in | Your application code, per provider format | The MCP server, discovered at runtime |
| Who executes the tool | Your code | The MCP server |
| Reusable across apps | No, each app redefines its tools | Yes, any MCP host can use the same server |
| Best for | A few tools specific to one app | Shared integrations, many tools, third-party services |
If you are building one application with three internal functions, plain function calling is simpler. If you want the same integration available in your IDE, your chat assistant and your agents, MCP pays off. For multi-step AI agents, MCP is now the usual way to give them tools.
What changed in the 2026-07-28 specification
MCP is versioned by date, and the current revision made the protocol stateless. Explanations written in 2025 often describe details that no longer apply. The main changes listed in the official changelog are:
- No initialization handshake or sessions. Every request carries its own protocol version and client capabilities, and the
Mcp-Session-Idheader is gone. Servers that need state across calls pass explicit handles as tool arguments. - A new
server/discovermethod lets clients learn a server’s supported versions and capabilities up front. - Multi round-trip requests replace server-initiated requests: a server that needs more input returns an “input required” result, and the client retries with the answers.
- Deprecations: roots, sampling and logging are deprecated, as are the old HTTP+SSE transport and Dynamic Client Registration (in favor of Client ID Metadata Documents). Deprecated features keep working for a minimum twelve-month window.
- Tasks moved to an extension. Long-running asynchronous operations are now an opt-in official extension rather than part of the core protocol.
For users of existing servers, most of this is invisible: hosts and SDKs handle version negotiation. For server authors, it means checking which revision your SDK targets and avoiding deprecated features in new code.
Build a minimal MCP server
The official server tutorial builds a weather server in Python. The example below follows the same structure with a smaller, illustrative tool: it looks up internal service owners from a hard-coded dictionary, which you would replace with a real data source.
# Setup (from the official tutorial)
uv init owners
cd owners
uv venv
source .venv/bin/activate
uv add "mcp[cli]"
# owners.py
from mcp.server import MCPServer
mcp = MCPServer("owners")
# Illustrative data; replace with your CMDB or service catalog
OWNERS = {
"billing-api": "payments-team (on-call: #payments-oncall)",
"auth-service": "identity-team (on-call: #identity-oncall)",
}
@mcp.tool()
def get_service_owner(service: str) -> str:
"""Return the owning team and on-call channel for an internal service.
Args:
service: Service name exactly as it appears in the service catalog,
e.g. billing-api
"""
return OWNERS.get(service, f"No owner found for '{service}'.")
if __name__ == "__main__":
mcp.run(transport="stdio")
The SDK builds the tool definition from the function’s type hints and docstring, so the docstring is effectively the prompt the model reads when deciding whether to call the tool. Be specific about what the tool does and what valid inputs look like; our checklist for writing tool descriptions covers this in depth.
To connect it to Claude Desktop, add an entry under mcpServers in claude_desktop_config.json, pointing to an absolute path:
{
"mcpServers": {
"owners": {
"command": "uv",
"args": ["--directory", "/ABSOLUTE/PATH/TO/owners", "run", "owners.py"]
}
}
}
Errors you are likely to hit
- The server connects, then breaks on the first call. In a stdio server, anything printed to standard output corrupts the JSON-RPC stream. The tutorial warns never to use
print(); log to standard error or a file instead. - The host cannot find the server. Relative paths in the config are resolved from wherever the host starts, not your project. Use absolute paths, and the full path to
uvif it is not on the host’s PATH. - The tool never gets called. Usually a vague name or docstring. Rename it to say exactly what it does and describe the input format.
- Changes do not appear. Restart the host after editing the server or the config file.
Security: what to check before connecting a server
An MCP server is code that can read data and take actions on your behalf, so treat connecting one like installing software with access to your accounts. The specification’s security section states that tools amount to arbitrary code execution, that hosts must get explicit user consent before invoking a tool, and that tool descriptions should be treated as untrusted unless the server is trusted. MCP itself cannot enforce these principles; hosts and users have to.
- Know who maintains it. Prefer servers published by the vendor of the underlying service or with an active, reviewable repository.
- Read the tool list. Check which tools are read-only and which can write, delete or send. Disable or avoid write tools you do not need.
- Scope the credentials. Give the server a token with the minimum permissions required, not your admin key.
- Watch for prompt injection. A server that reads emails, web pages or tickets brings untrusted text into the model’s context, which can contain instructions. See our guide to prompt injection.
- Keep approvals on for consequential actions. Auto-approving everything removes the main safeguard the protocol relies on.
Our step-by-step guide to reviewing MCP server permissions before connecting Claude Code turns this list into a concrete review process.
Who supports MCP and who governs it
MCP is no longer a single-vendor project. When it joined the Agentic AI Foundation in December 2025, the announcement listed ChatGPT, Claude, Cursor, Gemini, Microsoft Copilot and Visual Studio Code among the clients that support it. The foundation is a directed fund of the Linux Foundation co-founded by Anthropic, Block and OpenAI; its board handles funding and membership, while the MCP project keeps control of its own technical direction. For anyone choosing whether to build on MCP, that neutral governance is a reason to expect the protocol to remain usable across providers.



