MCP is an open standard that lets Claude connect to external tools and data sources — databases, APIs, filesystems, GitHub, Slack, and more. Think of it as a plugin system: each MCP server advertises a set of tools, and Claude can call those tools during your conversation.
- You configure an MCP server (tell Claude how to start/connect to it)
- The server starts and advertises its tools
- Claude discovers the tools automatically
- You grant permissions for which tools Claude can actually use
- Claude calls the tools as needed during conversations
| Type | Use Case | Example |
|---|---|---|
| stdio | Local processes (most common) | npx @modelcontextprotocol/server-github |
| http | Remote cloud APIs | https://api.example.com/mcp |
| sse | Streaming/real-time connections | https://api.example.com/mcp/sse |
MCP servers are configured in these files (pick based on scope):
| File | Scope | Committed to git? |
|---|---|---|
~/.claude/settings.json |
User (all projects) | No |
.claude/settings.json |
Project (team-shared) | Yes |
.claude/settings.local.json |
Project (private) | No |
.mcp.json |
Project root | Yes |
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL}"]
}
}
}{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/projects"]
},
"remote-docs": {
"type": "http",
"url": "https://code.claude.com/docs/mcp"
}
}
}Tools follow the naming pattern mcp__<server>__<tool>. You must explicitly allow them:
{
"permissions": {
"allow": [
"mcp__github__list_issues",
"mcp__postgres__query",
"mcp__filesystem__*"
]
}
}Wildcards (*) grant all tools from a server — use with caution.
- GitHub — issues, PRs, repos (
@modelcontextprotocol/server-github) - Filesystem — read/write files (
@modelcontextprotocol/server-filesystem) - PostgreSQL — database queries (
@modelcontextprotocol/server-postgres) - Slack — messages and channels (
@modelcontextprotocol/server-slack) - Context7 — library documentation (fetch up-to-date docs for any library)
Full registry: https://github.com/modelcontextprotocol/servers
- Never hardcode secrets — use
${ENV_VAR}syntax in config files - Least privilege — grant specific tools, not
mcp__*__* - User-scope for secrets — put tokens in
~/.claude/settings.json, not project files - Verify sources — only use servers from trusted repositories
- Credential isolation — store credentials in environment variables
// Good
"env": { "API_KEY": "${SECRET_API_KEY}" }
// Bad - never do this
"env": { "API_KEY": "sk_live_xxxxxxxxxxxx" }- Use
/configin the REPL to view server status and settings - Connection status appears in the system init message when Claude starts
- Failed connections show errors you can debug (missing env vars, bad URLs, etc.)
| Issue | Cause | Solution |
|---|---|---|
| "failed" connection status | Missing env vars or server not installed | Verify env variables are set, check server is installed |
| Tools not being called | Missing allowedTools permission |
Add tools to permissions.allow array |
| Environment variable not expanding | Syntax error | Use ${VAR_NAME} syntax, not $VAR_NAME |
| Connection timeout | Server takes too long to start | Use a lighter-weight server or pre-warm it |
| Network error for HTTP/SSE | Server unreachable | Check URL, firewall, and server status |