MCP Servers

Claude Code MCP — Add Tools to Your Terminal AI

Learn how to configure, use, and build MCP servers for Claude Code. Connect your terminal AI to databases, APIs, browsers, and custom tools through the Model Context Protocol.

Claude Code MCP lets you extend Claude Code — Anthropic's terminal-based AI assistant — with custom tools, data sources, and integrations through the Model Context Protocol. Add database access, browser automation, file management, and any other capability your workflow needs.

What Is Claude Code MCP?

Claude Code is Anthropic's command-line AI assistant for developers. Out of the box, it can read and write files, run shell commands, and navigate codebases. MCP extends these capabilities by letting you plug in additional tools — database servers, messaging tools, browser automation, and anything else you can wrap in an MCP server.

Unlike Claude Desktop, which uses a JSON config file, Claude Code manages MCP servers through CLI commands. This makes it easy to add, remove, and scope servers to specific projects or use them globally across all your work.

Adding MCP Servers to Claude Code

Claude Code provides a built-in command for managing MCP servers. Here is how to add the most popular servers:

# Add a server globally (available in all projects) claude mcp add --global postgres-server npx @anthropic/mcp-postgres \ --env POSTGRES_URL=postgresql://user:pass@localhost/mydb # Add a server to the current project only claude mcp add playwright npx @anthropic/mcp-playwright # List all configured servers claude mcp list # Remove a server claude mcp remove playwright

Project-scoped servers are stored in .mcp.json in your project root. Global servers live in your home directory config. This separation lets you keep database credentials project-specific while sharing utility tools across all projects.

Project Scope

Stored in .mcp.json — version-controlled, shared with team. Best for project-specific databases and APIs.

Global Scope

Stored in ~/.claude/ — personal settings. Best for utility tools like browser, Slack, and GitHub.

Popular MCP Servers for Claude Code

Here are the MCP servers that developers use most frequently with Claude Code:

Server What It Adds Install Command
PostgresSQL queries, schema explorationclaude mcp add postgres npx @anthropic/mcp-postgres
PlaywrightBrowser automation, screenshotsclaude mcp add pw npx @anthropic/mcp-playwright
SlackRead channels, search messagesclaude mcp add slack npx @anthropic/mcp-slack
GitHubIssues, PRs, code searchclaude mcp add gh npx @anthropic/mcp-github
FilesystemControlled file accessclaude mcp add fs npx @anthropic/mcp-filesystem

Building Custom MCP Servers for Claude Code

When the off-the-shelf servers do not cover your needs, build a custom MCP server tailored to your workflow. Claude Code works with both stdio (local) and SSE (remote) transport. Here is a practical example — an MCP server that queries your internal API:

from mcp.server.fastmcp import FastMCP import httpx mcp = FastMCP("internal-api") @mcp.tool() async def get_user(user_id: str) -> dict: """Look up a user by ID from the internal API.""" async with httpx.AsyncClient() as client: r = await client.get(f"https://api.internal/users/{user_id}", headers={"Authorization": f"Bearer {os.environ['API_TOKEN']}"}) return r.json() @mcp.tool() async def search_tickets(query: str, status: str = "open") -> list: """Search support tickets by keyword and status.""" async with httpx.AsyncClient() as client: r = await client.get("https://api.internal/tickets", params={"q": query, "status": status}, headers={"Authorization": f"Bearer {os.environ['API_TOKEN']}"}) return r.json()["results"]

Then add it to Claude Code: claude mcp add internal-api python server.py --env API_TOKEN=your-token

Claude Code vs Claude Desktop MCP

Feature Claude Code Claude Desktop
Config methodCLI commands (claude mcp add)JSON config file
ScopingProject or globalGlobal only
Transportstdio + SSE + streamable HTTPstdio + SSE
Best forDevelopment workflows, CI/CDGeneral productivity

Frequently Asked Questions

How many MCP servers can Claude Code run simultaneously?

There is no hard limit. Claude Code can connect to dozens of servers simultaneously. Each server runs as a separate process, so the practical limit depends on your system resources.

Do MCP servers slow down Claude Code?

Minimally. Servers are lazy-loaded — they only start when Claude needs them. The connection overhead is negligible, and tool calls add only the latency of the underlying operation (database query, API call, etc.).

Can I share MCP server configs with my team?

Yes. Project-scoped configs in .mcp.json can be committed to version control. Use environment variables for secrets so the config is safe to share.

Last updated: 2026 • Browse all courses