MCP Servers Explained: What They Are and How AI Agents Use Them

MCP & Agent ProtocolsMaximem Team27 March 202622 min read
MCP Servers Explained: What They Are and How AI Agents Use Them
On this page
  1. What MCP actually is
  2. Hosts, clients and servers
  3. How an agent uses an MCP server on the 2026-07-28 spec
  4. Transports: stdio and Streamable HTTP
  5. The three primitives, and who controls each
  6. Tools, resources or prompts: how to choose
  7. Where agent memory fits: resource or tool
  8. What the spec requires for authorization and safety
  9. Sampling, roots and elicitation
  10. A minimal server with all three primitives
  11. Misconceptions engineers still carry
  12. When to use MCP, and when to skip it
  13. Who runs MCP, and how widely it is used
  14. Frequently asked questions

First published 27 March 2026. Updated 6 November 2026: every protocol statement below was checked that day against the current MCP specification, version 2026-07-28, which the project's versioning page lists as current.

An MCP server is a program that exposes capabilities to an AI application through the Model Context Protocol, and it offers them as three kinds of thing: tools the model can call, resources the application can read into context, and prompts the user can pick. The official documentation defines servers as "programs that expose specific capabilities to AI applications through standardized protocol interfaces" and names file system, database, GitHub, Slack and calendar servers as the common examples (server concepts). A server can run on your machine as a subprocess or somewhere else as a web service, and an agent talks to it in JSON-RPC messages, so one server works with any MCP host instead of one framework.

Most explainers written before August 2026, including the first version of this one, now describe a protocol that no longer exists in that form. The 2026-07-28 revision made MCP stateless: it removed the initialize handshake and protocol-level sessions, so every request carries its own protocol version and client capabilities (changelog). Servers no longer send requests to clients, the old HTTP with Server-Sent Events transport is formally Deprecated, and Roots, Sampling and Logging are Deprecated too (deprecated features). If you are migrating a server, our list of the 20 breaking changes in 2026-07-28 and the errors they cause is the practical companion to this page.

The part people get wrong most often is the choice between tools, resources and prompts, because that choice decides who triggers each capability and therefore where your authorization check has to live. That choice gets its own section below, with examples from agent building and a section on where memory fits.

What MCP actually is

MCP is an open protocol for connecting AI applications to external systems; the project's own introduction compares it to "a USB-C port for AI applications" (modelcontextprotocol.io). Without a shared protocol, every agent needs its own connector to every system, so N agents and M systems means N times M integrations to write and keep working. With one, each agent implements the client side once and each system implements the server side once, which turns the job into N plus M.

Three comparisons settle most of the confusion about what MCP is and is not.

MCP is not a replacement for your API. An MCP server usually wraps an API you already run. Your REST endpoints, GraphQL schema and database connections stay where they are; the server describes a slice of them in a form a model can discover and call. The live version of this page used to say MCP differs from an API because it "maintains context across interactions". On the current spec that is backwards: the architecture page now says "MCP is a stateless protocol: every request is self-contained and carries its own protocol version and capabilities" (architecture). What separates MCP from a plain API is discovery and roles, not state. A client can ask a server what it offers, and the protocol says who is meant to trigger each thing it offers.

MCP is not the same thing as function calling. Function calling is a model feature: the model emits a structured request to run a named function. MCP sits underneath it. The host fetches tool definitions from servers with tools/list, hands them to its model in whatever format that model expects, and when the model picks one, the client sends tools/call to the right server (tools spec). MCP supplies the functions and the model's function calling picks among them, so you use both together.

MCP is not a retrieval strategy. RAG decides which text to put in front of a model; MCP is how that text, or an action, travels between systems. A host can read MCP resources and then select from them "using embeddings or keyword search, or passing raw data directly to the model", in the official documentation's words (server concepts). For how MCP relates to agent-to-agent protocols, see our comparison of A2A and MCP, updated on 5 November for 2026-07-28.

Hosts, clients and servers

