Model Context Protocol (MCP)

The Model Context Protocol (MCP) is an open standard for connecting AI models to external tools and data. Instead of every AI application writing bespoke integrations for GitHub, Slack, databases, and internal APIs, a service exposes one MCP server, and any MCP-capable client — Claude, IDEs, agent frameworks — can discover and call its capabilities.

MCP is often described as "USB-C for AI": a single connector standard that replaces the N×M problem of wiring every model to every tool. Introduced by Anthropic in late 2024 and since adopted across the industry, it has become the default way to give AI agents real-world capabilities.

TL;DR

Quick Example

A minimal MCP server in TypeScript exposing one tool:

Register it with an MCP client (here, Claude Code):

Now "what's the status of order ORD-1042?" resolves to a structured tool call against your database — no custom integration code in the client.

Core Concepts

The Architecture

The Three Primitives

Tools dominate in practice: they carry a name, a description, and a JSON Schema for inputs — exactly the shape LLM tool-calling APIs expect, which is why the bridge is so thin.

💡 Tool descriptions are prompt engineering. The model chooses tools based on the description text — say when to call it ("Call this when the user asks about order status"), not just what it does. See Prompt Engineering.

Transports

Remote servers authenticate with OAuth 2.1 bearer tokens — note that a service's MCP OAuth token is generally not the same credential as its REST API key.

Using MCP

In AI Applications (the API side)

Anthropic's Messages API can connect to remote MCP servers directly — the API layer makes the MCP connection server-side, so your code just declares the server and its toolset:

Both halves are required: every server in mcp_servers must be referenced by an mcp_toolset entry in tools. Agent frameworks (Claude Agent SDK, LangChain, OpenAI Agents SDK) ship equivalent MCP client support.

In Developer Tools

Claude Code, Claude Desktop, Cursor, VS Code, and most agentic IDEs are MCP hosts — configure a server once and every conversation can use it. Typical team setup: a Postgres server for schema-aware queries, the GitHub server for PRs and issues, and one internal server wrapping the company's own APIs.

Building a Server: Design Guidance

Security Considerations

MCP moves real capabilities into the model's reach, which makes its threat model worth taking seriously:

The same API security fundamentals — least privilege, input validation, audit logging — apply on both sides of the protocol.

MCP vs Plain Tool Calling

They compose rather than compete: your agent might define two custom tools inline and pull thirty more from MCP servers. Under the hood the model sees one merged tool list either way.

Common Mistakes

Exposing a Raw API 1:1

Wrapping every REST endpoint as a tool gives the model 80 confusing options. Design tools around user intents, not your API's shape.

Trusting Tool Output as Instructions

Rendering a fetched webpage or ticket into context without treating it as untrusted input is how agents get hijacked. Guard sensitive tools with confirmation, and prefer allowlisted actions.

Unbounded Result Sizes

A query_database tool that can return a million rows will, eventually. Cap and paginate results server-side — context windows and bills both thank you.

Assuming REST Credentials Work for MCP

Hosted MCP servers (Notion, Linear, GitHub) typically use their own OAuth flow. A service's REST API key usually won't authenticate its MCP endpoint.

FAQ

Is MCP tied to Claude?

No — Anthropic created it, but it's an open specification with an open-source SDK ecosystem (TypeScript, Python, Java, C#, and more), and it's supported by clients and platforms well beyond Anthropic's. That neutrality is why services standardized on it.

Do I need MCP for a simple agent?

If your agent needs three tools you control, plain tool calling is simpler. MCP pays off when integrations should be reusable across apps and teams, or when you want to consume the growing catalog of official servers instead of writing integrations.

What's the difference between MCP and function calling?

Function calling is the model capability (emit a structured call, receive a result). MCP is the integration layer that standardizes where those functions come from, how they're discovered, and how they're transported. MCP tools become function definitions when handed to the model.

How do I find existing MCP servers?

Official registries and directories list servers from major vendors (GitHub, Notion, Stripe, Cloudflare, and hundreds more), and most developer platforms document their server's URL and auth. Check the service's own docs first — official servers beat community ones for support and security.

Can MCP servers run in production backends?

Yes — remote Streamable HTTP servers are ordinary web services: deploy, scale, and monitor them like any API, with OAuth in front and rate limiting as usual.

Related Topics

References