$askskill.ai
← Back
$ askskill --guide claude-code-mcp-setup

Setting Up MCP in Claude Code: stdio, Remote HTTP, and Troubleshooting

2026-07-08

The cleanest way to wire MCP servers into Claude Code is the built-in claude mcp CLI rather than hand-editing nested JSON files. Once you understand transport types and config scopes, most setup errors take less than a minute to diagnose.

Choosing a Transport

TransportBest forCommand shape
stdio (local process)Local files, Git, local databases, CLI wrappersclaude mcp add name -- npx -y @org/server
HTTP (remote endpoint)Hosted SaaS tools, shared team indexes, directoriesclaude mcp add --transport http name https://...

Pay attention to the -- separator: it tells Claude Code that everything after it is the server executable and its flags, preventing the CLI from parsing server flags as its own.

Config Scopes: User vs. Project

Claude Code stores MCP declarations in three scopes:

  • --scope user: available across all repositories on your machine — ideal for general utilities like docs search or the askskill directory.
  • --scope project: writes to .mcp.json in the repo root so teammates share the same tooling. Never commit raw secrets to .mcp.json; reference environment variables such as ${GITHUB_TOKEN} instead.
  • --scope local (default): applies only to the current workspace on your machine, great for experiments or personal credentials.

Practical Examples

  1. Add a hosted HTTP MCP server (such as askskill):
claude mcp add --transport http --scope user askskill https://askskill.ai/api/mcp
  1. Add a local stdio package with an API token:
claude mcp add --scope local github -e GITHUB_PERSONAL_ACCESS_TOKEN=your_token -- npx -y @modelcontextprotocol/server-github

Verify connectivity right away:

claude mcp list
claude mcp get askskill

Four Common Pitfalls

  1. spawn npx ENOENT: When Node is managed by nvm or fnm, non-interactive child shells may miss your PATH. Run which npx and pass the full binary path if needed.
  2. Cold-start timeout on first npx -y: Downloading a large package on the first agent turn can hit startup timeouts. Pre-warm the cache once in your terminal before launching Claude Code.
  3. Missing environment variables: Shell exports in ~/.zshrc are not always inherited across desktop launchers; pass secrets explicitly via -e KEY=VAL.
  4. Logs written to stdout: Over stdio, stdout is reserved strictly for JSON-RPC messages. Custom scripts using console.log instead of console.error will break protocol framing.

Keeping Context Lean

Keep only 3–5 active MCP servers enabled at a time. Every connected server injects its tool schemas into the model context; remove unused ones with claude mcp remove <name> and re-export anytime from the MCP catalog or AI Stack Builder.

Further reading: How to Choose and Install MCP Tools Safely and MCP Security Governance for Teams.