Layer 4

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 MCP Client
GitHub
PostgreSQL
Slack
Sentry
Your API

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:

GitHub
The most essential MCP integration

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.

PostgreSQL / MongoDB
Direct database access from Claude

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.

Slack
Team communication integration

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.

Sentry
Error monitoring and debugging

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.

Linear / Jira
Project management from the terminal

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)

Terminal
# Add GitHub server $ claude mcp add github -- npx @modelcontextprotocol/server-github # Add with environment variables $ claude mcp add postgres -- \ npx @modelcontextprotocol/server-postgres \ --connection-string "$DATABASE_URL" # Verify $ claude mcp list github stdio npx @modelcontextprotocol/server-github postgres stdio npx @modelcontextprotocol/server-postgres

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:

MCP Tool Names
# Pattern: mcp__<server>__<tool> mcp__github__search_repositories mcp__github__create_issue mcp__postgres__query mcp__slack__send_message mcp__sentry__list_issues

Transports

TransportHow It WorksBest For
stdioRuns as a subprocess, communicates via stdin/stdoutLocal servers, most common
SSEServer-Sent Events over HTTPRemote servers, real-time updates
HTTPStandard HTTP request/responseStateless 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.

MCP is an open standard — not locked to Claude.

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?

ItemCostDetails
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.