/claude-code-capability-primer:claude-code-mcpfrom claude-code-capability-primer
Use when configuring MCP servers in Claude Code — connecting external tools (GitHub, Stripe, Sentry, databases), choosing transports (HTTP, stdio, WebSocket), managing scopes, handling authentication, scaling with tool search, and decidi...
Ships in claude-code-capability-primer. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Model Context Protocol (MCP) = external tools/data/resources exposed to Claude as callable tools. Live systems: issue trackers, databases, APIs, browsers, design tools. Not suitable for repo-local logic (use skills or scripts instead).
Tools are named mcp__<server-name>__<tool-name> in output. Example: mcp__github__list_issues.
Three scopes, stored in two files:
| Scope | Stored in | Shared with team | Loaded in |
|---|---|---|---|
| Local (default) | ~/.claude.json (project-specific path) | No | Current project only |
| Project | .mcp.json (repo root) | Yes, via git | Current project only |
| User | ~/.claude.json (top-level mcpServers key) | No | All your projects |
Add a server:
# HTTP server (hosted)
claude mcp add --transport http <name> <url>
claude mcp add --transport http stripe https://mcp.stripe.com
# Stdio server (local process, needs --)
claude mcp add <name> -- <command> [args...]
claude mcp add playwright -- npx -y @playwright/mcp@latest
# Set scope
claude mcp add --scope user <name> <url>
claude mcp add --scope project <name> <url>
Verify:
claude mcp list
claude mcp get <name>
Remove:
claude mcp remove <name> [--scope local|project|user]
Edit .mcp.json directly:
{
"mcpServers": {
"github": {
"type": "http",
"url": "https://api.github.com/...",
"headers": {
"Authorization": "Bearer ${GITHUB_TOKEN}"
}
},
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@playwright/mcp@latest"]
}
}
}
HTTP (hosted, recommended for remote servers):
claude mcp add --transport http <name> <url>streamable-http in JSON (MCP spec naming).Stdio (local, for filesystem/browser/db access):
claude mcp add <name> -- <command> [args...]--. Everything after -- goes untouched to the server.--env KEY=value or env in config.MCP_TIMEOUT=60000 (ms) if slow.SSE (hosted, DEPRECATED — use HTTP instead):
"type": "sse" in .mcp.json.WebSocket (hosted, for persistent bidirectional connections):
.mcp.json or claude mcp add-json."type": "ws" with url, headers, timeout, alwaysLoad.Environment variables (stdio servers):
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
${} syntax (or ${VAR:-default} for defaults) expands from shell env at runtime.
HTTP headers (hosted servers):
{
"mcpServers": {
"api": {
"type": "http",
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer ${API_TOKEN}"
}
}
}
}
OAuth (interactive browser sign-in):
claude mcp add --transport http <name> <url>! Needs authentication in /mcpclaude session: /mcp → select server → Authenticate → sign in → auto-connectedStatic token (at add time):
claude mcp add --transport http <name> <url> --header "Authorization: Bearer <token>"
What it does: Instead of loading all tool definitions upfront (bloats context for 50+ tools), Claude searches on demand and loads only what it needs (3–5 tools per search). Saves ~85% context overhead.
Who supports it: Requires Sonnet 4.5+ or Opus 4.5+. Haiku does not support tool search (on Claude Code or API).
Enabled by default: Yes. Falls back to upfront loading on Vertex AI or custom ANTHROPIC_BASE_URL.
Configure via ENABLE_TOOL_SEARCH env var:
| Value | Behavior |
|---|---|
| (unset) | Deferred on demand (default). Falls back to upfront on Vertex AI / proxy. |
true | Force deferred (fails on older models or proxies without tool_reference support). |
false | Force upfront; load all tool defs at startup. |
auto | Threshold: upfront if <10% of context, deferred otherwise. |
auto:N | Threshold: upfront if <N% of context. Example: auto:5 for 5%. |
Set in settings.json:
{
"ENABLE_TOOL_SEARCH": "true"
}
Override per query (Agent SDK only):
for await (const msg of query({
prompt: "...",
options: { env: { ENABLE_TOOL_SEARCH: "auto:5" } }
})) { ... }
Always load one server upfront (skip search):
{
"mcpServers": {
"my-server": {
"type": "http",
"url": "...",
"alwaysLoad": true
}
}
}
Tools from MCP require explicit allow-list.
CLI (first time):
mcp__<server>__<tool>?"Pre-approve via settings.json:
{
"permissions": {
"allow": [
"mcp__github__*",
"mcp__stripe__*"
]
}
}
Use wildcards to avoid per-tool approval.
When the same server is defined in multiple scopes:
The entry from the highest-precedence source is used entirely (fields not merged).
Run /mcp in session or claude mcp list from shell:
| Status | Meaning | Fix |
|---|---|---|
| ✓ Connected | Ready. | Use it. |
| ! Needs authentication | OAuth/token required. | /mcp → select → Authenticate or --header on add. |
| ✗ Failed to connect | Server down, unreachable, or bad config. | Check URL (HTTP), command (stdio), env vars, timeouts. |
| ⏸ Pending approval | Project-scope server awaiting approval. | /mcp → approve, or add to permissions.allow. |
Debug stdio: Run the command directly to see errors:
npx -y @playwright/mcp@latest
Debug HTTP:
curl -I https://mcp.sentry.dev/mcp
# 404/405: up, reachable.
# 401/403: auth missing/invalid.
# No response: network/DNS issue.
Startup timeout:
MCP_TIMEOUT=60000 claude
Reference resources in prompts (like @file.md):
@server:protocol://path
@github:issue://123
@postgres:schema://users
Execute MCP prompts as commands:
/mcp__servername__promptname [args...]
/mcp__github__pr_review 456
Use MCP when:
Use skill/script when:
Stdio server (local CLI, no auth):
"mcpServers": {
"my-tools": {
"command": "my-mcp-server",
"args": ["mcp", "--transport", "stdio"],
"description": "what this server exposes"
}
}
Common servers people add: context7 (live library docs), github (GitHub API), stripe (Stripe API), plus filesystem, database, and browser/automation servers.
Check your actual servers: /mcp in session or claude mcp list from shell.
Server not in /mcp list?
claude mcp get <name> or grep ~/.claude.json and .mcp.json.Status: "Failed to connect"?
curl -I <url> to confirm reachable.Tools visible but Claude won't call?
permissions.allow pre-approval. /mcp to approve, or add to settings.No tools in /mcp tool list?
--env KEY=value or env field.Changes to .mcp.json don't apply?
.mcp.json at startup).claude mcp reset-project-choices if you rejected server earlier.{
"mcpServers": {
"name": {
"type": "http|stdio|sse|ws",
"url": "...",
"command": "...",
"args": [...],
"env": { "KEY": "${VAR}" },
"headers": { "Authorization": "Bearer ${TOKEN}" },
"alwaysLoad": true,
"timeout": 600000
}
},
"ENABLE_TOOL_SEARCH": "auto|auto:5|true|false",
"permissions": {
"allow": ["mcp__<server>__*"]
}
}
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
12 skills in this plugin
/claude-code-agent-sdkUse when building custom AI agents headlessly, embedding Claude Code tools in an app, or running scripted/cron agents—need SDK package names, setup, core API entry points, supported languages, and relation to Claude Code CLI and Messages.../claude-code-background-agentsUse when needing to understand or manage background agents, long-running tasks, polling, scheduling, or async work in Claude Code without blocking the session./claude-code-capabilitiesUse when unsure which Claude Code capability fits a task, when about to single-thread large/cross-cutting/repetitive work, or when you or the user ask what Claude Code can do — loads the full capability map (signal → capability) and points to the deep-dive skills.npx claudepluginhub ucsandman/claude-code-capability-primer --plugin claude-code-capability-primer