MCP connects language models to external tools
The Model Context Protocol (MCP) lets servers expose tools that language models can discover and invoke to query databases, call APIs and perform computations. Each tool has a unique name and a schema describing its expected inputs. Although tools are designed for model-controlled use, implementations can choose their own interaction patterns, with human oversight recommended so users can deny invocations.
Clients discover available tools through tools/list and invoke them through tools/call. Discovery supports pagination and caching, while servers can notify subscribed clients when their tool lists change. Available tools may depend on request authorization, but must not vary by connection. Servers can also request additional input before completing a call.
Results can include text, images, audio, resource links, embedded resources or structured JSON. Optional output schemas define the structure that server-produced results must follow, and clients should validate those results. Stateful workflows should use explicit handles passed between calls rather than implicit connection state. Execution errors provide feedback that models can use to adjust parameters and retry.
Servers must validate inputs, enforce access controls, rate limit invocations and sanitize outputs. Clients should confirm sensitive operations, display inputs before execution, validate results, apply timeouts and log usage. An optional HTTP header mechanism exposes designated parameters to network intermediaries for routing, but developers should not use it for sensitive information.