Part 3 of 7
🤖 Ghostwritten by Claude Opus 4.5 · Curated by Tom Hundley
This article was written by Claude Opus 4.5 and curated for publication by Tom Hundley.
The Model Context Protocol (MCP) transforms Claude Code from a coding assistant into a connected automation platform. With MCP servers, Claude can manage GitHub pull requests, query databases, automate browsers, send Slack messages, and interact with virtually any external system.
Think of MCP as a universal adapter layer. Each MCP server exposes tools that Claude can call just like its built-in capabilities—but instead of reading local files, it's creating PRs, running SQL queries, or triggering CI pipelines.
MCP servers run as separate processes that Claude Code communicates with. When you add an MCP server, its tools become available in your Claude session. The server handles the actual API calls, authentication, and data transformation.
The naming convention for MCP tools follows this pattern:
mcp__<server-name>__<tool-name>For example, mcp__github__create_pull_request or mcp__slack__post_message.
Claude Code supports three transport methods for MCP servers:
claude mcp add --transport http github https://mcp.github.com/apiHTTP servers are ideal for hosted services and team-shared infrastructure.
claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-githubStdio servers run as local processes, perfect for development and tools that need filesystem access.
claude mcp add --transport sse legacy-server https://example.com/sseServer-Sent Events transport is deprecated—avoid for new integrations.
MCP servers can be configured at three levels:
| Scope | File | Use Case | Shared |
|---|---|---|---|
| Local | ~/.claude.json |
Personal, experimental | No |
| Project | .mcp.json |
Team-shared via git | Yes |
| User | ~/.claude.json |
Cross-project utilities | No |
Local > Project > User
If the same server is configured at multiple levels, the local configuration wins.
The recommended approach for teams is checking .mcp.json into your repository:
{
"mcpServers": {
"github": {
"type": "stdio",
"command": "npx",
"args": ["@modelcontextprotocol/server-github"]
},
"postgres": {
"type": "stdio",
"command": "npx",
"args": ["@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}
}Note the ${DATABASE_URL} syntax—environment variables are expanded at runtime. This keeps secrets out of your repository while allowing team-shared configuration.
MCP configurations support full environment variable expansion:
{
"mcpServers": {
"api": {
"type": "http",
"url": "${API_BASE_URL:-https://api.example.com}/mcp",
"headers": {
"Authorization": "Bearer ${API_KEY}"
}
}
}
}The ${VAR:-default} syntax provides fallback values.
The most commonly used MCP server, enabling full GitHub workflow automation:
claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-githubCapabilities:
Example interaction:
"Create a PR from my current branch to main with a summary of the changes"
Claude reads your git diff, generates a description, and creates the PR—all through the MCP server.
Browser automation for testing and web interaction:
claude mcp add --transport stdio playwright -- npx @anthropic-ai/mcp-server-playwrightCapabilities:
Example interaction:
"Go to our staging site, log in, and verify the dashboard loads correctly"
Database access for querying and schema management:
claude mcp add --transport stdio postgres -- npx @modelcontextprotocol/server-postgresCapabilities:
Example interaction:
"Show me the users who signed up this week and their subscription status"
Extended file operations beyond Claude's built-in tools:
claude mcp add --transport stdio filesystem -- npx @modelcontextprotocol/server-filesystemCapabilities:
Team communication integration:
claude mcp add --transport stdio slack -- npx @anthropic-ai/mcp-server-slackCapabilities:
claude mcp listShows all configured MCP servers and their status.
claude mcp get githubDisplays configuration and available tools for a specific server.
claude mcp remove githubFor servers requiring OAuth:
/mcpThis opens the MCP authentication flow within Claude Code.
/mcp statusShows connection status for all servers.
MCP tools require permission like built-in tools. Configure them in your settings:
{
"permissions": {
"allow": ["mcp__github__*"]
}
}{
"permissions": {
"allow": [
"mcp__github__search_repositories",
"mcp__github__get_issue"
],
"ask": [
"mcp__github__create_pull_request"
],
"deny": [
"mcp__github__delete_repository"
]
}
}For internal APIs or custom integrations, you can build your own MCP server. The protocol is straightforward:
import { Server } from "@modelcontextprotocol/sdk/server";
const server = new Server({
name: "my-custom-server",
version: "1.0.0"
});
server.setRequestHandler("tools/list", async () => ({
tools: [
{
name: "my_tool",
description: "Does something useful",
inputSchema: {
type: "object",
properties: {
param: { type: "string", description: "Input parameter" }
},
required: ["param"]
}
}
]
}));
server.setRequestHandler("tools/call", async (request) => {
if (request.params.name === "my_tool") {
const result = await doSomethingUseful(request.params.arguments.param);
return { content: [{ type: "text", text: result }] };
}
});
server.connect(process.stdin, process.stdout);claude mcp add --transport stdio my-server -- node /path/to/server.jsMCP responses have default limits to prevent context bloat:
For servers that return large amounts of data, configure higher limits:
export MAX_MCP_OUTPUT_TOKENS=50000Or in your MCP config:
{
"mcpServers": {
"data-server": {
"type": "stdio",
"command": "node",
"args": ["server.js"],
"outputLimits": {
"maxTokens": 50000
}
}
}
}Each developer has personal servers in ~/.claude.json:
{
"mcpServers": {
"local-db": {
"type": "stdio",
"command": "npx",
"args": ["@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgresql://localhost/dev"
}
}
}
}Common servers in .mcp.json (checked into git):
{
"mcpServers": {
"github": {
"type": "stdio",
"command": "npx",
"args": ["@modelcontextprotocol/server-github"]
}
}
}For organizations requiring strict control, use managed MCP configuration:
{
"allowedMcpServers": [
{ "serverName": "github" },
{ "serverName": "jira" }
],
"deniedMcpServers": [
{ "serverName": "*" }
]
}This allowlist pattern ensures only approved servers can be used.
npx @modelcontextprotocol/server-githublsof -iclaude --verboseUse /mcp to re-authenticate. For OAuth servers, tokens may expire and need renewal.
MCP servers add latency. For frequently-used operations:
MCP servers extend what Claude can do. In Part 4, we'll explore how to divide work across multiple specialized agents—subagents that work in parallel with isolated context.
Up next: Part 4: Multi-Agent Workflows & Subagents — Learn to orchestrate specialized AI agents that work in parallel on complex tasks.
Discover more content: