Setting up MCP servers in Claude Code requires four things done right: a well-documented tool schema, correct transport configuration (stdio for local, SSE for remote), explicit environment variables in your config file, and a full Claude Code restart after any change. Most setup failures trace back to schema description quality or environment variable gaps — not the server code itself.
.env files or shell exports.Model Context Protocol is Anthropic's open standard that lets Claude connect to external tools, data sources, and services through a defined interface. [1] Think of it as the USB-C standard for AI integrations: instead of writing custom glue code for every system Claude needs to touch, MCP gives you a consistent way to expose capabilities as "servers" that Claude can discover and call at runtime. [2]
In Claude Code specifically, MCP servers extend what Claude can do beyond its base capabilities. Instead of pasting exported data into a prompt, you give Claude a direct, live connection to:
This question came up in a thread on r/ClaudeAI where practitioners described the setup process as a "tech ritual" — and the friction is real. The three phases below cover where that friction actually lives.
---MCP setup breaks into three distinct phases, each with its own failure modes: schema design, transport configuration, and tool discovery validation.
This is where most people underinvest. Your MCP server exposes a list of tools with descriptive metadata that Claude uses to decide what to call, when to call it, and what to pass. A well-designed schema is essentially self-documenting.
For each tool, be explicit about:
MCP servers communicate with Claude Code through one of two transport mechanisms. Getting this right in your claude_desktop_config.json is where a lot of the ritual-like debugging happens.
| Transport | Best for | Key consideration | Production ready? |
|---|---|---|---|
| stdio | Local agents, single-user tools | Process must be running locally | Yes, for local use |
| SSE (HTTP) | Remote servers, multi-client setups | Needs auth & connection handling | Yes, for distributed use |
For local development and most agentic workflows, stdio is simpler and more reliable. For production deployments where the MCP server needs to run remotely or serve multiple clients, SSE is the right choice — but adds complexity around authentication and connection management.
Once your server is running and Claude Code is configured, the question is whether Claude actually discovers and correctly uses your tools. This phase is where the "ritual" feeling really kicks in. Validation should be systematic, not hopeful: test each tool individually with a prompt designed to invoke only that tool, confirm input/output, then test combinations to see how Claude chains them in real agentic loops.
Here is the process in order, stripped of ambiguity:
npm install @modelcontextprotocol/sdk. TypeScript and Python are the most mature options.claude_desktop_config.json to point to your server. Test the exact command from the config manually in your terminal before involving Claude Code.If you're curious about which MCP servers practitioners find most useful, that's a good reference for scoping what to build first.
---The majority of MCP setup failures trace back to three recurring issues.
The most common source of "it works in terminal but not in Claude Code" is environment variable and PATH differences. Claude Code does not inherit your shell environment the way a terminal session does.
.env files or shell exports that work in your terminal but aren't available when Claude Code spawns your server process. Always explicitly configure environment variables in your MCP server config entry and use absolute paths for executables rather than relying on PATH resolution.If Claude is calling your tool but getting errors, check your parameter schemas first. The MCP SDK enforces JSON Schema validation, and mismatches between what Claude passes and what your schema declares will cause quiet failures. Common culprits: string vs. number types, required vs. optional parameters, and nested object schemas that don't match the actual data structure.
MCP is still evolving. The SDK version your server uses needs to be compatible with the MCP client version Claude Code implements. When in doubt, check the current Anthropic documentation for the recommended SDK version — don't assume the latest npm release is always the right choice. [2]
---Tools organized around meaningful business actions work better in production than either giant do-everything tools or atomic CRUD operations. The right granularity sits in the middle.
Too coarse-grained and Claude can't be precise enough. Too fine-grained and you need many tool calls to accomplish something simple, burning tokens and latency. In accounts I manage — including Buddy, the open-source Google Ads agent built on Claude — tools organized around business verbs ("get campaign performance," "update bid strategy," "pause underperforming ad groups") consistently outperform both extremes.
As a rough benchmark from practitioner experience: if a single logical task requires more than four or five tool calls, your tools are probably too granular. If a single tool has more than six or seven parameters, it's probably trying to do too much.
The data your tools return shapes how well Claude can reason and take next steps. For ad campaign data, a useful pattern is:
This structure lets Claude make decisions without needing to aggregate raw numbers itself, which reduces reasoning errors in long agentic loops.
Agentic loops fail at the edges. When your MCP tool hits an API rate limit, gets a malformed response, or encounters a permission error, how it communicates that failure determines whether the agent recovers or stops.
Return structured error objects with enough context that Claude can explain what happened and suggest a next step. Avoid thrown exceptions that bubble up as opaque failures.
If you're setting up Buddy or a similar agent, the getting started documentation walks through these patterns in a concrete advertising context.
---For simple workflows, one MCP server with a handful of tools is enough. For production agents handling real advertising budgets, the architecture gets more deliberate.
Patterns that hold up at scale:
For a deeper look at how MCP connects to version control and external services in production pipelines, the MCP and GitHub reference covers that integration pattern.
---For a broader look at structuring your Claude Code projects, the complete guide to Claude Code and CLAUDE.md covers project-level configuration that works alongside MCP. And if you want to explore what the community considers the most impactful integrations, this roundup of useful MCPs is worth reading before you decide what to build.
---Yes — a full restart, not just a refresh. Claude Code initializes MCP server connections at startup, so changes to your server code, config file, or tool schemas won't take effect until you fully quit and reopen the application. This is one of the most common reasons a fix appears to do nothing: the old server process is still running.
Yes. You can register multiple servers in your claude_desktop_config.json, and Claude Code will connect to all of them at startup. Claude can then call tools from any registered server within the same conversation. For production agents, separating concerns across multiple servers — reads, writes, reporting — is a recommended architectural pattern.
stdio (standard input/output) runs the MCP server as a local process and is simpler, more reliable, and the right default for local Claude Code workflows. SSE (Server-Sent Events over HTTP) is for remote servers that need to serve multiple clients or run independently of the user's machine. Choose SSE only when you need distributed deployment; the added authentication and connection management complexity isn't worth it for local use.
Almost always, the cause is a mismatch between your tool's JSON Schema definition and what Claude is actually passing. Check parameter types (string vs. number), required vs. optional field declarations, and nested object shapes. The MCP SDK enforces schema validation, so mismatches produce silent failures at the invocation level even when the server process is healthy.
MCP server support has been extending beyond desktop. Claude on mobile now supports MCP servers in certain configurations, though the setup process and supported transport options may differ from the Claude Code desktop environment. Check the current Anthropic documentation for the latest mobile MCP support details.
There's no hard limit, but from practitioner experience, servers with fewer than fifteen well-described tools are easier to maintain and debug than large monolithic servers. The more useful constraint is granularity: if a logical task requires more than four or five tool calls, your tools may be too fine-grained. If a single tool takes more than six or seven parameters, it's likely doing too much.
More answers in this topic: Claude & Anthropic