MCP servers
The Model Context Protocol connects Claude to external services: databases, APIs, browsers, issue trackers. Servers come in three transport types: stdio (local process), SSE (hosted, often OAuth), and HTTP (REST endpoints).
Team-shared servers live in .mcp.json at the project root; personal servers go in ~/.claude.json (add with claude mcp add --scope user). Precedence when names collide: local > project > user.
{ "mcpServers": { "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" } }, "docs-api": { "type": "http", "url": "https://api.example.com/mcp", "headers": { "Authorization": "Bearer ${DOCS_API_KEY}" } } }}The ${GITHUB_TOKEN} reference is read from your shell environment when the server starts — the token never lands in the file. MCP tool names follow mcp__server__tool, which is also how you target them in hook matchers and permission rules.
Context cost is low by default: tool search defers full schemas until Claude actually uses a tool; only names load at session start. Run /mcp for connection status and per-server token costs.
Check your understanding
Section titled “Check your understanding”Question 1Where do team-shared MCP servers belong?
Project-scoped .mcp.json is committed and shared; personal servers live in ~/.claude.json.
Question 2Why write ${GITHUB_TOKEN} instead of the token itself?
Environment expansion keeps secrets out of version control.
Question 3What keeps idle MCP servers cheap in context?
Schemas are deferred until needed; /mcp shows per-server costs.