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
Claude Code MCP: How to Add MCP Servers to Claude (2026)
Claude Code MCP connects Claude to real tools through one open standard. Learn how to add MCP servers in Claude Code and Desktop and build your own securely.
Last Updated on:
Claude MCP, which most developers meet as Claude Code MCP, is how Claude reaches your tools, files, and systems through a single open standard. MCP stands for Model Context Protocol, an open specification Anthropic released in November 2024.
This guide covers how the protocol works, how to add servers in Claude Code, Claude Desktop, and Claude.ai, how to build your own, and how to keep them secure.
TL;DR
Claude MCP is Model Context Protocol support inside Claude, letting the model call external tools and read live data through one shared interface. The choice of server type turns on where your data lives and who controls the tool.
- MCP - an open, model-neutral protocol that standardizes how AI apps connect to tools and data.
- Architecture - a host runs one client per server, and each server exposes tools, resources, and prompts.
- Transports - stdio servers run locally on your machine, and Streamable HTTP servers run remotely.
- Build - official SDKs in Python, TypeScript, and eight more languages ship a working server in minutes.
What Is Claude MCP?
Claude MCP is Claude speaking the Model Context Protocol, an open standard that lets the model call external tools and read live data through one shared interface instead of custom integrations.
The official MCP docs compare it to a USB-C port for AI applications. One connector replaced a drawer of proprietary cables, and one protocol replaces a codebase of custom integrations.
Anthropic donated MCP to the Linux Foundation's Agentic AI Foundation in December 2025, so it is not locked to Claude. Servers written for Claude also run against clients such as ChatGPT, Visual Studio Code, and Cursor, as MCP and AI agents explains. For OpenAI's client, Codex MCP covers setup, per-repository config and tool approvals.
Why Does the Model Context Protocol Matter?
MCP matters because it removes repeated integration work. Connecting many AI apps to many tools once meant a custom bridge for every pair, and MCP collapses that into one protocol both sides implement once.
This is the M times N problem. With M clients and N tools, the old approach needed M times N connectors. MCP turns that into M plus N, since each side implements the protocol once.
The payoff is reuse. A GitHub server you connect to Claude Desktop today works in Claude Code tomorrow with no rewrite, and it works in a rival client the day after that.
- Write once, reuse everywhere - one server serves every compliant client, so integration effort stops multiplying.
- No vendor lock-in - the protocol is open, so your servers outlive any single model or product. OpenAI's Realtime API can also connect a voice session to remote MCP servers, and the guide to testing OpenAI Realtime agents covers the tool calls that follow.
- Live context - the model reads current data at call time instead of guessing from its cutoff.
- Real actions - a server lets Claude file a ticket or run a job.
Note: MCP connects Claude to your tools, but the tests it triggers still need somewhere to run. Point Claude at a cloud grid with 3,000+ browser and OS combinations. Start free with TestMu AI.
How Claude MCP Works Under the Hood
Claude MCP works as a client and server system. A host runs an MCP client, that client opens a connection to each MCP server, and the server exposes tools and data through structured messages.
Three roles carry the design:
- Host - the AI application the user runs, such as Claude Desktop or Claude Code, which manages clients and the model.
- Client - a connector inside the host that handles communication with a single server.
- Server - a separate program that exposes tools, resources, and prompts over the protocol.
Messages travel as JSON-RPC 2.0 over a transport, and the transport depends on where the server runs.
- stdio - the server runs as a local process and talks over standard input and output, ideal for files and local tooling.
- Streamable HTTP - the server runs remotely and talks over HTTP. It replaces the older HTTP plus SSE transport, which is now deprecated.
The flow is the same on either transport. The client discovers what a server offers, the model decides to call a tool, the client relays the call, and the server returns a structured result.
The 2026-07-28 spec revision made the protocol stateless. It removes the initialize handshake and protocol-level sessions, so every request carries its own protocol version and client capabilities.
What Are the Core Building Blocks of MCP?
MCP servers expose three core primitives. Tools are actions the model can invoke, resources are read-only data the model pulls in as context, and prompts are reusable templates a user triggers.
The primitives differ by who controls them:
| Primitive | Controlled by | Example |
|---|---|---|
| Tools | The model decides when to call | Create a GitHub issue, run a query |
| Resources | The application selects and attaches | A file, a database row, a log |
| Prompts | The user picks and invokes | A saved code-review template |
Sampling and roots are on the way out. The 2026-07-28 revision deprecates both, so new servers should call an LLM provider directly and take paths through tool parameters or server config. They keep working during a deprecation window of at least twelve months.
Most servers start with tools alone. Reach for resources and prompts once the model needs standing context or a repeatable workflow rather than a single action.
How Claude MCP Differs From a Traditional API
A traditional API serves a developer who reads docs and hardcodes each call. MCP serves a model that discovers tools at runtime. The table below compares the two.
| Aspect | Traditional API | Claude MCP |
|---|---|---|
| Consumer | A developer writing code | A model acting at runtime |
| Discovery | Read documentation first | Query the server for its tools |
| Integration cost | Custom per client and per tool | One protocol both sides reuse |
| Schema | Varies by vendor | Standard JSON-RPC messages |
MCP does not replace your APIs. A server usually wraps an existing REST or database API and re-presents it in the shape a model can discover and call, which is why the two layers coexist.
How to Connect Your First MCP Server to Claude
Claude Code, Claude Desktop, and Claude.ai each add servers differently. Claude Code is the quickest route, and this short shows what MCP adds to it.
How to Add an MCP Server to Claude Code
Run this in your terminal, not inside a Claude session. It registers the Claude Code docs server, a hosted server that needs no sign-in:
claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcpConfirm it with claude mcp list, which should show the server as Connected. Inside a session, /mcp shows the same status and handles browser sign-in for OAuth servers.
Local servers run as a process on your machine. Everything after the -- separator is the command Claude Code starts:
claude mcp add playwright -- npx -y @playwright/mcp@latestAdd --scope to choose who gets the server. Claude Code reads .mcp.json at session start, so restart after editing it.
| Scope | Stored in | Available to |
|---|---|---|
| local (default) | ~/.claude.json, under this project | Only you, only this project |
| project | .mcp.json in the project root | Everyone who clones the project |
| user | ~/.claude.json, top-level mcpServers | Only you, all projects |
Each server's tool names and instructions take up context in every session, so remove the ones you stop using with claude mcp remove.
How to Add an MCP Server to Claude Desktop
Claude Desktop installs local servers as desktop extensions from Settings > Desktop app > Extensions. You can also define one by hand in claude_desktop_config.json, then restart the app:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"]
}
}
}To confirm it worked, click the + button in the chat box and select Connectors to see connected servers and their tools. The same setup in Cursor is covered in Cursor MCP.
How to Add a Custom Connector in Claude.ai
Remote servers connect as custom connectors. On a Pro or Max plan you add the server URL yourself, Team and Enterprise Owners add it for the organization, and Free users are limited to one.
For a quick visual walkthrough of this concept, watch the video below from TestMu AI.
Subscribe to the TestMu AI YouTube channel for more tutorials on testing and automation.
Which MCP Servers Should You Try First?
These are the servers most teams connect first, grouped by job. For more, browse the Anthropic Directory of reviewed connectors.
- Filesystem and Git - read and edit local code and history so Claude works against your real repository.
- GitHub and Slack - open issues, review pull requests, and post updates without leaving the assistant.
- Databases - query Postgres or SQLite directly, so answers come from live rows rather than guesses.
- Testing servers - trigger and triage automated tests, covered in depth in this guide to MCP servers for test automation.
Testing suits MCP well. When Claude can run a suite and read the failures, triage happens in one conversation, as the guide on MCP testing shows.
TestMu AI ships an MCP server for this. The TestMu AI MCP server connects Claude to its testing cloud over Streamable HTTP, and you sign in with OAuth on first use:
claude mcp add --transport http mcp-lambdatest https://mcp.lambdatest.com/mcp- Failure triage - Claude reads a run's test details and its command, network, and console logs, so debugging happens in the chat.
- Visual and accessibility review - it summarizes SmartUI pixel, layout, and DOM diffs, and pulls accessibility reports.
- Test management - the Test Management Platform tools generate test cases, build test runs, record results in bulk, and track milestones and coverage.
- Test orchestration - it generates HyperExecute YAML and reads job and session details.
MCP is not the only way to add testing. Kane CLI installs as a skill, so Claude Code can run end-to-end checks in a real browser from the terminal, which is how Claude Code app testing works. The guide to MCP vs agent skills explains when to use each.
For how that route compares with Playwright Test and Playwright MCP, see the best E2E testing tool for Claude Code.
How to Build a Custom MCP Server
You build a custom server when no existing one wraps your internal system. The official SDKs keep a working server short, and this example defines a single tool with the Python SDK's MCPServer class.
from mcp.server import MCPServer
# Name the server; the host uses this label in its tool list
mcp = MCPServer("weather")
@mcp.tool()
def get_forecast(city: str) -> str:
"""Return a short weather forecast for a given city."""
# Real code would call a weather API here
return f"Forecast for {city}: sunny, 24C"
if __name__ == "__main__":
# Run over stdio so a local host can launch this file
mcp.run(transport="stdio")The decorator turns a normal function into a tool the model can discover, and the docstring and type hints become the schema the client reads.
Register the file the same way you registered a prebuilt server, for example with claude mcp add weather -- python server.py, and the get_forecast tool is ready to call.
- One tool first - ship a single well-described tool before adding more, so the schema stays clear.
- Describe it well - the docstring is how the model decides when to call, so write it for a reader who cannot see your code.
- Keep stdout clean - a stdio server must never write to stdout, because a stray
print()corrupts its JSON-RPC messages. - Test with the inspector - the MCP Inspector exercises your server before any client touches it. Before you move to a spec revision such as stateless MCP, capture a baseline on the old spec, then diff the migrated server's output against it.
How to Secure and Scale Claude MCP
You secure Claude MCP by treating every server as code that runs with privileges. Install only trusted servers, scope credentials to least access, and require approval before a tool changes state.
A malicious server can expose harmful tools, and a compromised data source can carry a prompt injection that steers the model through a tool it should not call. Prompt injection can even start before any tool call, through the optional instructions string a server returns, as the guide to MCP server instructions shows.
- Vet the source - install servers from official or audited sources, not an unknown package that runs on your machine.
- Least privilege - give a server the narrowest token and filesystem root that still lets it work.
- Human in the loop - keep tool approval on for anything that writes, deletes, or spends money.
- Prefer remote auth - remote servers should sit behind OAuth so access is revocable and scoped per user.
The spec still changes between revisions, so re-test your servers after each one. MCP security covers the full threat model, including tool poisoning, permission scoping, and supply chain exposure.
MCP server contract testing covers that re-test with deterministic gates for schemas, annotation claims, outputs, permissions and evidence.
How to Adopt Claude MCP One Server at a Time
Connect one server to the Claude client you already use, ask Claude to list its tools, and run a single real task through it. Add a second server when a workflow needs it, and write your own only when nothing off the shelf fits.
For testing, add the TestMu AI MCP server and ask Claude to triage a failed run. The TestMu AI MCP Server documentation has the setup steps for each client and the full tool list.
Shipping agents that other agents use? Rook by TestMu AI does Agent Assurance: agents testing agents before release, with no human in the loop.
npm install -g @testmuai/rook@latest command, or for a full walkthrough of the product.Author
Salman is a Test Automation Evangelist and Community Contributor at TestMu AI, with over 6 years of hands-on experience in software testing and automation. He has completed his Master of Technology in Computer Science and Engineering, demonstrating strong technical expertise in software development, testing, AI agents and LLMs. He is certified in KaneAI, Automation Testing, Selenium, Cypress, Playwright, and Appium, with deep experience in CI/CD pipelines, cross-browser testing, AI in testing, and mobile automation. Salman works closely with engineering teams to convert complex testing concepts into actionable, developer-first content. Salman has authored 120+ technical tutorials, guides, and documentation on test automation, web development, and related domains, making him a strong voice in the QA and testing community.
Reviewer
Srinivasan Sekar is Director of Engineering at TestMu AI, where he leads engineering and open-source initiatives behind the Selenium and Appium automation grid and owns TestMu AI's MCP Server. A committer to Appium and a contributor to Selenium, WebdriverIO, Taiko, and AppiumTestDistribution, he brings over 15 years of experience in quality engineering and open-source technologies. He is the author of the Apress book 'The MCP Standard: A Developer's Guide to Building Universal AI Tools with the Model Context Protocol,' a Certified Kubernetes and Cloud Native Associate, and an international conference speaker. Before TestMu AI he spent over eight years at Thoughtworks as a Principal Consultant and Quality Architect. Srinivasan holds a B.Tech in Information Technology from Anna University.
Claude MCP FAQs
Did you find this page helpful?
More Related Blogs
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



















