Skip to content

MCP (Model Context Protocol)

Connect Claude Code to external tools, data, and services.

Intermediate14 min read

MCP (Model Context Protocol) is an open standard that lets Claude Code connect to external tools and data sources — GitHub, Jira, Slack, databases, and more — so instead of copy-pasting information into chat, Claude can read and act on those systems directly.

What MCP is for

Without MCP, Claude only knows what you paste into the conversation. With an MCP server connected, Claude can query your issue tracker, pull a database schema, check a monitoring dashboard, or open a GitHub PR — all from a single prompt. Think of MCP servers as plugins: each one teaches Claude how to talk to a specific tool.

  • "Implement the feature described in JIRA-4521 and open a PR on GitHub."
  • "What are the most common Sentry errors in the last 24 hours?"
  • "Find customers who haven't purchased in 90 days from our PostgreSQL database."

Add your first server

Run these commands in your terminal before starting a Claude session. There are two common shapes: a hosted server you reach over HTTP, and a local server that runs as a process on your machine.

bash
# Hosted HTTP server (recommended for cloud services)
claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcp

# Local stdio server — use -- to separate Claude's flags from the server command
claude mcp add playwright -- npx -y @playwright/mcp@latest

# Check what's connected and its status
claude mcp list

# Remove a server when you no longer need it
claude mcp remove playwright

After adding a server, start a Claude session and run /mcp to see connection status, authenticate OAuth servers, or reconnect a failed server. The first time Claude calls a new tool it will ask your permission — approve it to continue.

The -- separator
For local (stdio) servers, everything after -- is the command Claude runs to start the server. Without it, Claude misreads the server's own flags as its own options.

Server scopes

The scope controls where the server configuration is stored and who can use it. The default is local — private to you, active only in the current project.

  • local (default): stored in ~/.claude.json, tied to the current project only. Good for personal or experimental servers.
  • project: written to .mcp.json in your project root. Commit that file and every teammate who clones the repo gets the same server. Each person approves it once on first load.
  • user: stored in ~/.claude.json at the top level. Active in all your projects, private to you.
bash
# Share a server with your whole team (writes .mcp.json)
claude mcp add --scope project --transport http notion https://mcp.notion.com/mcp

# Use a server across all your projects
claude mcp add --scope user --transport http hubspot https://mcp.hubspot.com/anthropic

Using MCP tools

Once a server is connected, Claude picks the right tools automatically — you don't need to name the server in every prompt. Tool calls appear in Claude's output labeled with the server name, so you always know where information came from. MCP servers can also expose resources (data objects like issues or schemas) and prompt templates.

  • Type @ in a prompt to reference a resource by path, for example @github:issue://123.
  • Type / to see MCP prompt commands, in the format /mcp__servername__promptname.
  • Run /mcp inside a session to check status, authenticate, or reconnect.

Stay safe with third-party servers

Verify before connecting
MCP servers can execute commands on your machine and make network requests on your behalf. Servers that fetch external content can expose you to prompt injection — where malicious content in an external resource tries to hijack Claude's actions. Only connect servers you trust. Browse reviewed connectors at claude.ai/directory rather than running arbitrary servers you find online.

Each connected server also loads its tool names into every session, consuming space in Claude's context window. Remove servers you no longer use with claude mcp remove <name> to keep that space free.

Key takeaways
MCP servers are the bridge between Claude and your existing tools. Add a hosted server with claude mcp add --transport http <name> <url>, a local server with claude mcp add <name> -- <command>, and check status with claude mcp list or /mcp inside a session. Use project scope and a committed .mcp.json to share servers with your team. Full reference: code.claude.com/docs/en/mcp.