Official References: MCP Overview · MCP Specification · MCP Servers Directory
Curriculum path
- CLAUDE.md Mastery — repo memory and rules
- Effective Prompting — task framing and constraints
- MCP Power Tools — connect tools and live context ← You are here
- Multi-Agent Workflows — delegate and parallelize
- Hooks Automation — automate guardrails locally
- GitHub Actions Workflows — move repeatable work into team automation
Official docs used in this guide
- How Claude Code connects to MCP servers — MCP
- Project-scoped vs user-scoped server configuration — MCP
- Why MCP fits Claude Code’s workflow — Overview
What is MCP?
Model Context Protocol (MCP) lets you give Claude Code access to external tools and data sources. Think of it as plugins for your AI assistant.
Without MCP, Claude can read files and run shell commands. With MCP, Claude can:
- Query databases directly
- Search your company's internal docs
- Interact with APIs (Jira, Slack, GitHub)
- Access specialized tools (browsers, design tools)
Setting Up MCP Servers
Configuration Location
MCP servers are configured in .mcp.json at your project root:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb"
}
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "your-token"
}
}
}
}Essential MCP Servers
| Server | What It Does | When to Use |
|---|---|---|
server-postgres |
Direct database queries | When Claude needs to understand your schema or data |
server-github |
GitHub API access | PR reviews, issue management |
server-filesystem |
Extended file access | When working across multiple repos |
server-memory |
Persistent memory | Long-running projects needing cross-session context |
context7 |
Library docs lookup | Getting latest API docs for any library |
The context7 Pattern
One of the most useful MCP servers. Instead of Claude guessing at API signatures from training data:
You: "Add pagination to this Next.js page"
Claude: *uses context7 to fetch latest Next.js docs*
Claude: *implements with current API, not outdated patterns*
MCP vs. Codex Sandbox
GPT Codex takes a different approach — it runs in a sandboxed container where you pre-install tools. MCP is more flexible but requires local setup.
| Aspect | MCP (Claude Code) | Sandbox (Codex) |
|---|---|---|
| Setup | Config file per project | Dockerfile/setup script |
| Access | Tool-by-tool permissions | Full container access |
| Security | Granular, protocol-level | Container isolation |
| Extensibility | Any MCP server | Any CLI tool |
Project vs User Scope
MCP configuration has two scopes. Choosing the right one prevents secrets from leaking into your repo and makes onboarding easier for teammates.
Project Scope — .mcp.json
Use this when the whole team needs the same MCP servers. The file can be committed to git so everyone shares the same setup automatically.
// .mcp.json at project root — shared via git
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}
}Reference environment variables with ${VAR_NAME} rather than hardcoding values. Each developer keeps actual secrets in their own .env file.
User Scope — ~/.claude/settings.json
Use this for personal tools or servers that need your private API keys. They're available across all your projects without any per-repo setup.
// ~/.claude/settings.json — personal, available in every project
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
},
"brave-search": {
"command": "npx",
"args": ["-y", "@anthropic/server-brave-search"],
"env": {
"BRAVE_API_KEY": "your-personal-key"
}
}
}
}| Scope | File | Shared | When to Use |
|---|---|---|---|
| Project | .mcp.json |
Team-wide, committed to git | DB, project-specific tools |
| User | ~/.claude/settings.json |
Personal only | Private API keys, general-purpose tools |
More Useful MCP Servers
Beyond the basics, these servers are worth adding for day-to-day development:
| Server | What It Does | Install Command |
|---|---|---|
server-brave-search |
Web search — fetch current info | npx @anthropic/server-brave-search |
server-puppeteer |
Browser automation, screenshots | npx @anthropic/server-puppeteer |
server-slack |
Read and post Slack messages | npx @anthropic/server-slack |
server-sqlite |
Query SQLite databases | npx @anthropic/server-sqlite |
server-filesystem |
Extended file access across repos | npx @modelcontextprotocol/server-filesystem |
For example, adding Brave Search means Claude can look up the latest library issues or security patches directly instead of relying on training data. Add Puppeteer and you can automate web UI testing from inside a Claude conversation.
Building Your Own MCP Server
You're not limited to community servers. If your company has internal tools — a wiki, a monitoring dashboard, a proprietary API — you can wrap them in a custom MCP server.
The TypeScript SDK (@modelcontextprotocol/sdk) makes this straightforward:
// Concept: an MCP server that searches your internal wiki
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
const server = new Server({ name: "internal-wiki", version: "1.0.0" });
server.setRequestHandler("tools/call", async (request) => {
if (request.params.name === "search_wiki") {
const query = request.params.arguments.query;
// Call your internal wiki API
const results = await internalWikiApi.search(query);
return { content: [{ type: "text", text: JSON.stringify(results) }] };
}
});Once connected, "find our deployment runbook" becomes a real search — not a guess. Every internal system you connect multiplies Claude's usefulness for your specific context.
Debugging and Troubleshooting
Check connected servers
claude mcp listThis shows all active MCP servers and their status.
Common problems
Server won't start:
- Check that
npxis on your PATH (which npx) - Confirm your Node.js version — most MCP servers require v18 or later
- Verify required environment variables are set
Server is slow or timing out:
{
"mcpServers": {
"slow-server": {
"command": "npx",
"args": ["-y", "some-mcp-server"],
"timeout": 30000
}
}
}Viewing MCP communication logs:
claude --mcp-debugThis outputs the full request/response log between Claude and each MCP server, which is the fastest way to diagnose connection issues.
MCP's Three Primitives: Tools, Resources, Prompts
If you think MCP is just "functions Claude can call," you're only using a third of it. MCP has three core primitives:
- Tools — Functions Claude can call (e.g., query database, create issue)
- Resources — Data sources Claude can read (e.g., database schemas, config files, documentation)
- Prompts — Pre-built prompt templates the server provides (e.g., "analyze-schema", "review-code")
Most people only use Tools. Resources and Prompts unlock much deeper integration.
Resources example: A Postgres MCP server can expose table schemas as resources, so Claude always has up-to-date schema info without running a query every time.
Prompts example: A code review MCP server can provide a "security-review" prompt template that includes all the right security checks automatically.
Popular Community MCP Servers
Beyond the servers listed earlier, these community servers are widely used in real workflows:
| Server | Purpose | Install |
|---|---|---|
@anthropic/mcp-server-linear |
Linear issue tracking | npx @anthropic/mcp-server-linear |
@anthropic/mcp-server-notion |
Notion workspace access | npx @anthropic/mcp-server-notion |
@anthropic/mcp-server-sentry |
Error monitoring | npx @anthropic/mcp-server-sentry |
@anthropic/mcp-server-everart |
Image generation | npx @anthropic/mcp-server-everart |
mcp-server-docker |
Docker container management | npx mcp-server-docker |
Check https://github.com/modelcontextprotocol/servers for the full community catalog.
When choosing servers, prefer official ones (@modelcontextprotocol or @anthropic) for security.
Building MCP Servers with Python
The Python SDK is an alternative to TypeScript — and often simpler for data-heavy workflows.
pip install mcpExample: wrapping an internal API.
from mcp.server import Server
from mcp.types import Tool, TextContent
import mcp.server.stdio
app = Server("internal-api")
@app.list_tools()
async def list_tools():
return [
Tool(
name="search_docs",
description="Search internal documentation",
inputSchema={
"type": "object",
"properties": {
"query": {"type": "string", "description": "Search query"}
},
"required": ["query"]
}
)
]
@app.call_tool()
async def call_tool(name: str, arguments: dict):
if name == "search_docs":
results = await internal_api.search(arguments["query"])
return [TextContent(type="text", text=str(results))]
async def main():
async with mcp.server.stdio.stdio_server() as (read, write):
await app.run(read, write, app.create_initialization_options())Register it in .mcp.json:
{
"mcpServers": {
"internal-api": {
"command": "python",
"args": ["-m", "my_mcp_server"]
}
}
}If you're comfortable with Python, you can wrap an internal API in about 30 minutes.
MCP Server Composition Strategy
Don't add every server you find — each one adds context overhead. Pick a stack that fits your workflow.
Full-Stack Development:
{
"mcpServers": {
"postgres": { "...": "DB queries and schema" },
"github": { "...": "PR and issue management" },
"context7": { "...": "Live library docs" }
}
}Data Engineering:
{
"mcpServers": {
"postgres": { "...": "Data warehouse queries" },
"filesystem": { "...": "Multi-repo access" },
"memory": { "...": "Cross-session context" }
}
}DevOps/SRE:
{
"mcpServers": {
"sentry": { "...": "Error monitoring" },
"docker": { "...": "Container management" },
"github": { "...": "Deployment workflows" }
}
}Rule of thumb: 2-4 servers is ideal. More than 5 can slow startup and consume context.
Pro Tips
Don't Over-Connect
Each MCP server adds context overhead. Start with 2-3 essential ones, add more as needed.
Combine with CLAUDE.md — the complete picture
Installing MCP servers is only half the job. Without explicit instructions, Claude has to guess when to reach for each tool. A clear policy in CLAUDE.md makes behavior consistent:
## MCP Tool Rules
- DB schema questions → query postgres MCP first, never guess
- External libraries → check context7 for current docs before implementing
- Issue creation/updates → use GitHub MCP, no manual API calls
- Need web info → use brave-search MCP
- Internal docs → search internal-wiki MCPWith rules like these, Claude queries the database when asked about table structure instead of hallucinating a schema.