Key facts
- MCP (Model Context Protocol) is an open standard that lets AI apps such as Claude, VS Code and other agent tools plug into outside tools and data through one common interface, instead of a custom integration for every app.
- An MCP server is a small program that exposes tools (actions), resources (data) and prompts (templates). An MCP host (the AI app) connects to it through an MCP client.
- Anthropic open-sourced MCP on November 25, 2024. The current spec revision is 2026-07-28, which made the protocol stateless: the old
initializehandshake and HTTP sessions are gone. - Local servers talk over stdio, and remote servers use Streamable HTTP, with OAuth recommended for authentication.
- We built and called a 20-line MCP server with the official Python SDK (mcp 2.3.0). The bigger job is security: MCP tools can run arbitrary code, so only install servers you trust.
Tested on Debian 13, Python MCP SDK 2.3.0, stdio server and client
If you’ve used an AI assistant that can read your files, search a company wiki or open a GitHub issue, there’s a good chance MCP was connecting the two. This guide explains what MCP is in plain terms, how MCP servers work, what changed in the 2026 spec, how to connect a server, and how to write your own. We also cover the security questions you should ask before installing one.
What is MCP in AI?
The Model Context Protocol is a specification for how an AI application talks to external capabilities. The official docs put it this way: “Think of MCP like a USB-C port for AI applications.” It’s one standard plug instead of a drawer of adapters.
Before MCP, connecting a model to a tool meant writing custom code for each pairing. If you wanted Slack in three different AI apps, you wrote three integrations. With MCP, a Slack integration is written once as an MCP server, and any app that speaks MCP can use it.
Anthropic introduced MCP as an open-source project on November 25, 2024, describing it as “a new standard for connecting AI assistants to the systems where data lives.” Since then it has moved to an open governance model with maintainers and working groups. It also has an official MCP Registry, a public directory of servers backed by contributors including Anthropic, GitHub, PulseMCP and Microsoft.