MCP has three roles, and the spec draws the lines between them sharply (architecture).

RoleWhat it isWhat the spec makes it responsible for
HostThe AI application the user runs: Claude, ChatGPT, an IDE, or the agent you builtCreates and manages clients, enforces security policies and consent, handles user authorization decisions, coordinates the model, and aggregates context across clients
ClientA connector the host creates, one per serverTalks to exactly one server, attaches the protocol version and capabilities to every request, routes messages, and manages subscriptions
ServerThe program exposing capabilitiesExposes tools, resources and prompts, asks the client for input when it needs it, and stays isolated from other servers

Suppose you are building a support agent that reads a help desk and an internal docs store. Your agent is the host. It runs two clients, one per server, and each client talks to its own server. The spec's design principles add one rule worth remembering: servers "should not be able to read the whole conversation, nor 'see into' other servers". Full conversation history stays with the host, and the host decides what each server sees. That rule is why MCP servers are closer to plugins than to microservices: they are small, focused programs that the host composes, and they do not coordinate with each other.

How an agent uses an MCP server on the 2026-07-28 spec

The request flow is short, and the 2026-07-28 revision made it shorter (changelog, discovery).

  1. Optional discovery. The client may call server/discover, which every server MUST implement, to learn the protocol versions, capabilities and identity the server supports. There is no handshake to complete first.
  2. Listing. The client calls tools/list, resources/list or prompts/list. Every request carries io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities in its _meta field. List results now carry required ttlMs and cacheScope fields so the client knows how long it may cache them.
  3. Use. The host gives tool definitions to its model. When the model picks a tool, the client sends tools/call. When the application wants context, the client sends resources/read. When the user picks a prompt, the client sends prompts/get.
  4. Extra input, if needed. A server that needs something more, such as a confirmation from the user, no longer sends its own request to the client. It returns an InputRequiredResult, and the client retries the original request with the answers attached. The spec calls this pattern multi round-trip requests.
  5. Change notifications, if wanted. A client that wants to know when the tool list or a resource changes opens one subscriptions/listen stream and opts in to the notification types it cares about.

Two consequences matter when you write a server. List endpoints "MUST NOT vary per-connection", though they MAY vary by the authorization on the request, so you cannot hide tools behind connection state (tools spec). And because there is no session, any state that has to survive between calls, such as a shopping cart or a database transaction, has to travel as an explicit handle: a creation tool returns an ID, the model passes it back on later calls, and the server checks the caller's authorization against that handle every time. The spec is direct about it: "a handle is a name, not a capability."

Transports: stdio and Streamable HTTP

The current spec defines two standard transports, and the meaning of every message is identical on both (transports overview).

TransportHow it worksUse it for
stdioThe client launches the server as a subprocess; newline-delimited JSON-RPC over stdin and stdout; logs go to stderr, and anything else on stdout breaks the streamA server that runs on the same machine as the host, such as a file system or local database server
Streamable HTTPEach message is an HTTP POST to one MCP endpoint; the reply comes back as a JSON object or as an SSE stream scoped to that one requestA shared or hosted server that many users or agents reach over a network

The transport the March version of this page called "HTTP with Server-Sent Events" is the 2024-11-05 transport. The spec has treated it as deprecated since 2025-03-26 and now lists it formally as Deprecated, with Streamable HTTP as the migration path (deprecated features). Streamable HTTP still uses SSE for streamed replies, which is why the two names get mixed up; the difference is that every stream now belongs to a single request. A local Streamable HTTP server also has two security rules attached: it MUST validate the Origin header on incoming connections, and it SHOULD bind to 127.0.0.1 rather than every interface.

The three primitives, and who controls each

The spec's own summary of server features is a control hierarchy (server overview).

PrimitiveWho controls itSpec's descriptionSpec's examplesProtocol methods
ToolsThe model"Functions exposed to the LLM to take actions"API POST requests, file writingtools/list, tools/call
ResourcesThe application"Contextual data attached and managed by the client"File contents, git historyresources/list, resources/read, resources/templates/list, plus subscriptions/listen for updates
PromptsThe user"Interactive templates invoked by user choice"Slash commands, menu optionsprompts/list, prompts/get

