← All topics
Knowledge

MCP: a standard port for tools and context

MCP is a standard client/server protocol that exposes tools, resources, and prompts to an agent, so you build an integration once and reuse it across every host.

What it is

MCP (the Model Context Protocol) is a standard wire format that connects an agent to its tools and data. Instead of hand-coding a bespoke integration for every API, you run an MCP server that exposes its capabilities, and any MCP host (an agent, an IDE, a chat client) can plug in.

  • It's a contract, not a framework — like USB or HTTP for agent integrations.
  • A server advertises three things: tools (actions the agent can call), resources (read-only context like files or rows), and prompts (reusable templates).
  • Write the integration once; every MCP-speaking host gets it for free.

When to use it

  • You want a tool or data source usable across multiple agents or hosts, not welded into one app.
  • You're integrating a third party that already ships an MCP server — wire it up instead of rebuilding it.
  • You want to swap or add capabilities at runtime without redeploying the agent.
  • You're standardizing internal tools so teams stop reinventing the same connectors.

When NOT to use it: for one agent calling one in-process function, plain tool definitions are simpler — MCP's client/server overhead buys you nothing.

How it works

The host runs an MCP client; each integration runs as an MCP server. They speak JSON-RPC over a transport (local stdio, or HTTP for remote).

The flow for one turn:

  • On connect, the client calls list_tools and the server returns tools with names, descriptions, and JSON-Schema inputs.
  • The host hands those schemas to the model as available tools.
  • The model picks one, say get_weather, and the client sends call_tool with {"city": "Berlin"}.
  • The server runs the real work and returns a result the model reads.
  • Resources work the same way — the client lists and fetches them to feed context, often backing a rag step.

Watch out for

  • A server is attack surface. A connected MCP server can expose tools you didn't audit; prompt-injected content from one can trigger another. Gate calls with guardrails and least-privilege scopes.
  • Tool descriptions are the API. The model only knows what list_tools says — vague names and schemas cause wrong calls. The tool design rules still apply over MCP.
  • More servers, more tokens. Every advertised tool sits in the context window; prune what the agent doesn't need and watch cost control.
  • Transport and version mismatches fail quietly — pin versions and surface connection errors instead of swallowing them.

Related patterns

Ask the swarm