MCP server

Also known as: Model Context Protocol server

On this page 7

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.

StageWhat the server doesTypical messages
InitializationReports its protocol version, name and supported featuresinitialize request and response
DiscoveryReturns descriptions of its tools, resources and promptstools/list, resources/list, prompts/list
OperationExecutes calls and returns results or errorstools/call, resources/read
UpdatesAnnounces that its catalog has changedlist_changed notifications
ShutdownReleases connections, files and credentialsTransport closes or process exits
Lifecycle of an MCP server session

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.

PrimitivePurposeControlled byExample
ToolsExecutable functions with side effects or computationModelCreate a ticket, run a query
ResourcesRead-only data identified by a URIApplicationFile contents, database schema
PromptsReusable templates for common tasksUserA slash command for code review
Server primitives and who controls them

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.

AspectLocal server (stdio)Remote server (Streamable HTTP)
Process modelLaunched by the host as a subprocessRuns as an independent web service
Users servedOne user on one machineMany users and clients
AuthenticationInherits local environment credentialsAuthorization based on OAuth 2.1
Typical useFile system, local Git, developer toolsSaaS platforms, shared company data
Main riskBroad access to the local machineToken theft and multi-tenant leakage
Local and remote MCP server deployments

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.

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.

RiskHow it arisesMitigation
Prompt injectionTool output carries hostile instructionsTreat returned content as data, require confirmations
Tool poisoningMalicious text hidden in tool descriptionsInstall only reviewed servers, pin versions
Excessive permissionsServer holds broad credentialsApply least privilege and scoped tokens
Confused deputyServer acts with its own rights for any callerBind actions to the authenticated user
Context overloadToo many tools flood the model contextExpose fewer, well-scoped tools
Common MCP server risks and mitigations

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.