Tools are functions with a name, a description the model reads, and a JSON Schema for their inputs, optionally with an output schema for structured results. The model decides when to call one. The spec still wants a person able to stop it: "there SHOULD always be a human in the loop with the ability to deny tool invocations" (tools spec). Tools can carry behaviour hints (readOnlyHint, destructiveHint, idempotentHint, openWorldHint), and the defaults are cautious: a tool that declares nothing is treated as one that may modify and destroy things (schema).

Resources are data addressed by a URI, such as file:///project/src/main.rs or a custom scheme you define. A resource template uses a URI template such as tickets://{ticket_id} so one definition covers many items (resources spec). The protocol gives resources list, read, template and subscription operations and no write operation, which is why the official docs describe them as "passive data sources that provide read-only access to information for context". The host decides what to load and how much of it to show the model.

Prompts are templates with optional arguments that the user picks, usually as a slash command. The spec is precise about what "user-controlled" means: it "refers to who decides when the prompt is used, not who authors its content. Prompt content is defined by the server" (prompts spec).

A server can offer any subset of the three. It declares only the capabilities it implements, so a server with tools alone is a complete MCP server.

Tools, resources or prompts: how to choose

The control column is the decision. Scalekit put the consequence well on 4 November 2026: the primitive you choose is also the place you put your authorization decision. A model-controlled capability is a decision the model makes mid-task, so it has to be authorized at the moment of each call. A capability your application selects can be authorized by your own code before the model ever sees it, and a capability the user picks is authorized by the person picking it.

That leads to four questions, asked in order.

  1. Does it change anything? If it creates, updates, deletes, sends or moves something, it is a tool. Tools are the only primitive built for side effects, and side effects are exactly what should go through a confirmable, auditable call.
  2. Can your application know in advance that the model needs this data? The ticket the user has open, the tenant's SLA policy, the repository's coding conventions, the user's saved preferences: your code knows these before the model starts, so expose them as resources and let the host attach them.
  3. Does the model only discover mid-task what it needs to read? Looking up the customer that a ticket mentions, or searching docs for an error string the model just saw, is a read the model has to request. Make it a tool, and mark it readOnlyHint: true so the host can treat it differently from writes.
  4. Is it a workflow a person starts, with the same shape every time? "Triage this ticket", "draft release notes from these pull requests", "summarise this incident" are prompts. The user picks one, fills the arguments, and the model starts from a structured instruction instead of guessing the workflow from a chat message.

Applied to a coding agent, the same rule sorts cleanly. Reading a file the user has open is a resource; searching the codebase for a symbol the model just encountered is a read-only tool; running the tests or editing a file is a tool that needs approval; "review this diff against our conventions" is a prompt that points at the conventions resource.

Where vendor advice and the spec differ

Scalekit's guide is a good decision aid, and on four points the current spec says something narrower or different. Where they disagree, build to the spec.

  • "The model never fetches a resource on its own." Scalekit describes resources as documents the host attaches and the model "never fetches on its own initiative". The spec leaves that to the host: applications can expose resources through pickers, search, or "automatic context inclusion, based on heuristics or the AI model's selection" (resources spec). Application-controlled means the application chooses the policy, and a model-driven selection is one allowed policy.
  • "Resources need no per-invocation authorization." Scalekit's table says the host's choice settles it. The spec still asks the server to check: access controls SHOULD be implemented for sensitive resources, permissions SHOULD be checked before operations, and on HTTP the access token MUST travel on every request and the server MUST validate that it was issued for it (resources spec, authorization). Moving a read from a tool to a resource removes the model's decision; it does not remove the server's check.
  • "Check client capabilities at connection time and serve a tool-only variant." On 2026-07-28 there is no connection-time step to check. Capabilities arrive in _meta on every request, and list results MUST NOT vary per connection, though they MAY vary by authorization. Whether a server should return a different tool list based on the capabilities in one request is something the spec does not address, so if you keep a tool-only variant, key it on configuration or on the authorized client rather than on connection state.
  • "Annotations are the host's in-band signal." They are, with a condition the spec states as a MUST: clients must treat tool annotations as untrusted unless they come from a trusted server. A readOnlyHint on a third-party server is a claim, not a guarantee.