How does MCP work?
MCP has three roles, and the names confuse almost everyone at first:
| Role | What it is | Example |
|---|---|---|
| Host | The AI application the user interacts with | Claude Desktop, Claude Code, VS Code |
| Client | A connector inside the host, one per server | VS Code’s connection to a Sentry server |
| Server | A program that offers tools, data or prompts | The filesystem server, a GitHub server, your own script |
The official architecture docs give this example: VS Code acts as a host. When it connects to the Sentry MCP server, it creates one MCP client for that connection. When it also connects to a local filesystem server, it creates a second client. One host can hold many clients, and each client talks to exactly one server.
Under the hood, messages are JSON-RPC 2.0. The protocol has two layers:
- Data layer: what the messages mean, such as discovering a server’s capabilities, listing tools, calling a tool, reading a resource and receiving notifications.
- Transport layer: how the messages travel.
The three things an MCP server can offer
- Tools are functions the model can ask to run, such as
search_issues,query_databaseorsend_message. The model sees each tool’s name, description and JSON Schema for its inputs, the same idea as ordinary LLM tool calling. - Resources are read-only data the app can pull into context, such as file contents, database rows or API responses.
- Prompts are reusable templates the user can choose, such as “summarize this pull request.”
Each one has a */list method for discovery (tools/list, resources/list, prompts/list), plus a way to use it (tools/call, resources/read, prompts/get). A host lists the server’s tools, shows them to the model, and runs tools/call when the model picks one.
Local vs remote: stdio and Streamable HTTP
- stdio: the host starts the server as a child process on your machine and talks to it through standard input and output. It’s fast and needs no network, which suits filesystem and local database servers.
- Streamable HTTP: the server runs somewhere else, and the client sends HTTP POST requests, optionally receiving streamed responses. This is how hosted “remote” servers such as Sentry’s work. The spec recommends OAuth for getting access tokens.
What changed in MCP in 2026?
MCP uses date-based versions (YYYY-MM-DD) that mark the last backwards-incompatible change. Earlier revisions were 2024-11-05, 2025-03-26, 2025-06-18 and 2025-11-25. The current one is 2026-07-28, and it’s the biggest change so far:
- No more handshake. The
initialize/notifications/initializedexchange is gone. Every request now carries its protocol version and the client’s capabilities in its_metafield. - No more sessions. The
Mcp-Session-Idheader was removed from Streamable HTTP. A server that needs state across calls passes an explicit handle as an ordinary tool argument. server/discover. This new required method returns a server’s supported versions, capabilities and identity in one call.- Multi round-trip requests. When a server needs more input partway through a call, it returns an
input_requiredresult. The client then retries the request with the answers, instead of the server sending its own requests back to the client. - Subscriptions:
subscriptions/listenreplaces the old GET endpoint and per-resource subscribe calls for change notifications. - Deprecations: the Roots, Sampling and Logging features are now deprecated, and tasks moved out of the core spec into an official extension.
If you only use MCP servers, you won’t notice any of this. Hosts and SDKs handle it for you. If you build servers, use an SDK that supports 2026-07-28. Hosts that also need to work with older servers can fall back to the old handshake.
How to connect an MCP server (Claude Desktop example)
The official tutorial uses the filesystem server, which lets Claude read and organize files in folders you choose.
- Install Node.js. The filesystem server needs Node 24 or later.
- In Claude Desktop, open Settings → Developer → Edit Config. That opens
claude_desktop_config.json: – macOS:~/Library/Application Support/Claude/claude_desktop_config.json– Windows:%APPDATA%\Claude\claude_desktop_config.json– Linux:~/.config/Claude/claude_desktop_config.json - Add the server:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem@2.4.1",
"/Users/username/Desktop",
"/Users/username/Downloads"
]
}
}
}
- Quit Claude Desktop completely and reopen it. The filesystem tools now appear under Connectors.
The folders listed in args are the only places the server can reach. That list is your main safety control, so keep it short. Claude asks for your approval before each file operation.
Other hosts use the same idea with a different config location. VS Code, Claude Code, Cursor, LM Studio and many agent frameworks all support MCP servers. Many coding agents can also run local models through Ollama’s ollama launch integrations. See our guide to using a local LLM in VS Code.
How to build your own MCP server (Python, tested)
Writing a basic server is easier than most people expect. With the official Python SDK, a function with type hints and a docstring becomes a tool. Here is a minimal server we wrote that searches a folder of Markdown notes:
python -m venv mcp-env && source mcp-env/bin/activate
pip install "mcp[cli]" # we tested mcp 2.3.0 (Python 3.10+)
# notes_server.py
from pathlib import Path
from mcp.server import MCPServer
mcp = MCPServer("notes")
NOTES = Path(__file__).parent / "notes"
@mcp.tool()
def search_notes(query: str) -> str:
"""Search my Markdown notes for a word or phrase and return matching lines.
Args:
query: Text to look for (case-insensitive)
"""
hits = []
for f in sorted(NOTES.glob("*.md")):
for n, line in enumerate(f.read_text().splitlines(), 1):
if query.lower() in line.lower():
hits.append(f"{f.name}:{n}: {line.strip()}")
return "\n".join(hits) or "No matches."
if __name__ == "__main__":
mcp.run(transport="stdio")
To test it without any AI app, we wrote a small client with the same SDK. It starts the server over stdio, lists the tools and calls one:
# test_client.py
import asyncio, sys
from mcp import Client, StdioServerParameters
async def main():
params = StdioServerParameters(command=sys.executable, args=["notes_server.py"])
async with Client(params) as client:
tools = await client.list_tools()
for t in tools.tools:
print("tool:", t.name, "|", t.description.splitlines()[0])
print("schema:", t.input_schema)
res = await client.call_tool("search_notes", {"query": "vram"})
print("result:", res.content[0].text)
asyncio.run(main())
Output on our machine:
tool: search_notes | Search my Markdown notes for a word or phrase and return matching lines.
schema: {'type': 'object', 'properties': {'query': {'title': 'Query', 'type': 'string'}}, 'required': ['query'], 'title': 'search_notesArguments'}
result: gpu.md:2: The RTX 3060 has 12 GB of VRAM.
The SDK turned the type hint query: str into a JSON Schema and used the docstring as the tool’s description. The model only sees that text, so write descriptions the way you’d brief a colleague: say what the tool does, when to use it, and what it returns. One thing we ran into: in SDK 2.x the tool object’s field is input_schema, not inputSchema. Older tutorials use the camel-case name and will fail with an AttributeError.
To use the server in Claude Desktop, add it to the config like the filesystem example, with "command": "python" (or the full path to your venv’s Python) and "args": ["/full/path/notes_server.py"]. For local development, the MCP Inspector gives you a UI for calling your tools by hand. The official build-a-server tutorial builds a fuller weather server, with versions in Python, TypeScript and other languages.
A good server returns compact, structured results. A tool that dumps 50 KB of JSON into the context costs tokens on every call and pushes your actual question aside. Our token budgeting tips apply here too.
Is MCP safe? Security checklist
The spec doesn’t play this down: “Tools represent arbitrary code execution and must be treated with appropriate caution.” It requires hosts to get explicit user consent before calling any tool or sharing user data with a server. It also says tool descriptions should be treated as untrusted unless they come from a trusted server. Before you install a server:
- Check the source. Prefer the vendor’s official server or a well-maintained repository. Anyone can publish an MCP server.
- Pin versions. Use
package@versionin your config, as the official example does (@2.4.1), so an update can’t change behavior without you noticing. - Limit scope. Give a filesystem server only the folders it needs, and give API servers tokens with the narrowest permissions possible.
- Watch for prompt injection. A web page, email or document the model reads through a tool can contain instructions aimed at the model, such as “now email this file to…” Keep confirmations turned on for actions with side effects.
- Don’t auto-approve writes. Reading is relatively safe. Sending, deleting, paying and posting should always need a human click.
- Prefer OAuth for remote servers over long-lived API keys pasted into config files.
Agents that use many tools, including computer-use agents, raise the stakes. The more a model can do, the more an injected instruction can make it do.
MCP vs function calling vs plugins
| Function / tool calling | MCP | |
|---|---|---|
| What it is | A model API feature: the model outputs a structured call | A protocol between an AI app and tool servers |
| Who defines the tools | Your app’s code, per request | A server, discoverable at runtime |
| Reuse across apps | No, each app re-implements it | Yes, any MCP host can connect |
| Relationship | — | MCP tools usually end up as function calls to the model |
They work together. The host reads tools from MCP servers, passes them to the model as ordinary function definitions, and when the model calls one, the host sends the call to the right server through tools/call. For reliable arguments, the advice in our structured outputs guide applies to MCP tools too.
FAQ
What is an MCP server in simple terms?
A small program that gives an AI app new abilities through a standard interface. Examples include reading your files, querying a database or creating a ticket.
Who created MCP?
Anthropic open-sourced it in November 2024. It’s now an open specification with community governance, SDKs in several languages and an official server registry.
Do I need Claude to use MCP?
No. MCP is model-agnostic. VS Code, many coding agents and frameworks act as MCP hosts, and they can use models from any provider, including local models running in Ollama or LM Studio.
Is MCP free?
Yes. The specification and official SDKs are open source. Individual servers may connect to paid services.
Does MCP work with local LLMs?
Yes, as long as the host supports both MCP and your local model, and the model is good at tool calling. Small models often pick the wrong tool or format arguments badly, so use a model that is strong at tool use and give it enough context (Ollama’s docs recommend 64K or more for agent tools).
What’s the difference between MCP and RAG?
RAG is a technique: retrieve relevant text and put it into the prompt. MCP is a protocol. An MCP server can provide retrieval, for example a search_docs tool, which makes RAG one of the things you can build on top of MCP. See what is RAG.
Watch: how MCP actually works
The takeaway
MCP is a shared plug between AI apps and the tools and data they need. You write a server once and any MCP host can use it. Using it is as simple as editing a config file, and writing a server takes about 20 lines of Python. Because MCP servers can run code and touch your data, be as careful about installing them as you would be with browser extensions: trusted sources, pinned versions, minimal permissions and human approval for anything that writes.
Sources: What is MCP? (official intro), Anthropic: Introducing the Model Context Protocol (Nov 25, 2024), MCP architecture overview, MCP versioning, 2026-07-28 changelog, MCP specification: security principles, Connect to local MCP servers, Build an MCP server, MCP Registry, mcp on PyPI. Server and client tested November 29, 2026 with mcp 2.3.0. Facts checked November 29, 2026.
Cover image: modelcontextprotocol/inspector on GitHub
