MCP lets Claude Code use external tools — your database, GitHub, a browser, internal APIs. Add a server and its tools become available right inside your session.
Why: MCP (Model Context Protocol) plugs external tools into Claude Code, so it can query a database or open a PR without leaving the session. When: add a server with the CLI; its tools appear automatically. Where: servers can run locally over stdio or connect to a remote URL.
# A local server launched as a command (stdio):
claude mcp add github -- npx -y @modelcontextprotocol/server-github
# A remote server over HTTP:
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
claude mcp list # what's connected
claude mcp remove githubWhy: a .mcp.json at the project root means everyone who clones the repo gets the same tools — no manual setup. When: commit it for shared, project-specific servers. Where: choose the scope — local (just you), project (the .mcp.json file), or user (all your projects).
// .mcp.json (committed to the repo root)
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres",
"postgresql://localhost/myapp"]
}
}
}Why: many servers (GitHub, Sentry) need you to sign in before their tools work. When: run /mcp in a session to view servers, authenticate, and see the tools each one exposes. Where: once connected, just ask — Claude calls the server's tools like any other.
/mcp # list servers, authenticate (OAuth), inspect available tools
# Then just use them naturally:
# > find the 3 newest open issues labeled "bug" and summarize them
# > query the orders table for yesterday's total revenue