AI Agent Assurance for Your Agent Deployments
Agent Assurance Tests How Your Agent Actually Behaves across Workflows, Tools, and Actions to Catch Failures and Vulnerabilities.
npm install -g @testmuai/rook@latest
What Is an MCP Server? How It Works, With Examples
What is an MCP server? See how one works under the July 2026 spec, MCP client vs server roles, tools, resources, prompts, local vs remote servers and examples.
OVERVIEW
Connecting an AI assistant to a ticket system, a code repository and a database used to mean writing a separate integration for each one. When Anthropic announced the Model Context Protocol on 25 November 2024, it named that cost: each new data source needed its own custom implementation, which made connected systems hard to scale. An MCP server is the protocol's answer: a program that wraps one system once, so any host that speaks MCP can use it.
Uptake shows in the package registry, where the official TypeScript SDK, @modelcontextprotocol/sdk, recorded 392,661,437 downloads between 4 November and 3 December 2026, according to the npm downloads API, as reported for the @modelcontextprotocol/sdk package. A download is not a user or a server, so read the figure as a measure of activity.
The current specification revision, dated 2026-07-28, changed how a client talks to a server, so many older tutorials describe a handshake that modern servers no longer require. The walkthrough on this page comes from a small server and a raw client run on 2026-12-04. Its printout shows the messages they exchanged, with the _meta envelopes removed, long lines wrapped and the tool list summarized to fit this page.
Overview
An MCP server is a program that gives AI applications tools, resources and prompts through the Model Context Protocol. It wraps one system, such as a ticket desk or a code repository, once, so any host that speaks MCP can use it. A client inside the host sends it JSON-RPC 2.0 requests over stdio or Streamable HTTP.
How Does an MCP Server Work?
- MCP server role: An MCP server offers one system as tools, resources and prompts and answers only the requests an MCP client sends. The protocol is designed so an MCP server does not see the host's whole conversation or the other servers connected to it.
- MCP client role: An MCP client is a connector inside the host application, such as Visual Studio Code, that talks to exactly one MCP server. A host runs one MCP client per connected server.
- MCP request format: Under the 2026-07-28 MCP specification, every request is self-contained and carries its own protocol version and client capabilities, so no initialize handshake comes first. Protocol versions up to 2025-11-25 still use the initialize handshake.
- MCP discovery (server/discover): The MCP server/discover request returns a server's supported protocol versions, capabilities and identity. It is required for servers and optional for clients. The identity is self-reported and not verified by the protocol, so clients should not base security decisions on it.
- MCP tool call (tools/call): An MCP tools/call request runs a tool the model chose, with the model's arguments. A failed tool run, such as invalid input, comes back as an ordinary result flagged isError: true, so the model can read the message and try again.
- Local MCP server (stdio): A local MCP server runs over stdio: the MCP client launches it as a subprocess and exchanges newline-delimited messages on stdin and stdout. It usually serves one client and takes its credentials from the environment, not from an OAuth flow.
- Remote MCP server (Streamable HTTP): A remote MCP server runs over Streamable HTTP: every message travels as an HTTP POST to one endpoint, and the server usually serves many clients. Authorization is optional, and a server that requires it should follow the specification's OAuth 2.1 profile as a resource server.
What Is an MCP Server?
A program counts as an MCP server when it gives AI applications tools, data and prompt templates through the Model Context Protocol. The project's server concepts guide calls MCP servers "programs that expose specific capabilities to AI applications through standardized protocol interfaces." The MCP architecture overview adds that the term covers the program "regardless of where it runs," so a local process and a cloud service can both be MCP servers.
The protocol uses the JSON-RPC message format. The MCP specification, revision 2026-07-28, names three roles: hosts are "LLM applications that initiate connections," clients are "connectors within the host application," and servers are "services that provide context and capabilities." It credits the Language Server Protocol as inspiration, since that protocol standardized language support across development tools in the way MCP standardizes context and tools for AI applications.
MCP is one of several AI agent protocols, and its job is narrow: giving an agent access to tools and data. Protocols that connect one agent to another solve a different problem, a split laid out in A2A vs MCP.
How an MCP Server Relates to APIs and Plugins
Many MCP servers wrap an existing API, so the two are layers rather than alternatives. The API defines what a system can do, and the server presents a chosen part of it as tools that any host can discover with tools/list and run with tools/call. The architecture overview keeps the protocol's scope tight: MCP covers context exchange and does not dictate how an AI application uses its model, a boundary explored further in MCP vs API.
A plugin is written against one host's extension system and runs only inside that host. An MCP server is written against a shared protocol, and the specification lists composability among its design principles with the line "Shared protocol enables interoperability." The server concepts guide's common examples, file system, database, GitHub, Slack and calendar servers, are all capabilities a team would otherwise rebuild per assistant.
MCP Client vs Server: What Each One Does
The client and the server sit at opposite ends of one connection, and the host owns the client. The 2026-07-28 architecture page states that "a host application creates and manages multiple clients, with each client having a 1:1 relationship with a particular server."
The architecture overview gives a concrete case. Visual Studio Code acts as the host, and when it connects to the Sentry MCP server, it creates an MCP client object that keeps that single connection open.
| Role | Where it runs | What it is responsible for | Example from the docs |
|---|---|---|---|
| Host | The AI application the user opens | Creates clients, enforces security policies and consent, makes authorization decisions and coordinates the LLM | Visual Studio Code |
| Client | Inside the host, one per server | Talks to exactly one server, attaches protocol version and capabilities to every request, keeps servers apart | The client object VS Code creates for Sentry |
| Server | A local process or a remote service | Exposes resources, tools and prompts, and sees only the requests its client sends | The Sentry MCP server |
The split is a privacy boundary as well as a wiring diagram. The specification's third design principle says servers "should not be able to read the whole conversation, nor 'see into' other servers." The full history stays with the host, which also controls any interaction between servers.
A server's identity is its own claim. The discovery page says serverInfo "is self-reported by the server and is not verified by the protocol," and clients should not rely on it for security decisions. A server's name therefore tells you nothing certain about who built it.
How Does an MCP Server Work?
An MCP server works by answering self-contained JSON-RPC requests: each names a method and its arguments, and since the 2026-07-28 revision each states in a _meta field its protocol version and the client's capabilities. The versioning page puts it in one line, "There is no negotiation handshake," and the server accepts or rejects every request on its own, answering an unsupported version with error code -32022.
- server/discover - returns supported protocol versions, capabilities and identity, plus optional instructions for the model. Servers must implement it; calling it is optional for clients.
- tools/list - returns each tool's name, description and input schema, which the client hands to the model.
- tools/call - runs the tool the model picked, with the arguments the model filled in.
- resources/read and prompts/get - fetch data and templates. Every primitive pairs a list method with a retrieval or execution method.
The model never talks to the server. The architecture overview describes the loop as a client that lists the available tools, provides them to a model and executes the ones the model calls. The model-side half, how a model emits a call, is covered in tool calling.
The specification's Tools page splits failures in two: protocol errors, such as an unknown tool or a malformed request, come back as standard JSON-RPC errors (its example uses code -32602). Tool execution errors, such as a failed API call or invalid input, arrive as an ordinary result with isError: true, so the model can read the message and try again.
A Minimal MCP Server and Client, Run Locally
To see the wire format, a small server built with the official Python SDK, mcp 2.3.0, and a raw standard-library client ran on 2026-12-04 on Python 3.14.6 and Windows 11. The server exposes one tool that appends a ticket to tickets.json and one resource that reads the tickets back. Line breaks were adjusted and the module docstring left out to fit this page; the tool's docstring line is left whole because the SDK sends it to the model as the tool description.
import json
from pathlib import Path
from mcp.server.mcpserver import MCPServer
STORE = Path(__file__).with_name("tickets.json")
mcp = MCPServer("ticket-desk")
def _load() -> list:
if STORE.exists():
return json.loads(
STORE.read_text(encoding="utf-8"))
return []
@mcp.tool()
def create_ticket(title: str, priority: str) -> str:
"""Open a support ticket. priority is low, normal or high."""
if priority not in ("low", "normal", "high"):
raise ValueError(f"bad priority: {priority}")
tickets = _load()
ticket_id = f"T-{len(tickets) + 1:03d}"
tickets.append({"id": ticket_id, "title": title,
"priority": priority})
STORE.write_text(json.dumps(tickets),
encoding="utf-8")
return f"Created {ticket_id}"
@mcp.resource("tickets://open")
def open_tickets() -> str:
"""Every open ticket as JSON."""
return json.dumps(_load())
if __name__ == "__main__":
mcp.run("stdio")The client uses only the Python standard library, so nothing hides the exchange. It starts server.py as a subprocess, writes one JSON-RPC message per line to its stdin and attaches the _meta envelope to each request. The excerpt below leaves out the imports, the printing and the test steps, and returns the reply where the full script prints it first.
HERE = Path(__file__).parent
META = {
"io.modelcontextprotocol/protocolVersion":
"2026-07-28",
"io.modelcontextprotocol/clientInfo": {
"name": "raw-client", "version": "0.1"},
"io.modelcontextprotocol/clientCapabilities": {},
}
class Conn:
def __init__(self):
self.p = subprocess.Popen(
[sys.executable, str(HERE / "server.py")],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL, text=True,
encoding="utf-8")
self.next_id = 1
def request(self, method, params=None, meta=True):
params = dict(params or {})
if meta:
params["_meta"] = META
msg = {"jsonrpc": "2.0", "id": self.next_id,
"method": method, "params": params}
self.next_id += 1
self.p.stdin.write(json.dumps(msg) + "\n")
self.p.stdin.flush()
return json.loads(self.p.stdout.readline())The first request asks the server what it supports. Nothing preceded it, and the reply lists one protocol version and capabilities for prompts, resources and tools (the printout drops _meta envelopes to fit the width, including the server's identity, serverInfo, which travels in the result's _meta):
1. server/discover: versions, capabilities, identity
>> {
"jsonrpc": "2.0",
"id": 1,
"method": "server/discover",
"params": {}
}
<< {
"jsonrpc": "2.0",
"id": 1,
"result": {
"cacheScope": "private",
"capabilities": {
"prompts": {
"listChanged": true
},
"resources": {
"listChanged": true,
"subscribe": true
},
"tools": {
"listChanged": true
}
},
"resultType": "complete",
"supportedVersions": [
"2026-07-28"
],
"ttlMs": 0
}
}The tools/list step shows everything the model will learn about the tool: a name, a description taken from the docstring, and parameters. That description is the server's entire pitch to the model, which also makes it a place an attacker would want to write.
2. tools/list: what the model is allowed to call
tool: create_ticket
description:
Open a support ticket. priority is low, normal or
high.
params: title, priority
required: title, priorityA valid call returned "Created T-001" with isError: false, and a call with priority "urgent" returned isError: true with the text "Error executing tool create_ticket". The fifth request asked for delete_ticket, a tool the server never declared. In this run, mcp 2.3.0 answered with an ordinary result flagged isError: true, while the Tools page lists an unknown tool among the protocol errors:
<< {
"jsonrpc": "2.0",
"id": 5,
"result": {
"content": [
{
"text": "Unknown tool: delete_ticket",
"type": "text"
}
],
"isError": true,
"resultType": "complete"
}
}A client that watches only for JSON-RPC errors would have treated both failed calls as normal replies. The last two steps show the stateless rule being enforced and the one check that settles whether the tool worked:
7. a request with no _meta
>> {
"jsonrpc": "2.0",
"id": 7,
"method": "tools/list",
"params": {}
}
<< {
"jsonrpc": "2.0",
"id": 7,
"error": {
"code": -32602,
"message": "params._meta must be an object carrying
the required
'io.modelcontextprotocol/protocolVersion' and
'io.modelcontextprotocol/clientCapabilities'
envelope keys"
}
}
8. the side effect, read from disk, not from the reply
tickets.json: T-001 high 'Refund not received'Request 7 left out _meta and was refused with -32602 before the server did any work. Step 8 reads the ticket from the file rather than from the reply: "Created T-001" was the server's description of its work, and tickets.json is the work.
Why Do Older Guides Show an Initialize Handshake?
Older tutorials open every session with initialize because protocol versions up to 2025-11-25 required it. The changelog for the 2026-07-28 revision removed the initialize and notifications/initialized handshake, added server/discover, and dropped protocol-level sessions along with the Mcp-Session-Id header of Streamable HTTP.
The versioning page calls handshake revisions legacy and per-request metadata revisions modern, and says a server "MAY implement both behaviors." The server above does: a separate probe sent a 2025-11-25 initialize to the same server.py on 2026-12-04, and it replied in the old format.
initialize (legacy 2025-11-25) reply keys:
capabilities, protocolVersion, serverInfo
protocolVersion: 2025-11-25That reply is what lets an old client open a session with this server; whether every later legacy request is honored depends on the SDK, so test it before relying on it. If you maintain a server and want to move it to the stateless model on purpose, read stateless MCP migration before changing anything.
Tools, Resources and Prompts in an MCP Server
A server offers up to three primitives, and what separates them is who decides when each one gets used. The server concepts guide assigns each one a controller, and the run above uses two of them:
| Primitive | Who controls it | What it is | In the run above |
|---|---|---|---|
| Tools | The model | Functions the model calls when a request needs them; they can write to databases, call APIs or modify files | create_ticket, which writes tickets.json |
| Resources | The application | Read-only data, each item identified by a URI, such as file contents or a database schema | tickets://open, the open tickets as JSON |
| Prompts | The user | Instruction templates the user picks, typically through slash commands in the host's interface | None exposed |
Each control model comes with a rule in the specification. For tools, "there SHOULD always be a human in the loop with the ability to deny tool invocations"; resources are "application-driven," with the host deciding what context to include; prompts are "user-controlled." The server concepts guide adds that prompt arguments carry no types and every value is sent as a string.
In the 2026-07-28 revision, elicitation (a server's request for more information from the user) is the only active client feature. The Roots and Sampling client features and the server's protocol logging are deprecated: they still work during the deprecation window, and new implementations should not add them.
Local vs Remote MCP Servers
A local server runs on the user's machine and a remote one runs as a network service, but the protocol does not change: the 2026-07-28 transports page says "Protocol semantics are identical on every transport." What changes is who starts the server, where its credentials come from and how many clients it serves.
| Attribute | Local server (stdio) | Remote server (Streamable HTTP) |
|---|---|---|
| Who starts it | The client launches it as a subprocess | It runs as an independent process behind one HTTP endpoint, such as https://example.com/mcp |
| How messages travel | Newline-delimited messages on stdin and stdout; nothing else may go to stdout, and logs go to stderr | Each message is an HTTP POST with an MCP-Protocol-Version header; replies come as JSON or a request-scoped SSE stream |
| Clients served | Typically one | Typically many |
| Credentials | Taken from the environment; the authorization specification says stdio servers should not follow it | Optional OAuth 2.1 authorization, with the protected server acting as an OAuth resource server |
| Main exposure | Runs with the same privileges as the client and may reach the user's system directly | Network attacks: servers must validate Origin against DNS rebinding and should bind to 127.0.0.1 when run locally |
The authorization page sets a hard rule for remote servers: "MCP servers MUST NOT accept or transit any other tokens" than the ones issued for them. Streamable HTTP arrived in protocol version 2025-03-26 as a replacement for the older HTTP+SSE transport, which the 2026-07-28 changelog now classifies as deprecated.
Published servers lean remote. Our count of the official MCP Registry API on 4 December 2026 found 81,211 active servers at their latest version: 56,344 list a remote endpoint, 29,577 a local package and 5,444 both. Remote endpoint types split 56,982 streamable-http to 1,166 sse, and the largest package sources were npm (20,928) and PyPI (5,877).
Read those figures as listings, not usage: the registry is a catalog in preview, filled by the servers' own publishers. One server can list more than one endpoint or package, so the type counts add up to more than the server counts.
MCP Server Examples
The MCP project keeps seven reference servers in its servers repository, as read on 4 December 2026: Everything, Fetch, Filesystem, Git, Memory, Sequential Thinking and Time. The README is direct about their purpose: they "are meant to serve as educational examples for developers building their own MCP servers, not as production-ready solutions."
Servers from the repository's early days, including GitHub, Postgres, Slack and Puppeteer, now live in a separate archived repository, so a guide that still lists them as reference servers is out of date. The Filesystem MCP server, which provides file operations with configurable access controls, has its own guide to setup, allowed directories and security.
For everything outside the reference set, the README points to the MCP Registry counted in the previous section. A registry listing says nothing about maintenance or safety, so for a shortlist sorted by job, start from best MCP servers and check each server's publisher yourself.
When Should You Use an MCP Server?
Use an MCP server when a capability has to reach a model at run time, in more than one host or agent. These cases fit well:
- Shared capability - several hosts or agents need the same system, and one server replaces an integration per assistant.
- Model-chosen actions - the model should decide during the task which tool to call and with what arguments, working from the schemas in tools/list.
- Context the host pulls in - data the application should read into the model's context, exposed as resources with stable URIs.
Skip it when your own code makes one fixed call: calling the API directly is simpler, because MCP only standardizes context exchange and puts a process and a protocol in between. Plan for state, too, since the Tools page notes that MCP "has no protocol-level session," so a server that relates one call to the next has to return an explicit handle from a creation tool.
If you decide to write one, how to build an MCP server walks through choosing an SDK and building a complete server. If a Python example imports FastMCP from the official mcp package, note that mcp 2 (released 2026-07-28) renamed it mcp.server.mcpserver.MCPServer, the import used above.
What Can Go Wrong With an MCP Server?
The specification does not soften the risk: "Tools represent arbitrary code execution and must be treated with appropriate caution," and hosts must obtain explicit user consent before invoking any tool. Local servers may reach the user's system, so the Security Best Practices page makes clients with one-click setup show the exact command untruncated and advises warning users that servers run with the client's privileges. Server instructions from server/discover and every tool description land in the model's context, so either can carry injected commands, the channel MCP server instructions examines, while MCP security covers the attack classes and controls.
An AI bill of materials lists every server an agent can reach, so when one is reported as compromised, the team can see which agents call it.
Testing the server itself starts with the failure modes the run above exposed: two failed calls returned as isError results, and a request refused for missing metadata. MCP testing covers the layers of server tests, and the MCP Inspector lets you send each request by hand and read the raw reply.
Testing Agents That Act Through MCP Servers
For an agent, an MCP server is the route to the outside world: through it the agent calls tools, writes files, updates records and hits APIs. The run above shows why the reply is weak evidence, since the server said "Created T-001" and only tickets.json confirmed a ticket existed.
Agent Assurance, which TestMu AI makes for agents that act through tools, files and APIs, treats a claimed action as unproven until the observed effect backs it. Most eval and observability tools score what your agent said and recorded; Agent Assurance checks what the run changed, and reports what it could not verify.
An MCP tool can also be how Agent Assurance reaches the agent under test: a profile invokes the agent through an MCP tool, an HTTP endpoint or a command, driven by reviewable hook scripts. Its discovery reads MCP server configs with no model involved and, rather than believing what a config claims, queries the server itself for the tools it exposes.
MCP servers that the Rook CLI itself connects to, for discovery and read-only checks, form a separate registry: one that comes from a project file or a cloned repo stays inert until a person signs off on its exact fingerprint by running rook mcp approve. A criterion can be graded by a read of the system the agent changed (check: mcp_probe), so an approved read-only MCP tool can confirm the record the agent claims it created.
For remote MCP servers, Streamable HTTP is the transport the Rook CLI release notes name, and the Agent Assurance MCP documentation describes the setup. Adversarial scenarios fall in categories such as hijacking, prompt_injection and data_exfiltration, and an attack that plants content in the target runs only when an open hook seeds it. Verdicts per criterion are Pass, Fail and Unable to Verify, the last one stays out of the pass rate, and because writes are real, runs belong on staging.
Installing Rook CLI from npm requires Node.js version 20 or later, with the command below. Homebrew and the shell installer do not depend on Node, while the coding-agent skill installer (npx @testmuai/rook-skill) requires version 22 or later. Agent Assurance offers a free trial of 7 days and 10,000 credits, opened from the Start Trial button inside its web app; once it ends, compare plans at the Agent Assurance pricing page.
npm install -g @testmuai/rook@latestFirst Steps With an MCP Server
Pick one system your agents need, connect a server for it from a publisher you have checked to a host in a test environment, and read its tools/list output before the model does. Then make one tool call and confirm the result in the system it changed, not in the reply.
The protocol now sits with a neutral body. On 9 December 2025 Anthropic announced it was donating MCP to the Agentic AI Foundation under the Linux Foundation, founded with contributions from Anthropic, Block and OpenAI. The MCP project's announcement says its governance model "continues as is."
npm install -g @testmuai/rook@latest, or for a full walkthrough of the product.Was this helpful?
Authors

Samyak Goyal
Author · 05 hubs
Samyak Goyal is a Senior Member of Technical Staff at TestMu AI engineering Kane CLI, the command-line tool that runs browser automation from the terminal, where a flow described in natural language executes in a real Chrome browser and returns pass or fail with shareable proof. He is a backend engineer with 4+ years of experience, previously an SDE at Innovaccer, where he built APIs, introduced Kafka, and cut deployment from weeks to hours. Samyak also builds multi-agent systems, skill-orchestration frameworks, and a personal copilot that indexes 200+ microservice repositories.

Sirajuddin Khan
Reviewer
Sirajuddin Khan is Vice President of Product Management at TestMu AI, where he drives the company's agentic AI product strategy, building a suite of autonomous agents that includes Agentic Browsers and Agentic Visual Testing and shifting the unit of work from test execution to autonomous outcomes. One of the company's earliest product leaders, he has owned the roadmap for the high-performance execution cloud and grew the cross-browser testing products from early adoption to market leadership. He brings over a decade of experience across SaaS, B2B, and eCommerce, with earlier product roles at Wydr and ShopClues, where his catalog and search work cut delivery SLAs and lifted seller activity. Sirajuddin holds an MBA in Information Technology from Sikkim Manipal University and a B.Tech in Computer Science Engineering from Maharshi Dayanand University.
MCP Server FAQs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests


