What is MCP (Model Context Protocol)?
MCP is an open protocol for connecting AI applications to tools and data sources. Anthropic open-sourced it on 25 November 2024; the announcement describes the problem it addresses as every new data source requiring its own custom implementation, which makes connected systems hard to scale. With MCP, a data source or tool is written once as a “server”, and different applications that support the protocol can connect to it the same way.
Model Context Protocol (MCP) defines how an AI application can discover and use capabilities exposed by another program. An MCP host is the application the user runs. It creates a client connection for each server. A server can expose tools that perform actions, resources that provide data, and prompts that offer reusable templates. The model itself is not an MCP client: the host decides what to show the model and whether a requested call is allowed. This distinction matters when you design permissions. The MCP architecture specification defines these roles and boundaries.
How does MCP work?
The host creates a client for each server it connects to, and each client holds a one-to-one session with a single server. Messages are carried over JSON-RPC. At the start of a session, client and server declare which features they support; for example, the server declares tool support and the client declares support for sampling, that is, requesting completions from the model. Only the declared features can be used in that session. Sampling reverses the usual direction: a server without its own model access asks the host's model for a response through the client. Whether to allow that request is again the host's decision; under the architecture specification, user consent and security policies are enforced by the host.
One of the specification's design principles matters especially for security: servers should not be able to read the whole conversation, nor see into other servers. The conversation history stays with the host, each server receives only the context it needs, and the host controls any interaction between servers. In practice, a file server does not automatically see the data returned by a CRM server connected to the same application.
A server can run as a local process on the user's computer or as a remote service reached over the network. Local servers are connected over standard input and output (stdio), remote servers over HTTP. This choice also determines how authorization works, as the security section below explains. A local server runs with the permissions of the user's machine, so its installation needs care; a remote server is reached over the network, so its authentication does.
What can an MCP server offer?
A server offers three building blocks, each controlled by a different party. The MCP server specification summarises the control split like this:
| Building block | What it does | Who controls it | Example |
|---|---|---|---|
| Tool | An executable function that lets the model take an action or retrieve information | The model (the host allows the call) | Document search, creating a record, an API request |
| Resource | Structured data or content supplied to the model as extra context | The application | File contents, version history, the text of a regulation |
| Prompt | A ready-made template the user runs by choice | The user | A menu option, a slash command |
This split makes design easier. Anything the model can call on its own is a tool, and tools need the tightest control. Offering read-only content as a resource rather than a tool is a simple way to avoid handing the model an action it does not need.
Hypothetical example: an assistant that finds the right version of a regulation
Suppose a legal research assistant needs to answer, “Which version of this regulation applied on the contract date?” A read-only MCP server could offer a search tool that accepts the regulation name and date, then returns matching document IDs. A resource could return the text and publication metadata for a selected version. The host would ask the user to authorize access, call only the permitted server, and pass the returned passages to the model. The final answer should name the source and effective date and say when the available records are insufficient. This is a hypothetical design example.
MCP describes the exchange between components; it does not guarantee that the retrieved regulation is current, that the model will cite it correctly, or that the user has permission to see it. Those checks belong in the application and data service. RAG may select relevant passages; MCP is one possible way to expose a retrieval capability to the host. They solve different parts of the system.
How is MCP different from a direct API integration?
A direct integration connects one application to one system; MCP opens the same server to several applications that support the protocol. MCP helps when the same data service or tool must be available to several compatible AI applications. A team can maintain one server interface and connect it to multiple hosts, subject to each host's supported features and authorization. If one application calls one internal API, a direct integration may be simpler. The familiar “N × M becomes N + M” description is an architectural goal, not a guaranteed saving: authentication, schemas, error handling, version compatibility, and user experience still need work.
| Situation | Suitable approach | Why |
|---|---|---|
| One application, one internal API, the same team owns both | Direct integration or an in-app tool definition | An extra protocol layer adds maintenance without benefit |
| The same data source will be used by several AI applications | An MCP server | The integration is written once and different hosts use the same interface |
| A desktop or developer tool with MCP support is already in use | An MCP server | Users can call the tool from the applications they already have |
| High-risk write operations, strict audit requirements | A narrow direct integration first | Permission, approval and logging rules are easier to mature in one place |
Is MCP secure?
The protocol provides building blocks for security, but your deployment decides how secure it is. Under the authorization specification, authorization is optional. Implementations that run over HTTP should conform to that specification, which is based on the OAuth 2.1 draft; local implementations using stdio should instead retrieve credentials from the environment. The specification requires servers to accept only access tokens issued for them, and forbids them from passing a received token through to another service.
MCP's security best practices page lists concrete attacks: the “confused deputy” problem, in which user consent is bypassed on servers that proxy third-party APIs; passing tokens through without validation; session hijacking; and compromise of local servers running on the user's machine. Its advice for local servers is clear: the client should show the exact command it will run without truncation, get explicit approval, and start the server with minimal privileges, ideally in a sandbox. The same page recommends starting with a minimal set of scopes and requesting more only when needed, rather than asking for broad scopes up front.
Tool annotations may describe a server's intent, but they are not a security guarantee. The MCP maintainers' explanation of tool annotations makes clear that markers such as read-only or destructive are hints, and that an untrusted server can mislabel a dangerous action. Its advice to client developers is to use these hints for the user interface but keep the actual safety guarantees in deterministic controls.
Security checklist before production
- Start with read-only operations. Separate searches from writes such as sending an email or editing a record. Require explicit approval for sensitive actions.
- Enforce access at the server. Check the user's identity and document permissions on every request. A model prompt or a tool description is not access control.
- Validate tokens. The server should accept only tokens issued for it, and connect to downstream APIs with its own token.
- Limit returned data. Return the relevant passage and source metadata, not an entire private database row or unrestricted file content.
- Treat results as untrusted. A retrieved document may contain instructions aimed at the assistant. The host must keep source text separate from its own rules and permissions.
- Log and test. Record tool identity, authorized user, result status, and source IDs without leaking sensitive document contents into logs. Test denied access, stale data, malformed responses, and prompt-injection attempts.
How do you roll out an internal MCP server step by step?
- Narrow the use case: Which applications, which users and which questions? Two or three read-only tools are enough for a first version.
- Decide local or remote: A local server for a single-user developer tool, an authenticated remote server for team-wide use.
- Write the tool contracts: Define each tool's input schema, returned fields, error cases and a limit on results per page.
- Wire in permissions: Enforce the user's source-system permissions in the server; the service account's broad access must not pass to the user.
- Build a test set: Automate scenarios for correct results, unauthorised requests, missing records, oversized responses and documents containing instructions.
- Version and monitor: Version tool names and schemas, try changes on connected hosts, and track error and denied-request rates.
Common mistakes
- Treating MCP as a security layer in itself; the protocol defines the connection, your deployment enforces permissions.
- Building an MCP server for a single application and a single API, adding one more layer to maintain.
- Requesting every scope on first connection and confronting users with broad consent screens.
- Effectively giving every user the broad access of the server's service account.
- Trusting a “read-only” annotation and removing the approval step.
- Installing a local server from an unclear source without reviewing the command it will run.
Our AI agent development page explains how we define the tools agents use to reach internal systems narrowly and with clear permissions, and use MCP for those connections where it fits.