MCP Server Integration Intermediate
The Model Context Protocol (MCP) lets Claude Code connect to external tools and services. MCP servers run as separate processes and provide Claude with additional capabilities like database access, web search, and API integrations.
What is MCP?
MCP (Model Context Protocol) is an open standard that lets AI models interact with external tools through a standardized interface. An MCP server:
- Runs as a separate process (local or remote)
- Exposes tools that Claude can invoke
- Handles communication via JSON-RPC over stdio or HTTP
- Provides resources (data) and prompts alongside tools
Configuration
MCP servers can be configured at two levels:
Project-level (.mcp.json)
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
User-level (claude_desktop_config.json)
{
"mcpServers": {
"web-search": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-web-search"],
"env": {
"BRAVE_API_KEY": "your_key_here"
}
}
}
}
Popular MCP Servers
| Server | Package | Provides |
|---|---|---|
| Filesystem | @modelcontextprotocol/server-filesystem |
File read/write/search beyond working directory |
| GitHub | @modelcontextprotocol/server-github |
Issues, PRs, repos, actions |
| PostgreSQL | @modelcontextprotocol/server-postgres |
Database queries and schema exploration |
| Slack | @modelcontextprotocol/server-slack |
Read/send messages, channels, users |
| Web Search | @anthropic/mcp-server-web-search |
Search the web via Brave Search API |
| Memory | @modelcontextprotocol/server-memory |
Persistent knowledge graph storage |
Multi-Server Setup
You can run multiple MCP servers simultaneously. Claude will have access to tools from all configured servers:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "$GITHUB_TOKEN" }
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": { "DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb" }
},
"slack": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-slack"],
"env": { "SLACK_BOT_TOKEN": "$SLACK_TOKEN" }
}
}
}
$GITHUB_TOKEN) and set them in your shell profile, or use a .env file excluded from git.
Debugging MCP Connections
# Check if Claude Code recognizes your MCP servers Claude > /doctor # Test an MCP server manually $ npx -y @modelcontextprotocol/server-github --help # Check for errors in Claude Code logs $ cat ~/.claude/logs/mcp.log
- Server not found: Ensure the npx package name is correct and Node.js is installed
- Auth failures: Check that environment variables are set correctly
- Timeout: Some servers take a few seconds to start. Restart Claude Code if tools are not showing up
- Permission denied: Claude Code needs permission to use MCP tools. Check your permission settings
Ready to Go Deeper?
Live instructor-led courses from our partners. Affiliate disclosure.
AI & ML Courses - 30% Off
Live instructor-led AI, machine learning, data science, and cloud courses for working professionals. Use code Limited30 at checkout.
EdurekaDataCamp - AI & Data Science
Hands-on Python, machine learning, and AI courses with interactive exercises and real projects.
DataCampedX - Top AI Courses
University-level AI courses from MIT, Harvard, Stanford. Earn certificates that employers recognize.
edX