Scalekit also argues that tools are the one primitive every host supports and that resource and prompt support varies by host. We did not test hosts for this update, so treat that as Scalekit's observation. The spec is consistent with it in one respect: it says the protocol "does not mandate any specific user interaction model" for resources or prompts, so a host is free to show them richly, minimally, or not at all.

Do not expose the same read twice

The tempting fix for uneven host support is to publish every resource as a tool as well. Then the model sees both and calls the tool, because tools are what it acts on, and you have paid for the resource without removing the model's decision. Two cleaner options exist. A tool result can include a resource_link, a URI the client can then fetch or subscribe to, so a search tool can point at resources instead of copying them (tools spec). And a host that cannot show resources can still be served a smaller tool surface by configuration.

Where agent memory fits: resource or tool

Memory is the clearest test of the decision rule, because it is a read and a write at once. Our guide to the MCP memory server covers backends in depth; the primitive choice comes down to this.

Writes are always tools. Saving a fact, correcting one, or forgetting one changes state, so each is a tool. An append-only "remember" tool can declare destructiveHint: false; a delete tool should leave it at its default of true so the host asks first.

Memory your application can pick up front fits a resource. A user's profile and preferences, the project's standing decisions, or the summary of the last session are known before the model starts. Expose them as something like memory://users/{user_id}/profile, let the host attach them, and let a client that cares open a subscriptions/listen stream to hear when they change. Because this data belongs to one person, set cacheScope to "private": the spec says private results MUST NOT be shared across authorization contexts, while a "public" result may be served to any user by a shared cache (caching).

Memory the model has to search for mid-task fits a read-only tool. "What did this customer say about their refund last month?" depends on what the model learned in the last turn, so a recall(query) tool with readOnlyHint: true is the right shape.

Scope comes from the token, not from an argument. MCP has no user, tenant or session field, so a memory server has to decide whose memory a call touches. If a tool accepts user_id as an argument, a confused or prompt-injected model can pass someone else's. Derive identity from the authenticated request on the server and treat any scope argument as a filter inside it, which is the same rule the spec applies to handles.

A tools-only memory server is still a complete design, and it is the one that works in any host that supports tools. Maximem Synap takes that route: its hosted MCP endpoint exposes four tools, to log an exchange, check whether it finished processing, recall context, and list recent memories. A host that supports resources can still get the profile-as-resource pattern from a server built for it, and the decision rule above tells you which reads are worth moving.

What the spec requires for authorization and safety

Authorization is optional in MCP, and when it is used it depends on the transport (authorization). A stdio server SHOULD NOT use the OAuth flow and should take credentials from its environment instead. A Streamable HTTP server that requires authorization acts as an OAuth 2.1 resource server: it MUST publish OAuth 2.0 Protected Resource Metadata (RFC 9728) so clients can find its authorization server, clients MUST name the server they want a token for using resource indicators (RFC 8707), and the server MUST validate that each token was issued for it. Tokens go in the Authorization header on every request and MUST NOT appear in the query string. For registering clients, the spec now recommends Client ID Metadata Documents and lists Dynamic Client Registration as Deprecated.

The old line on this page, that MCP "supports bearer tokens and API keys", undersold how much is specified for remote servers and oversold how much is done for you. The spec defines the flow; it does not decide which user may call which tool, which is still your code.

On safety, the tools page asks servers to validate all inputs, implement access controls, rate limit calls and sanitize outputs, and asks clients to confirm sensitive operations, show tool inputs before sending them, and log tool use for audit. The resources page requires servers to validate URIs and to sanitize file paths against directory traversal (resources spec). Errors come in two kinds: protocol errors (unknown tool, malformed request) return as JSON-RPC errors, while tool execution errors return as a normal result with isError: true so the model can read the message and retry with better arguments.

