MCP in Claude Code
Connecting Claude Code to tools and data sources via MCP
What MCP means in the Code context
MCP (Model Context Protocol) lets Claude Code connect to external tools and data sources beyond the local filesystem. In a coding context, this means Claude can query databases, call internal APIs, read from services like GitHub or Linear, and interact with deployment platforms — all from within a Claude Code session.
The difference it makes
| Without MCP | With MCP |
|---|---|
| “Here’s the error from the logs” (you paste it) | Claude reads the logs directly |
| “The database has these records” (you copy them) | Claude queries the database directly |
| “Here’s the open GitHub issue” (you paste it) | Claude reads issues and creates PRs |
Setting up an MCP server in Claude Code
# In your project directory, create .claude/settings.json:
{
"mcpServers": {
"database": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_CONNECTION_STRING": "postgresql://user:pass@localhost/db"
}
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-token"
}
}
}
}
Using MCP-connected tools in a session
"Query the database and show me all orders from the last 7 days where status = 'pending' and total > 500."
"Read the open GitHub issues labeled 'bug' and create a prioritized fix list based on severity and user impact."
For agency work: The highest-value MCP connections are: a database connection for projects that have one, GitHub for version control tasks, and a custom MCP server that exposes client-specific APIs you work with repeatedly.
Quizzes