An MCP server (Model Context Protocol server) is a program that exposes capabilities to AI applications through the Model Context Protocol, an open standard for connecting language models to external systems. In the field of AI agents, the server is the component that wraps a database, an API, a file system or a business application and offers it as tools, resources and prompts that any compatible client can discover and use.
The protocol separates the AI application from its integrations. Instead of writing custom connectors for every model and every service, a developer builds one server per system, and any host that speaks MCP can use it. This turns integrations into reusable, interchangeable building blocks for agentic workflows.
How an MCP server fits into the protocol architecture
Within the protocol, the server sits at the far end of a host-client-server chain. It never sees the user interface or the model directly; it only answers messages from a single MCP client embedded in the host application. One host can therefore attach many servers at once, each isolated in its own session.
From the server author’s perspective, a connection passes through a predictable session lifecycle built on JSON-RPC 2.0 messages. The table lists the stages a server must handle correctly.
| Stage | What the server does | Typical messages |
|---|---|---|
| Initialization | Reports its protocol version, name and supported features | initialize request and response |
| Discovery | Returns descriptions of its tools, resources and prompts | tools/list, resources/list, prompts/list |
| Operation | Executes calls and returns results or errors | tools/call, resources/read |
| Updates | Announces that its catalog has changed | list_changed notifications |
| Shutdown | Releases connections, files and credentials | Transport closes or process exits |
Capability negotiation is strict: a feature that the server did not declare during initialization, such as change notifications, may not be used later in the session. This keeps old and new implementations compatible across protocol versions.
Capabilities an MCP server can expose
A server author packages functionality into three server primitives, and choosing the right one for each capability is a key design decision. Something the model should invoke on its own becomes a tool, data the host attaches as context becomes a resource, and a workflow the person starts deliberately becomes a prompt, so the primitive determines who initiates the operation.
| Primitive | Purpose | Controlled by | Example |
|---|---|---|---|
| Tools | Executable functions with side effects or computation | Model | Create a ticket, run a query |
| Resources | Read-only data identified by a URI | Application | File contents, database schema |
| Prompts | Reusable templates for common tasks | User | A slash command for code review |
Each tool is described by a name, a description and a JSON Schema for its input, which together form the tool schema the model reads when deciding what to call. The quality of these descriptions strongly affects tool selection accuracy, so concise, unambiguous wording is part of server design, not documentation polish.
A server can also call back into the host when the client offers client-side features. With sampling, a server borrows the host model for a subtask such as summarizing a long record, without holding its own model API key. With roots, it learns the workspace boundaries it should respect, and with elicitation, it pauses a tool call to collect a missing value from the person.
Transports and deployment models
An MCP server communicates over a transport layer, and the choice of transport largely determines how it is deployed. The specification defines standard input and output (stdio) for local processes and Streamable HTTP for remote services; an earlier HTTP transport based on server-sent events is deprecated.
| Aspect | Local server (stdio) | Remote server (Streamable HTTP) |
|---|---|---|
| Process model | Launched by the host as a subprocess | Runs as an independent web service |
| Users served | One user on one machine | Many users and clients |
| Authentication | Inherits local environment credentials | Authorization based on OAuth 2.1 |
| Typical use | File system, local Git, developer tools | SaaS platforms, shared company data |
| Main risk | Broad access to the local machine | Token theft and multi-tenant leakage |
Official software development kits exist for several languages, including Python and TypeScript, so a basic server that wraps an existing API can be written in a short amount of code. Production servers additionally need logging, rate limiting and error handling that returns meaningful messages to the model.
MCP servers compared with related integration approaches
An MCP server is not the same as plain tool calling. Tool calling is the model capability to emit structured function calls, while an MCP server is a standardized, discoverable package of such functions that any compliant host can connect to at runtime.
- Native tool definitions are hard-coded in one application; an MCP server is reusable across hosts.
- A REST API is designed for programmers; an MCP server adds model-oriented descriptions and schemas on top of it.
- The Agent2Agent protocol connects autonomous agents to each other; MCP connects an agent to tools and data.
- An agent skill packages instructions and procedures; an MCP server packages live access to an external system.
In practice these approaches coexist. A coding agent may use native tools for file editing, several MCP servers for issue trackers and documentation, and agent skills that explain how to combine them.
Security risks and design practices
Because an MCP server gives a model real ability to act, its security posture defines how much damage a confused or manipulated agent can cause. The protocol itself cannot enforce safe behavior; responsibility is shared between server authors and host applications.
| Risk | How it arises | Mitigation |
|---|---|---|
| Prompt injection | Tool output carries hostile instructions | Treat returned content as data, require confirmations |
| Tool poisoning | Malicious text hidden in tool descriptions | Install only reviewed servers, pin versions |
| Excessive permissions | Server holds broad credentials | Apply least privilege and scoped tokens |
| Confused deputy | Server acts with its own rights for any caller | Bind actions to the authenticated user |
| Context overload | Too many tools flood the model context | Expose fewer, well-scoped tools |
Good practice also includes human-in-the-loop approval for destructive operations, clear separation of read and write tools, and audit logs of every call. A server that exposes dozens of overlapping tools usually performs worse than one with a small set of well-described operations.
A plain-language summary
Picture an AI assistant as a skilled clerk at a desk. The clerk is smart but cannot open other offices. An MCP server is a service window into one office, such as the billing department or the archive.
Every window works the same way. The clerk asks what services exist, fills in a short form and gets an answer back. Any assistant that knows this routine can use any window. The key takeaway: MCP servers let AI tools reach real data and take real actions. That power is also why each window needs a careful gatekeeper.
An example from practice
A support operations team at a regional internet provider wants its AI assistant to answer questions about open incidents. A developer builds a remote MCP server in Python that wraps the internal ticketing API and exposes four tools: search tickets, read a ticket, add an internal note and change ticket priority.
The server runs over Streamable HTTP behind the company single sign-on, and each request uses the signed-in employee’s scoped token, so the assistant can never see tickets the employee could not open. Read tools run freely, while the priority change requires explicit confirmation in the host application.
After a month, team leads use the assistant to summarize overnight incidents in about two minutes instead of twenty. The same server is later connected to a second AI host without any code changes, which demonstrates the main benefit of the protocol: build once, reuse everywhere.