Sampling, roots and elicitation

Servers used to be able to ask the client for things through three client features. Their status changed in July (deprecated features).

FeatureWhat it gave a serverStatus in 2026-07-28What to use instead
SamplingA completion from the host's modelDeprecated; earliest removal is the first revision released on or after 2027-07-28Call an LLM provider API directly
RootsThe directories the host wants the server to work inDeprecated; same removal windowPass paths as tool parameters, resource URIs or server configuration
LoggingLog messages to the clientDeprecated; same removal windowLog to stderr on stdio, or use OpenTelemetry
ElicitationInput from the user mid-request, in form mode or URL modeCurrentReturned as an InputRequiredResult and answered on retry

A minimal server with all three primitives

The official Python SDK (version 2.3.0 on PyPI on 6 November 2026) registers each primitive with a decorator. This sketch follows the patterns in the SDK's README and its tools and prompts pages; the data functions are placeholders for your own store.

from mcp.server import MCPServer
from mcp.types import ToolAnnotations

mcp = MCPServer("support")

TICKETS = {"T-1001": "Refund not received after 10 days."}

@mcp.resource("tickets://{ticket_id}")
def ticket(ticket_id: str) -> str:
    """The ticket the user has open. The host attaches it."""
    return TICKETS[ticket_id]

@mcp.tool(annotations=ToolAnnotations(read_only_hint=True))
def search_docs(query: str) -> str:
    """Search help-centre articles for an error or topic the model found mid-task."""
    return f"No articles match {query!r} in this demo."

@mcp.tool()
def add_comment(ticket_id: str, text: str) -> str:
    """Add an internal comment to a ticket. Changes state, so the host should confirm."""
    return f"Comment added to {ticket_id}."

@mcp.prompt()
def triage_ticket(ticket_id: str) -> str:
    """User-started workflow with a fixed shape."""
    return f"Triage ticket {ticket_id}: read it, propose a status and a first reply, and ask before changing anything."

if __name__ == "__main__":
    mcp.run(transport="stdio")

The official build guide walks through the same setup in Python, TypeScript and the other SDK languages, including how to connect the server to a host.

Misconceptions engineers still carry

  1. "Load every tool and the model will sort it out." Every tool definition costs context on every turn. The official client guidance says naive hosts pass every definition up front, which with dozens of servers and hundreds of tools can use most of the context window before the user's message is read, and recommends switching to progressive discovery (a search tool that loads definitions on demand) once definitions pass a threshold such as 1% to 5% of the window (client best practices). Moving host-knowable reads to resources shrinks the list too.
  2. "MCP keeps a session, so my server can remember the caller." Not since 2026-07-28. Use explicit handles and check authorization on each call.
  3. "MCP servers are microservices." They are closer to plugins: small, focused, composed by the host, isolated from each other, and often local.
  4. "If a server is sandboxed, it is safe." Sandboxing limits what a process can touch. It does not stop a server from returning instructions in a tool result, or from calling an external service it is allowed to reach. Treat tool output as untrusted input to the model and keep a human able to deny calls.
  5. "MCP handles auth for me." It specifies the OAuth flow for HTTP servers. Who may do what is still your policy.
  6. "MCP replaces my APIs." It wraps them. Your endpoints remain the system of record.

When to use MCP, and when to skip it

Use MCP when an agent needs to reach several external systems, when you want a new system to become available to every agent without new connector code, when your users bring their own tools, or when you want your product reachable from hosts such as Claude, ChatGPT, VS Code and Cursor, all of which the official site lists as MCP clients.

Skip it when one agent calls one or two internal functions and an in-process tool in your framework is simpler, or when the extra process and serialization are a cost you cannot carry. Agents that talk to other agents need a different layer as well, which our A2A vs MCP guide covers. And for browser agents, a web page can now offer tools to the agent directly, which is the subject of our piece on WebMCP for agents that already scrape.

