MCP, the Model Context Protocol, is an open standard that lets AI apps connect to outside tools and data in one common way. An MCP server offers tools, resources and prompts. An MCP client inside the AI app discovers and calls them using JSON-RPC messages. The official docs compare it to a USB-C port for AI.
MCP is all over AI-editor news, but most explanations stay vague or paste a spec. This page covers the problem it solves, the three things a server can offer and how it differs from function calling and plugins. A script with no network shows the real message shapes, and the page ends with the security risks, because connecting a server means running someone else's code or trusting someone else's text.
Protocol details were read on modelcontextprotocol.io on 11 November 2026, when the current spec version was 2026-07-28. That version replaced the connection handshake of the older revisions with per-request metadata, so a tutorial that starts with an initialize call describes an older spec.
- 1Hostthe AI app you use
- 2MCP clientone connector per server
- 3MCP serverwraps a tool or data
- 4Tool or datafiles, GitHub, a database
The problem MCP solves
Before MCP, connecting an AI app to a tool meant custom code for every pair: one integration for your editor and GitHub, another for your editor and a database, another for a second editor and GitHub. MCP replaces that with one shared protocol. A tool is wrapped once as an MCP server, and any app with an MCP client can use it. The official documentation compares it to a USB-C port for AI applications.
Anthropic announced MCP as an open standard on 25 November 2024. On 9 December 2025 it donated the protocol to the Agentic AI Foundation, a fund under the Linux Foundation co-founded by Anthropic, Block and OpenAI, and said MCP's governance would stay the same. In that announcement Anthropic counted more than 10,000 active public MCP servers and over 97 million monthly downloads of its software development kits (SDKs). Those are its own figures from December 2025.
MCP is not a model and not an agent. It only standardises how an AI application gets context and calls tools. How the model decides to use them is up to the application. For the agent side, see what is an AI agent.
Host, client, server, and the three things a server offers
| Part | What it is | Example |
|---|---|---|
| MCP host | The AI application you talk to | Claude Code, VS Code, Cursor |
| MCP client | A connector inside the host. The host creates one per server | The object VS Code creates to talk to a Sentry server |
| MCP server | A program that provides context. It runs locally over stdio or remotely over Streamable HTTP | A filesystem server on your laptop; Sentry's hosted server |
| Server feature | What it is | Who triggers it | Methods |
|---|---|---|---|
| Tools | Functions the AI can call, such as run a query or create an issue | The model, with the app asking you to approve | tools/list, tools/call |
| Resources | Data the app can read, each with a URI (a web-style address), such as a file or a database schema | The application | resources/list, resources/read |
| Prompts | Reusable templates, such as a code-review checklist | The user | prompts/list, prompts/get |
Servers can also ask you for extra input, which the spec calls elicitation. Sampling, where a server asks the client's model for a completion, is marked deprecated as of 2026-07-28. There are two transports: stdio for local processes, and Streamable HTTP for remote servers, where the docs recommend OAuth for authentication.
See the messages: a simulator with no network
Everything MCP does is JSON-RPC 2.0, a simple standard for sending requests and replies as JSON: a request carries an id, a method and params, and the reply carries the same id and either a result or an error. The script below plays both sides in one file. It is a toy. It skips transports, authentication, schema validation and everything else a real server needs, which the official SDKs handle. The message shapes follow the 2026-07-28 spec.
import json
VERSION = "2026-07-28"
META = "io.modelcontextprotocol/"
# ---- the "server": plain functions, no network ----
TOOLS = [{
"name": "late_fee",
"title": "Library late fee",
"description": "Fee in rupees for a book returned late",
"inputSchema": {"type": "object", "properties": {"days": {"type": "integer"}}, "required": ["days"]},
}]
RESOURCES = {"notes://rules": "Late fee is 2 rupees per day. Books are due after 14 days."}
def handle(request):
method, params = request["method"], request.get("params", {})
reply = {"jsonrpc": "2.0", "id": request["id"]}
if params.get("_meta", {}).get(META + "protocolVersion") != VERSION:
reply["error"] = {"code": -32602, "message": "Unsupported protocol version"}
elif method == "server/discover":
reply["result"] = {"resultType": "complete", "supportedVersions": [VERSION],
"capabilities": {"tools": {}, "resources": {}},
"_meta": {META + "serverInfo": {"name": "toy-server", "version": "0.1"}}}
elif method == "tools/list":
reply["result"] = {"resultType": "complete", "tools": TOOLS}
elif method == "tools/call" and params["name"] == "late_fee":
days = params["arguments"]["days"]
if days < 0: # a tool execution error: reported inside a normal result
reply["result"] = {"resultType": "complete", "isError": True,
"content": [{"type": "text", "text": "days must be 0 or more"}]}
else:
reply["result"] = {"resultType": "complete", "isError": False,
"content": [{"type": "text", "text": f"Rs {2 * days}"}]}
elif method == "tools/call": # a protocol error: the request itself is wrong
reply["error"] = {"code": -32602, "message": "Unknown tool: " + params["name"]}
elif method == "resources/read" and params["uri"] in RESOURCES:
reply["result"] = {"resultType": "complete",
"contents": [{"uri": params["uri"], "mimeType": "text/plain", "text": RESOURCES[params["uri"]]}]}
else:
reply["error"] = {"code": -32601, "message": "Method not found"}
return reply
# ---- the "client": builds a request, adds the per-request _meta, sends it ----
next_id = 0
def send(method, **params):
global next_id
next_id += 1
params["_meta"] = {META + "protocolVersion": VERSION,
META + "clientInfo": {"name": "toy-client", "version": "0.1"},
META + "clientCapabilities": {}}
reply = handle({"jsonrpc": "2.0", "id": next_id, "method": method, "params": params})
shown = {k: v for k, v in params.items() if k != "_meta"}
print(f"{next_id} {method} {json.dumps(shown)}")
print(" ->", json.dumps(reply.get("result", reply.get("error"))))
send("server/discover")
send("tools/list")
send("tools/call", name="late_fee", arguments={"days": 5})
send("tools/call", name="late_fee", arguments={"days": -1})
send("tools/call", name="refund", arguments={})
send("resources/read", uri="notes://rules")Output:
1 server/discover {}
-> {"resultType": "complete", "supportedVersions": ["2026-07-28"], "capabilities": {"tools": {}, "resources": {}}, "_meta": {"io.modelcontextprotocol/serverInfo": {"name": "toy-server", "version": "0.1"}}}
2 tools/list {}
-> {"resultType": "complete", "tools": [{"name": "late_fee", "title": "Library late fee", "description": "Fee in rupees for a book returned late", "inputSchema": {"type": "object", "properties": {"days": {"type": "integer"}}, "required": ["days"]}}]}
3 tools/call {"name": "late_fee", "arguments": {"days": 5}}
-> {"resultType": "complete", "isError": false, "content": [{"type": "text", "text": "Rs 10"}]}
4 tools/call {"name": "late_fee", "arguments": {"days": -1}}
-> {"resultType": "complete", "isError": true, "content": [{"type": "text", "text": "days must be 0 or more"}]}
5 tools/call {"name": "refund", "arguments": {}}
-> {"code": -32602, "message": "Unknown tool: refund"}
6 resources/read {"uri": "notes://rules"}
-> {"resultType": "complete", "contents": [{"uri": "notes://rules", "mimeType": "text/plain", "text": "Late fee is 2 rupees per day. Books are due after 14 days."}]}What to notice
- Every request carries
_metawith the protocol version and the client's capabilities. The 2026-07-28 spec is stateless: each request can be understood on its own. The script adds_metainsidesendand leaves it out of the printout to keep the lines short. The full request for call 3 is shown below. - A failed tool and a wrong request are different. In call 4 the value is bad, so the server returns a normal result with
isErrorset to true and a message the model can act on. In call 5 the tool does not exist, so the server returns a JSON-RPC error with code -32602. The spec says tool execution errors should be passed to the model so it can retry, while protocol errors are less likely to be fixable. - A tool lists its
inputSchema, a JSON Schema the model reads to learn which arguments exist. The schema and the description are text the model sees, which matters in the security section. - A resource is read by URI.
notes://rulesis invented for the toy. Real servers use schemes such asfile://.
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "late_fee",
"arguments": { "days": 5 },
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientInfo": { "name": "toy-client", "version": "0.1" },
"io.modelcontextprotocol/clientCapabilities": {}
}
}
}That is the whole request for call 3 as it travels. Over stdio it is written to the server's standard input. Over Streamable HTTP it is sent as an HTTP POST.
MCP vs function calling vs plugins vs plain APIs
| What it is | Who defines the tool | Reusable across apps? | |
|---|---|---|---|
| Function calling | A feature of a model API: you describe functions in the request, the model replies with a call, your code runs it | Your own app code | No, it is tied to your code |
| MCP | A protocol between an AI app and a separate server process that lists its own tools | The server, discovered at runtime | Yes, any MCP client can use the server |
| Plugin | A vendor's packaging for extensions in its own product. OpenAI's docs say a custom MCP server can be added as a plugin in ChatGPT and Codex | The vendor's plugin format | Only inside that vendor's product |
| REST API | A web interface written for developers | The API provider | Yes, but a model cannot learn how to use it without extra code |
MCP does not replace function calling. In the architecture docs, the AI application collects the tools from every connected server into one list for the model. When the model picks a tool, the application routes the call to the right server and hands the result back to the model. MCP is the plumbing under the model's tool use.
Who supports MCP as of 11 November 2026, and how to connect a server
The MCP site says the protocol is supported by AI assistants such as Claude and ChatGPT and by development tools such as VS Code and Cursor, among many others. This is what each vendor's own documentation said on 11 November 2026.
| Product | MCP support | Where you set it up |
|---|---|---|
| Claude Code | Remote HTTP and local stdio servers. The older SSE (Server-Sent Events) transport is deprecated | claude mcp add, a .mcp.json file, or /mcp in a session |
| VS Code | HTTP and stdio servers, with a warning to trust only configurations you have reviewed | Command Palette, then MCP: Add Server |
| Cursor | stdio, SSE and Streamable HTTP. It asks you to approve tool use by default | .cursor/mcp.json or ~/.cursor/mcp.json |
| OpenAI | The Responses API has an mcp tool that takes a server_url. Custom remote servers can be used as a plugin in ChatGPT and Codex | An API request, or ChatGPT settings |
| Gemini CLI | Servers go in mcpServers in settings. The trust option defaults to false | settings.json |
Step-by-step setup for several editors is in connect MCP servers to your editor, and what to connect first is in best MCP servers for coding agents. In Claude Code a remote server is one command, and a local one uses -- to separate Claude's options from the server's command. Both examples come from Claude Code's MCP docs. Replace the key with your own and never commit it.
claude mcp add --transport http notion https://mcp.notion.com/mcp
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable -- npx -y airtable-mcp-server
claude mcp listClaude Code keeps a server for the current project by default (local scope). The project scope writes a .mcp.json file you can share through Git, and user applies to all your projects. The server people search for most is GitHub's: 'mcp github' tops the related searches for 'mcp server' on Google Trends in India. GitHub maintains it, and its README gives the remote address https://api.githubcopilot.com/mcp/, sign-in by OAuth or a personal access token, and a --read-only option that skips write tools. Start there, with a token limited to one test repository.
MCP security: what can go wrong
The MCP spec says tools represent arbitrary code execution and must be treated with caution, and that there should always be a human who can deny tool calls. The protocol cannot enforce that for you. These are the risks that matter when a student connects servers to an editor.
- Tool poisoning. A malicious server hides instructions in a tool's description. The model reads them, and you may not see them on screen. On 1 April 2025 Invariant Labs showed an innocent
addtool whose hidden text told the model to read~/.cursor/mcp.jsonand SSH keys and pass them out through a parameter, tested against Cursor. The spec now says clients must treat tool annotations as untrusted unless the server is trusted. Invariant also warns about 'rug pulls', where an approved tool changes later. - Prompt injection through tool results. A server that fetches web pages, issues or emails returns text written by strangers. Claude Code's docs warn that servers fetching external content can expose you to prompt injection. Keep a server that reads untrusted text apart from one that can send, delete or push.
- Local servers run with your privileges. MCP's security guide lists malicious startup commands and payloads inside server packages as attack paths, and its example copies
~/.ssh/id_rsato a web address. Read the command a config will run, prefer well-known publishers, and run unknown servers in a container. - Over-broad tokens. A token with every scope turns a small leak into a large one. MCP's security guide recommends least-privilege scopes, and the Gemini CLI docs note that a broadly scoped personal access token can leak information between repositories. Use read-only tokens where you can.
- Auto-approval. Gemini CLI's
trustoption skips confirmation prompts, and its docs say to use it only for servers you completely control. Treat any 'always allow' button the same way. - If you build a server: validate every input, sanitise outputs, and never forward a client's token to another API. The security guide says a server must not accept tokens that were not issued for it.
A habit that covers most of this: connect one server at a time, read its tool list, try it with a throwaway token on a throwaway repository, and keep approval prompts on. The secure a vibe-coded app checklist covers keys and permissions more broadly, and Claude Code explained shows how one agent handles approvals.
Frequently asked questions
What is MCP in simple terms?
MCP is a shared standard that lets AI apps use outside tools and data without custom code for each one. A tool or data source is wrapped as an MCP server, and any AI app with an MCP client can discover what it offers and call it. The official docs compare it to a USB-C port for AI applications.
What is an MCP server?
An MCP server is a program that gives an AI app context. It can offer tools the model may call, resources such as files or schemas, and prompt templates. It runs on your machine over stdio, or remotely over Streamable HTTP. Examples are filesystem servers, Sentry's hosted server and GitHub's server.
What is the difference between MCP and an API?
An API is an interface built for developers, and a model cannot learn how to use it without extra code. An MCP server describes its tools and their input schemas in a standard format that any MCP client can read. Many MCP servers call ordinary APIs underneath, so MCP often sits in front of an API.
Is MCP only for Claude?
No. Anthropic created it, but it is an open standard now under the Agentic AI Foundation at the Linux Foundation. The MCP site and vendor docs list support in ChatGPT and OpenAI's API, VS Code, Cursor and Claude, among others. A server written once can be used by any compatible client.
What is the GitHub MCP server?
It is GitHub's official MCP server. It lets an AI tool read repositories, work with issues and pull requests, and use Actions. The remote version is at https://api.githubcopilot.com/mcp/ and signs in by OAuth or a personal access token. Starting it with --read-only skips the write tools, which is a safer way to begin.
Is MCP safe to use?
The protocol is not unsafe by itself, but servers can run code or feed text to your model, so trust matters. Known risks include tool poisoning, prompt injection through tool results, local servers running with your privileges and over-broad tokens. Use trusted servers, minimum-scope tokens and approval prompts, and read what a server will run before adding it.
How do I add an MCP server to Claude Code or VS Code?
In Claude Code run claude mcp add --transport http <name> <url> for a remote server, or claude mcp add <name> -- <command> for a local one, then check with /mcp. In VS Code open the Command Palette and choose MCP: Add Server, then pick HTTP or Command (stdio). Review the command or endpoint before you accept.
Sources checked
- What MCP is, USB-C comparison, supported clients
- Spec 2026-07-28: JSON-RPC, hosts, clients, servers, features, tool safety
- Participants, layers, transports, primitives, example messages
- tools/list, tools/call, isError vs protocol error -32602, security considerations
- resources/list and resources/read
- Current version 2026-07-28, handshake-based older revisions
- Local server compromise, token passthrough, scope minimisation
- 9 Dec 2025 donation, 10,000+ servers, 97M+ monthly downloads
- Tool poisoning attack, 1 April 2025
- claude mcp add commands, scopes, prompt injection warning
- GitHub MCP server: remote URL, auth, read-only mode
Learn this with mentors
AI and machine learning programmes with admissions open: live classes, mentors and project work.

