MCP (Model Context Protocol) is an open standard introduced by Anthropic in 2024 that defines a universal, structured way for AI language models to connect with external tools, data sources, and services. It acts as a common interface layer — often described as a 'USB-C port for AI' — so that any compliant AI host can plug into any compliant tool without custom integration code.
MCP is a client-server protocol that standardizes how an AI model (the client/host) discovers and calls external capabilities (the server). Rather than every AI application hard-coding its own integrations, MCP defines a shared message format and lifecycle for tool use, resource access, and prompt templating. It is transport-agnostic, supporting stdio for local processes and HTTP with Server-Sent Events (SSE) for remote services.
Before MCP, connecting an LLM to a database, a file system, or a third-party API required bespoke glue code for every model-tool combination, creating an M×N integration problem. MCP collapses this to M+N: build one MCP server per tool and one MCP client per AI host, and they interoperate automatically. This dramatically accelerates the AI agent ecosystem and makes integrations portable across different models and platforms.
An MCP server exposes three primitive types: Tools (callable functions with a JSON Schema for inputs/outputs), Resources (read-only data like files or database records), and Prompts (reusable prompt templates). The AI host sends a JSON-RPC 2.0 message to discover available capabilities via a 'list' request, then invokes specific tools or resources with 'call' or 'read' requests. The server responds with structured results that the model incorporates into its context to generate a final answer.
A typical flow starts with the host (e.g., Claude Desktop or an IDE plugin) spawning or connecting to one or more MCP servers at startup and performing capability negotiation. During a conversation turn, the model decides to invoke a tool; the host marshals the call to the appropriate server and returns the result as a new context message. Servers are stateless per-request or can maintain session state depending on the transport used, giving flexibility for both lightweight and stateful integrations.
Tool schemas must be precise — vague or overly broad JSON Schema definitions cause models to misuse or skip tools entirely, so describe every parameter clearly with enums and constraints where possible. Authentication and authorization are the responsibility of the MCP server, not the protocol itself, so always secure remote servers with OAuth 2.0 or API-key validation at the transport layer. Finally, keep individual tools narrowly scoped; a single 'do everything' tool hurts model reasoning quality compared to several well-named, single-purpose tools.
© RM Full Stack & AI Engineer · All guides · Roadmaps · Open the app