Add MCP Server
Add an MCP server to the current project the safe way — pick the transport and scope, wire secrets through env vars, vet provenance, and verify the connection before trusting it.
/add-mcp-server<server name + launch command or URL, or a description of the server to add>npx agentscamp add commands/add-mcp-serverInstall to ~/.claude/commands/add-mcp-server.md
A slash command that adds an MCP server to the current project safely: it detects existing MCP config, chooses stdio or Streamable HTTP transport and the right scope (local, project, or user), wires secrets through env vars instead of committed config, produces the exact claude mcp add command, and verifies the server actually connected.
Scope
Treat $ARGUMENTS as the MCP server to add: a name plus a launch command (for local stdio) or a URL (for remote Streamable HTTP), or a description of the capability you want. Restate in one sentence which server you're adding, by which transport, and at which scope before changing anything.
Goal: connect the server correctly and safely — right transport, right scope, secrets via environment variables (never inline), provenance vetted for third-party servers — and verify it actually connected before declaring success.
WARNING
An MCP server runs code and is handed tool access and credentials. For any third-party server, vet provenance and pin a version before adding it — a connected server can use whatever you give it. See Connecting and Governing MCP Servers.
Step 1 — Detect how this project configures MCP
Look for existing MCP configuration: a checked-in .mcp.json (project scope), per-user config, or claude mcp usage. Match what's already there rather than introducing a second mechanism. Confirm whether the server should be local to this project, shared via a committed .mcp.json, or available across all the user's projects.
Step 2 — Choose the transport
Pick stdio for a local, single-user server the client launches as a child process; pick Streamable HTTP (with a URL) for a remote or shared server. State which and why — the transport determines whether auth is your concern (it is, for HTTP).
Step 3 — Choose the scope
Map the need to a scope: local/per-project for a personal addition, project (committed .mcp.json) for something the whole team should get, or user for a server you want everywhere. Note that a project-scoped server prompts each teammate to approve it before its tools activate.
Step 4 — Wire secrets through the environment
If the server needs tokens or keys, pass them via environment variables (e.g. --env GITHUB_TOKEN=... sourced from the environment), never hard-coded into a committed config. Confirm no secret is about to be written into .mcp.json or the repo.
Step 5 — Register it
Produce the exact registration command, options before the server name. For example:
# local stdio server
claude mcp add weather -- node ./weather-server/index.js
# remote Streamable HTTP server
claude mcp add --transport http --scope project linear https://mcp.linear.app/mcpStep 6 — Verify the connection
Confirm the server actually connected and exposes what you expect: run claude mcp list (and /mcp inside a session) to check status and tools, or connect with the MCP Inspector to list and call a tool directly. A server that's "added" but not connected — or that exposes no usable tools — is not done.
NOTE
If the server needs OAuth (common for hosted remote servers), the client will prompt for authorization on first use — /mcp is where you complete it and confirm the tools became available.
Related
- Building an MCP ServerAn accurate introduction to the Model Context Protocol: server anatomy, transports, and connecting a tool to Claude Code.
- Connecting and Governing MCP Servers: Registries, Gateways, and Tool SprawlAs MCP servers multiply, discovery, trust, and tool sprawl become the problem. How registries, gateways, and curation keep a growing fleet secure and usable.
- MCP InspectorThe official open-source visual tool for testing and debugging Model Context Protocol servers — connect, list, and call tools, resources, and prompts.
- SmitheryA registry and hosting platform for Model Context Protocol servers — discover, deploy, and connect MCP servers from one place.
- MCP Server EngineerUse this agent to build, harden, or productionize a Model Context Protocol (MCP) server — designing tools/resources/prompts, choosing stdio vs. Streamable HTTP, taking a server remote with OAuth and stateless scaling, and testing it with the MCP Inspector. Examples — "wrap our internal API as an MCP server with three tools", "take our stdio server remote so the team can share it", "our tools confuse the model — fix the names, schemas, and descriptions".
- MCP Server ScaffolderScaffold a new Model Context Protocol (MCP) server from a description — pick the SDK and transport, generate a typed first tool with a strict schema, and wire up MCP Inspector testing and the client-registration command. Use when starting a new MCP server and you want a correct, runnable skeleton instead of copying a README.
- The Best MCP Servers in 2026The MCP servers actually worth connecting in 2026 — Context7, GitHub, Chrome DevTools, Playwright, Serena, Exa, Firecrawl, and official vendor servers.
- Adding MCP Servers to Claude Code: Local, Remote, and Project-ScopedThe complete claude mcp add reference — stdio vs HTTP transports, local/project/user scopes, .mcp.json with env expansion, OAuth via /mcp, and the gotchas.
- Deploying a Remote MCP Server: Stateless, Streamable HTTP, and Horizontal ScalingTake an MCP server from local stdio to a remote, multi-user HTTP service — Streamable HTTP, stateless vs. stateful sessions, OAuth, and horizontal scaling.
- MCP Troubleshooting: Server Won't Connect & Other FixesFixes for the MCP problems people actually hit — servers failing to connect, missing tools, OAuth loops, timeouts, truncated output, and Windows quirks.
- Context7Upstash's MCP server that pulls up-to-date, version-specific library documentation into your agent's context — the cure for hallucinated APIs.