Model Context Protocol (MCP)

Definition

MCP is an open standard for exposing capabilities to AI agents as tools. Every tool has a name, a natural-language description (written for the model to read), a typed input schema, and returns a CallToolResult. The model decides when to call a tool; the server author decides what the handler does.


Core Ideas

Tool result shape

{
  "content": [{ "type": "text", "text": "human-readable result" }],
  "structuredContent": { "key": "machine-readable JSON" },
  "isError": false
}
  • content — model/human readable; always include for compatibility
  • structuredContent — typed JSON matching the tool’s outputSchema (optional)
  • isError: true — a tool-level error (still a valid result, not a transport crash)
  • Results are atomic — no streaming out of a tool; streaming is transport-level SSE progress only

Two kinds of handler

  • API-powered — a pure pass-through to a REST endpoint.
  • LLM-powered — the handler itself calls a model (e.g. using an Agent Skill body as the system prompt to steer the inner model).

Both register identically — the protocol cannot tell them apart.

MCP vs REST endpoint

REST endpointMCP tool
Addressed byURL + HTTP verbName + tools/call
SchemaPer-endpoint, for programmersJSON Schema + natural-language description for models
DiscoveryDocs / OpenAPItools/list at runtime
Invoked byCode you writeModel decides autonomously

Skills vs MCP

An MCP tool is a callable function the model invokes; an Agent Skill is a folder of instructions (SKILL.md + scripts) that an agent reads to know how to work. They compose: use a skill as the system prompt inside an LLM-powered handler, and skills can guide agents through MCP tool workflows.

Composition and control

  • Tool calling another tool — server-side composition (handler acts as an MCP client), suggest-via-content (return “call get_repo on X, Y, Z” and let the agent stay in control), or the deprecated sampling path.
  • Prompt caching — mark static content (skill body, system prompt) with cache_control so it isn’t reprocessed on every invocation; a cache hit costs ~10% of normal input tokens.
  • Sampling is deprecated (SEP-2577, removed earliest July 2027) — if a tool needs an LLM, call the model API directly in the handler with your own key.

Relationships

  • RESTful API — MCP tools are an alternative interface to the same backend capability a REST endpoint would expose
  • Retrieval-Augmented Generation (RAG) — an LLM-powered tool can wrap RAG; skills route retrieval by model choice rather than embedding similarity
  • Coding Agents and AI Tools — MCP servers are core infrastructure in the coding-agent ecosystem
  • Context Engineering — tool descriptions and deferred loading are the context budget MCP servers spend

References

  • mcp-summary — MCP builder’s cheat sheet (SDKs, monetisation, migration off sampling)