Who runs MCP, and how widely it is used

Anthropic open-sourced MCP on 25 November 2024. On 9 December 2025 it donated MCP to the Agentic AI Foundation, a directed fund under the Linux Foundation co-founded by Anthropic, Block and OpenAI. In that announcement Anthropic reported more than 10,000 active public MCP servers and more than 97 million monthly SDK downloads across Python and TypeScript, and listed ChatGPT, Cursor, Gemini, Microsoft Copilot and Visual Studio Code among the products that had adopted it. Those are Anthropic's figures as of December 2025; we did not find a newer first-party count when we checked on 6 November 2026. The spec itself has gone through five dated revisions, 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25 and 2026-07-28.

The question for an agent builder has moved on from whether to learn MCP. It is which capabilities your agent needs, which of them the model should decide on, and which your own code should decide on before the model sees anything; get that split right and the authorization design, the context budget and the user's trust all follow from it.

Frequently asked questions

What is an MCP server in simple terms?

An MCP server is a program that gives an AI application access to an outside system, such as a database, a code repository or a help desk, through the Model Context Protocol. It offers tools the model can call, resources the application can read into context, and prompts the user can pick. It can run locally as a subprocess or remotely over HTTP.

What is the difference between an MCP host, client and server?

The host is the AI application the user runs. The host creates one client for each server it connects to, and each client talks to exactly one server. The server exposes capabilities. The host keeps the conversation and enforces consent; servers see only what the host sends them.

What is the difference between MCP tools, resources and prompts?

They differ by who triggers them. The model calls tools, which can take actions. The application reads resources, which are data addressed by a URI. The user picks prompts, which are reusable templates such as slash commands.

When should I use an MCP resource instead of a tool?

Use a resource when your application can know in advance that the model needs some data, such as the document a user has open or a tenant's policy. Use a tool when the model has to decide mid-task what to read, and mark it read-only. Anything that changes state is a tool.

Should agent memory be an MCP resource or a tool?

Both, for different parts. Writes and corrections are tools. Memory your application can select up front, such as a user profile, fits a resource with cacheScope set to "private". Searches the model decides on mid-task fit a read-only tool. Derive the user from the authenticated request rather than a tool argument.

What is the current MCP specification version?

The current version is 2026-07-28, according to the project's versioning page on 6 November 2026. It made the protocol stateless, removed the initialize handshake and sessions, and added server/discover and subscriptions/listen.

Is MCP stateless?

It is, as of 2026-07-28. Every request carries its protocol version and client capabilities, and there is no protocol-level session. Servers that need state across calls return an explicit handle and accept it as an argument on later calls.

Which transports does MCP support?

Two standard ones: stdio, for a server the client launches as a local subprocess, and Streamable HTTP, where each message is an HTTP POST to one endpoint. The older HTTP with Server-Sent Events transport is Deprecated.

How do MCP servers handle authentication?

Remote servers over HTTP follow an OAuth 2.1 profile: they publish Protected Resource Metadata, clients request tokens for that specific server, and the server validates that each token was issued for it. Local stdio servers take credentials from their environment. Authorization is optional in the spec, but any server exposing user data needs it.

Is MCP the same as function calling?

They are different layers. Function calling is how a model asks to run a function. MCP is how the host finds those functions on external servers and calls them. A host lists tools from MCP servers, gives them to its model as callable functions, and sends the model's choice back to the right server.

Do I need to implement tools, resources and prompts in every server?

You do not. A server declares only the capabilities it implements, and a server with tools alone is valid. Add resources when you have context the application can select up front, and prompts when users repeat the same workflow.

From the team at Maximem

Stop rebuilding agent memory from scratch

Maximem Synap is the context management layer we built after hitting every problem in this post ourselves. Persistent recall across sessions, entity resolution and conscious forgetting, in Python, TypeScript and REST.

Looking for more to read? See our directory of the best engineering blogs to follow.