MCP Servers — External Integrations
What Is MCP
The Model Context Protocol (MCP) is an open standard that defines how AI models connect to external tools and data sources. Instead of Claude being limited to reading files and running shell commands, MCP lets it interact with live systems -- pulling data from GitHub pull requests, querying databases, sending Slack messages, controlling a web browser, and much more.
MCP works through a client-server architecture. Claude Code acts as the client, and each integration runs as a separate MCP server. When Claude needs to interact with GitHub, it sends a request to the GitHub MCP server. When it needs to query a database, it talks to the database MCP server. Each server exposes a set of tools that Claude can invoke just like its built-in tools.
The result is that Claude Code becomes an integration hub. You can wire it up to every service in your development stack, and Claude orchestrates them all through natural language.
Why MCP Matters
Without MCP, getting live data into Claude requires manual work. You run a command, copy the output, paste it into Claude, and repeat. MCP eliminates this loop entirely.
Consider a typical code review workflow. Without MCP, you pull up the PR in your browser, copy the diff, paste it into Claude, ask for review, then manually post the review comments. With the GitHub MCP server, you can say "review PR 42 and post your feedback as review comments" -- Claude fetches the PR data, analyzes the diff, and posts comments directly, all in one interaction.
MCP also gives Claude access to data it cannot get from the filesystem. Database contents, API responses, Slack conversations, browser page content -- these all live outside your project directory but are critical for many development tasks.
Adding MCP Servers
The fastest way to add an MCP server is through the CLI:
# Add a server with a name and startup command
claude mcp add github -- npx -y @modelcontextprotocol/server-github
# Add a server with environment variables
claude mcp add database -- npx -y @modelcontextprotocol/server-postgres \
--connection-string "$DATABASE_URL"
# Add a server for browser automation
claude mcp add browser -- npx -y @anthropic-ai/mcp-server-playwright
Each command registers the MCP server so Claude Code starts it automatically at the beginning of every session. The server runs as a background process and communicates with Claude through standard I/O.
To see all registered servers:
claude mcp list
To remove a server:
claude mcp remove github
Configuration: The .mcp.json File
For project-level MCP configurations that should be shared with your team, use the .mcp.json file in your project root:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
},
"database": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_CONNECTION": "${DATABASE_URL}"
}
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "./docs", "./config"]
}
}
}
Environment variables use the ${VAR_NAME} syntax and are resolved from your shell environment at startup. This means you can commit .mcp.json to version control without exposing secrets -- each developer sets the actual values in their own environment.
Popular MCP Servers
The MCP ecosystem is growing rapidly. Here are the most useful servers for software development:
GitHub -- Full access to repositories, pull requests, issues, actions, and code search. Claude can create PRs, post review comments, manage issues, and trigger workflows.
claude mcp add github -- npx -y @modelcontextprotocol/server-github
Filesystem -- Controlled access to directories outside your project. Useful for reading documentation, configuration files, or shared resources.
PostgreSQL / MySQL -- Direct database queries. Claude can inspect schemas, run read queries, and help you write migrations based on the actual table structures.
Slack -- Read and send messages in Slack channels. Claude can search conversation history, post updates, and respond to team questions.
Brave Search -- Web search capabilities. Claude can search the internet for documentation, Stack Overflow answers, and library references.
Playwright -- Browser automation. Claude can navigate web pages, fill forms, take screenshots, and interact with web applications.
Memory -- A knowledge graph that persists across sessions. Claude can store and retrieve structured information between conversations.
Setting Up GitHub MCP
The GitHub MCP server is the most commonly used integration. Here is a complete setup:
-
Generate a GitHub personal access token with repo and read:org scopes.
-
Set the token in your environment:
export GITHUB_TOKEN=ghp_your_token_here
- Add the server:
claude mcp add github -- npx -y @modelcontextprotocol/server-github
- Start a Claude Code session and try these interactions:
claude
> List the open pull requests on this repository
> Review PR #42 and summarize the changes
> Create an issue titled "Refactor auth module" with a description of what needs to change
> What are the failing checks on PR #38?
Claude now has full read/write access to your GitHub repository through natural language. It can fetch PR diffs, read review comments, create issues, and even trigger GitHub Actions.
Setting Up a Database MCP
Connecting Claude to your database unlocks powerful capabilities for schema analysis, query debugging, and migration planning:
# Set your connection string
export DATABASE_URL="postgresql://user:password@localhost:5432/myapp"
# Add the server
claude mcp add postgres -- npx -y @modelcontextprotocol/server-postgres \
--connection-string "$DATABASE_URL"
Now you can ask Claude questions about your live data:
claude
> Show me the schema for the users and orders tables
> Write a query to find users who placed more than 5 orders in the last month
> What indexes exist on the orders table? Are there any missing ones for common queries?
Be cautious with database MCP servers in production environments. Consider using a read-only database user or connecting to a staging replica instead of production.
OAuth Support
Some MCP servers support OAuth authentication for services that require it. When you add an OAuth-enabled server, Claude Code will guide you through the authentication flow -- typically opening a browser window for you to log in and authorize access.
This is common for servers that integrate with Google Workspace, Microsoft 365, Atlassian products, and other enterprise services that use OAuth 2.0.
Creating Custom MCP Servers
If no existing server covers your use case, you can build your own. MCP servers communicate through one of three transport protocols:
stdio -- Standard input/output. The server reads JSON-RPC messages from stdin and writes responses to stdout. This is the simplest transport and the one most CLI tools use.
SSE (Server-Sent Events) -- HTTP-based streaming. The server runs as an HTTP endpoint that streams events to the client. Good for remote servers.
HTTP -- Standard HTTP request/response. Each tool call is a separate HTTP request. The simplest to deploy but does not support streaming.
A minimal MCP server in Node.js looks like this:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer({
name: "my-custom-server",
version: "1.0.0",
});
// Register a tool
server.tool(
"get_weather",
"Get the current weather for a city",
{ city: { type: "string", description: "City name" } },
async ({ city }) => {
// Your logic here — fetch weather data, query an API, etc.
return {
content: [
{ type: "text", text: `Weather in ${city}: 72F, sunny` },
],
};
}
);
// Start the server
const transport = new StdioServerTransport();
await server.connect(transport);
Register it with Claude Code:
claude mcp add weather -- node ./my-mcp-servers/weather-server.js
Now Claude can call get_weather as naturally as any other tool.
Security Considerations
MCP servers run with your user permissions. A database MCP server can run any query your connection string allows. A filesystem server can read any directory you grant it access to. A GitHub server can create PRs and modify issues using your token.
Before installing any third-party MCP server, review its source code. Understand what permissions it needs and what actions it can take. Use the principle of least privilege: grant read-only access when possible, restrict filesystem access to specific directories, and use scoped API tokens rather than full-access ones.
For team environments, define your MCP configuration in .mcp.json and review it in code review just like any other infrastructure configuration. Document which servers are used, why they are needed, and what permissions they require.
Troubleshooting
When an MCP server is not working, start with these diagnostic steps:
# List all servers and their status
claude mcp list
# Check server logs (if the server supports logging)
claude mcp logs github
Common issues include missing environment variables (the token is not set), version conflicts (the server requires a newer Node.js version), and port conflicts (another process is using the same port for SSE/HTTP servers).
Try this exercise: set up the GitHub MCP server for one of your repositories. Start a Claude Code session and ask Claude to list your open PRs, summarize the most recent one, and suggest improvements. Then create a simple custom MCP server that exposes a single tool -- perhaps one that returns your project's deployment status or health check endpoint. Register it with Claude Code and verify Claude can invoke it.