Wiring MCP Servers to Claude Code: The 20-Minute Setup Guide
Most developers open Claude Code, start chatting, and never connect it to their actual work environment. No GitHub access. No database queries. No Slack integration. They're using a sports car in first gear.
The Model Context Protocol (MCP) lets Claude Code talk to external tools. But the official docs lead with protocol specifications and architecture diagrams. You don't need theory. You need working configs.
This guide shows you exactly how to wire three useful MCP servers into Claude Code: GitHub for repository access, Postgres for database queries, and Slack for team communication. Copy, paste, debug, done.
Table of Contents
- Understanding the Config File Structure
- Server One: GitHub Repository Access
- Server Two: Postgres Database Queries
- Server Three: Slack Team Integration
- Debugging Silent Failures
- What Actually Happens Behind the Scenes
Understanding the Config File Structure
Claude Code reads MCP server configurations from a single JSON file. Location depends on your operating system:
| Operating System | Config File Location |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
The structure is simple. Each server gets a name, a command to start it, optional arguments, and environment variables for secrets.
{
"mcpServers": {
"server-name": {
"command": "executable-path",
"args": ["arg1", "arg2"],
"env": {
"API_KEY": "your-secret-here"
}
}
}
}
Claude Code spawns each server as a child process when it starts. The server runs in the background, waiting for requests. When you ask Claude to check GitHub issues or query a database, it routes the request through the appropriate MCP server.
Analogy: Think of MCP servers like phone extensions in an office. Claude Code is the receptionist. When you ask for sales data, Claude transfers you to extension 204 (the Postgres server). When you need code review stats, you get extension 301 (the GitHub server). Each extension has its own connection and credentials.
Server One: GitHub Repository Access
The GitHub MCP server lets Claude read repositories, pull requests, issues, and commit history. Useful for code reviews, documentation generation, and project analysis.
First, install the server:
npm install -g @modelcontextprotocol/server-github
Create a GitHub personal access token with repo scope. Go to Settings > Developer settings > Personal access tokens > Generate new token. Copy the token.
Add this to your claude_desktop_config.json:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_yourActualTokenHere"
}
}
}
}
Restart Claude Code. Ask it: "Show me the open issues in my-org/my-repo tagged with bug." If configured correctly, Claude will fetch and summarize them.
Server Two: Postgres Database Queries
The Postgres MCP server executes read-only queries against your database. Perfect for analytics, schema inspection, and data validation.
Install the server:
npm install -g @modelcontextprotocol/server-postgres
You need a database connection string. Format: postgresql://username:password@host:port/database
Add this config:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_yourActualTokenHere"
}
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_URL": "postgresql://user:pass@localhost:5432/mydb"
}
}
}
}
Restart Claude Code. Try: "Show me the top 10 users by order count in the last 30 days." Claude writes and executes the SQL query.
The server runs queries as read-only by default. If you need write access, you'll modify the server initialization parameters, but that's outside the 20-minute scope.
Server Three: Slack Team Integration
The Slack MCP server reads channels, posts messages, and searches conversation history. Useful for team updates, status reports, and context gathering.
Install:
npm install -g @modelcontextprotocol/server-slack
Create a Slack app at api.slack.com/apps. Add these OAuth scopes: channels:read, channels:history, chat:write. Install to workspace. Copy the Bot User OAuth Token (starts with xoxb-).
Full config with all three servers:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_yourActualTokenHere"
}
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_URL": "postgresql://user:pass@localhost:5432/mydb"
}
},
"slack": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-slack"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-yourActualTokenHere"
}
}
}
}
Restart Claude Code. Ask: "Summarize the engineering channel discussions from yesterday." Claude fetches and analyzes the messages.
Debugging Silent Failures
MCP servers fail quietly. Claude Code won't throw errors if a server doesn't start. Here's how to diagnose:
Check the logs. Claude Code writes MCP activity to:
| Operating System | Log Location |
|---|---|
| macOS | ~/Library/Logs/Claude/mcp.log |
| Windows | %APPDATA%\Claude\logs\mcp.log |
| Linux | ~/.config/Claude/logs/mcp.log |
Look for startup errors, connection timeouts, or authentication failures.
Test the server manually. Run the command outside Claude Code:
GITHUB_TOKEN=ghp_yourToken npx -y @modelcontextprotocol/server-github
If it crashes or hangs, the problem is the server itself, not Claude's integration.
Verify JSON syntax. One misplaced comma breaks everything. Use jsonlint or paste your config into an online validator.
Check environment variable syntax. Tokens can't have quotes inside the string value. No trailing spaces. No newlines.
Restart completely. Quit Claude Code fully (not just close the window). Kill any orphaned MCP server processes. Restart.
Common failures:
| Symptom | Cause | Fix |
|---|---|---|
| Server not listed in Claude | JSON syntax error | Validate config file |
| Server listed but unresponsive | Wrong executable path | Check command value |
| Authentication errors in logs | Invalid token | Regenerate API token |
| Connection timeout | Network/firewall block | Test connectivity manually |
What Actually Happens Behind the Scenes
When Claude Code starts, it reads claude_desktop_config.json. For each server entry, it spawns the command as a subprocess with the specified environment variables.
The MCP server opens a JSON-RPC communication channel over stdio (standard input/output). Claude Code sends requests like "list GitHub issues" or "execute this SQL query" as JSON messages. The server processes the request, calls the external API or database, and returns results as JSON.
Claude doesn't call GitHub or Postgres directly. The MCP server acts as middleware, handling authentication, rate limiting, and protocol translation.
This architecture means you can add new capabilities by installing new servers, without waiting for Claude updates. Want to connect to Jira, MongoDB, or your internal APIs? Write or find an MCP server that speaks their language.
The Five-Minute Version
If you just want one server working right now:
- Pick GitHub, Postgres, or Slack
- Install with
npm install -g @modelcontextprotocol/server-NAME - Get an API token or connection string
- Copy the config snippet from above
- Paste into
claude_desktop_config.json - Restart Claude Code
- Test with a simple question
You'll know it works when Claude returns real data instead of saying "I don't have access to that."
Conclusion
MCP servers turn Claude Code from a chat interface into a connected workspace. GitHub for code context. Postgres for data analysis. Slack for team knowledge. All without leaving the conversation.
The configs are simple. The debugging is straightforward. The time investment is 20 minutes. The productivity gain is immediate.
Stop using Claude Code in isolation. Wire it to your actual work environment. Then watch it go from helpful to indispensable.