MCP Servers: External Connections
The Model Context Protocol (MCP) is an open standard that lets Claude Code connect to any external tool — GitHub, databases, Slack, Jira, and your own APIs. Think of it as USB-C for AI.
Claude Code acts as an MCP client. Each server exposes tools that Claude can call.
What Is MCP?
The Model Context Protocol is an open standard (created by Anthropic) for connecting AI assistants to external tools and data sources. It defines three primitives:
Tools
Functions that Claude can call. "Search repos", "create issue", "query database". The primary way Claude interacts with external systems.
Resources
Data that Claude can read. File contents, database schemas, API documentation. Provides context without taking action.
Prompts
Pre-built prompt templates the server offers. Structured ways to invoke common operations.
Popular MCP Servers
Here are the most widely used servers, with cost information and links:
Search repos, manage issues & PRs, read code, create branches, review diffs. If you only connect one MCP server, make it this one.
Tools: search_repositories, create_issue, list_pull_requests, get_file_contents, create_branch, create_pull_request, and 20+ more.
Query databases directly. Run SELECTs, inspect schemas, analyze data — without leaving the conversation. Claude can help you debug queries, find data issues, and understand your schema.
Tools: query, list_tables, describe_table, get_schema.
Send messages, search channels, read threads. Useful for posting deploy notifications, checking context from team discussions, or getting standup updates.
Tools: send_message, search_messages, list_channels, get_thread.
Monitor errors, read stack traces, check error rates. Debug production issues with full context — Claude can correlate errors with recent code changes.
Tools: list_issues, get_issue_details, search_events, get_stacktrace.
Create and manage tickets, read sprint boards, update issue status. Claude can create issues from bugs it finds, or check what's assigned to you before starting work.
Tools: create_issue, update_issue, search_issues, list_projects, get_sprint.
Adding an MCP Server
Method 1: CLI (quickest)
Method 2: Config file (.mcp.json)
.mcp.json configuration
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
},
"postgres": {
"command": "npx",
"args": [
"@modelcontextprotocol/server-postgres",
"--connection-string",
"${DATABASE_URL}"
]
},
"slack": {
"command": "npx",
"args": ["@modelcontextprotocol/server-slack"],
"env": {
"SLACK_BOT_TOKEN": "${SLACK_BOT_TOKEN}"
}
}
}
}
Place in your project root or ~/.claude/.mcp.json for global config. Environment variables are expanded at runtime.
Tool Naming Convention
MCP tools follow a consistent naming pattern so you always know which server a tool comes from:
Transports
| Transport | How It Works | Best For |
|---|---|---|
| stdio | Runs as a subprocess, communicates via stdin/stdout | Local servers, most common |
| SSE | Server-Sent Events over HTTP | Remote servers, real-time updates |
| HTTP | Standard HTTP request/response | Stateless APIs, cloud services |
Building Your Own MCP Server
If you have an internal API or custom tool, you can build an MCP server for it. Official SDKs exist for TypeScript, Python, Java, Kotlin, C#, and Go.
Minimal MCP server (Node.js)
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new Server({
name: "my-custom-server",
version: "1.0.0"
}, {
capabilities: { tools: {} }
});
// Define a tool
server.setRequestHandler("tools/list", async () => ({
tools: [{
name: "get_weather",
description: "Get current weather for a city",
inputSchema: {
type: "object",
properties: {
city: { type: "string", description: "City name" }
},
required: ["city"]
}
}]
}));
// Handle tool calls
server.setRequestHandler("tools/call", async (request) => {
if (request.params.name === "get_weather") {
const { city } = request.params.arguments;
return {
content: [{ type: "text", text: `Weather in ${city}: 72F, sunny` }]
};
}
});
const transport = new StdioServerTransport();
await server.connect(transport);
Install with npm install @modelcontextprotocol/sdk. The SDK handles all the protocol details — you just define tools and implement handlers.
Any AI assistant that supports MCP can use your servers. Build once, use everywhere. The full spec is at modelcontextprotocol.io.
What Does It Cost?
| Item | Cost | Details |
|---|---|---|
| MCP Protocol | Free | Open standard. Free to use, free to implement. |
| Official servers | Free | Open source npm packages. Free to install and run. |
| GitHub token | Free | Personal access tokens are free. Fine-grained tokens for better security. |
| Database access | Varies | Needs a running database. Your existing DB works — no extra cost if you already have one. |
| Slack bot | Free | Creating a Slack app is free. Bot token gives access to channels you configure. |
| Sentry | Free plan | Developer plan is free (5K events/mo). Paid plans for higher volume. |
| MCP SDK | Free | Open source. Build your own server for free. |