Skip to content

MCP (Model Context Protocol)

The Model Context Protocol is an open standard for connecting Claude Code to external tools, databases, and APIs. Connect a server when you find yourself pasting data from another system — an issue tracker, a database, a monitoring dashboard — and Claude can read and act on it directly instead.

Transports

TransportWhen to useNotes
HTTPRemote cloud servicesRecommended. Uses streamable-http; supports OAuth.
SSELegacy remote serversDeprecated — use HTTP where available.
stdioLocal processes / custom scriptsRuns a command on your machine.
WebSocketServers that push events unpromptedConfig-only (type: "ws"); no OAuth, header auth only.

Adding servers

All flags (--transport, --header, --env, --scope) go before the name; -- separates the name from a stdio command.

bash
# Remote HTTP server (recommended)
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

# HTTP with an auth header
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer YOUR_GITHUB_PAT"

# Local stdio server with an env var
claude mcp add --transport stdio --env AIRTABLE_API_KEY=KEY airtable \
  -- npx -y airtable-mcp-server

Other commands:

bash
claude mcp add-json weather '{"type":"http","url":"https://api.weather.com/mcp"}'
claude mcp add-from-claude-desktop   # import from Claude Desktop (macOS/WSL)
claude mcp list                      # list servers
claude mcp get github                # details for one server
claude mcp remove github             # remove a server
claude mcp serve                     # run Claude Code itself as an MCP server

Run /mcp inside a session to complete OAuth logins, check status, and clear credentials.

Scopes

ScopeLoads inSharedStored in
local (default)Current project onlyNo~/.claude.json
projectCurrent project onlyYes, via version control.mcp.json in project root
userAll your projectsNo~/.claude.json
bash
claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic

IMPORTANT

Project-scoped servers from .mcp.json require your approval before they run — Claude Code prompts before first use. Review them before trusting a repo.

.mcp.json supports environment-variable expansion: ${VAR} and ${VAR:-default} in command, args, env, url, and headers. This lets teams share one config while keeping secrets and machine-specific paths out of version control.

json
{
  "mcpServers": {
    "api": {
      "type": "http",
      "url": "${API_BASE_URL:-https://api.example.com}/mcp",
      "headers": { "Authorization": "Bearer ${API_KEY}" }
    }
  }
}

High-value servers

ServerGives Claude
GitHubIssues, PRs, code review
Playwright / PuppeteerBrowser automation, screenshots, E2E tests
SentryError and stack-trace data
Postgres / databasesSchema and query access
FilesystemScoped file access

Keep it lean

Tool search is on by default and defers tool definitions until needed, so adding servers barely touches your context window. Even so, more servers mean more tools competing for Claude's attention.

WARNING

Too many active MCP servers degrade performance and eat context. Keep roughly 3–6 active at a time.

A CLI tool is often more context-efficient than an MCP server. The official guidance: prefer the gh CLI over the GitHub MCP for token efficiency. See cost optimization for the full tradeoff.

Source: code.claude.com/docs/en/mcp

Released under the MIT License.