← back to posts

Extending Claude Code with MCP Servers

The Model Context Protocol (MCP) is an open standard for letting AI agents talk to external systems through a common, typed interface. Anthropic introduced it; the ecosystem now spans hundreds of community and vendor servers covering databases, SaaS APIs, browsers, filesystems, and developer tools. Claude Code is an MCP client — it can connect to any MCP server and expose its tools to the agent.

Why MCP Matters

Without MCP, every integration is bespoke. You write a custom tool, a custom prompt, a custom format. With MCP, a server publishes its tools and resources once, and any MCP-compatible client (Claude Desktop, Claude Code, Cursor, Zed, others) can use them. Install once, use everywhere.

For Claude Code specifically, MCP servers are how you teach the agent about systems that live outside your filesystem — your ticket tracker, your design system docs, your production logs.

Installing MCP Servers

Two configuration scopes:

  • Project: .mcp.json at the repo root. Checked into git. Shared with the team.
  • User: ~/.claude/mcp.json or via claude mcp add. Personal across all projects.

A typical entry:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
      }
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres",
               "postgresql://localhost/mydb"]
    }
  }
}

After editing, restart Claude Code (or run /mcp to check status). The CLI handles process lifecycle — servers start when needed and shut down with the session.

The /mcp Slash Command

Inside the REPL, /mcp opens a panel that shows:

  • Connected servers and their status.
  • Tools each server exposes.
  • Resources (read-only data sources) each server exposes.
  • Authentication status for OAuth-based servers.

Use it to debug connection issues and to confirm Claude actually has the tools you think it does.

Useful Servers To Start With

  • @modelcontextprotocol/server-github — Issues, PRs, repo search.
  • @modelcontextprotocol/server-postgres — Schema introspection and read-only queries.
  • @modelcontextprotocol/server-filesystem — Scoped file access outside the project root.
  • @modelcontextprotocol/server-puppeteer — Browser control. Lets the agent open pages, click, scrape.
  • @modelcontextprotocol/server-slack — Channel reads and message posts.
  • Linear, Sentry, Cloudflare, Stripe — Vendor-published servers exist for most major SaaS tools.

A short browse of the official MCP servers repository on GitHub is the fastest way to find what is current.

Authentication Patterns

  • API tokens via env vars. Simplest. Your shell exports GITHUB_TOKEN, the MCP entry references ${GITHUB_TOKEN}, the server uses it.
  • OAuth. Servers that need OAuth flows (Notion, Slack, etc.) trigger a browser-based login on first use. Tokens are cached locally.
  • Scoped credentials. Always provision the minimum scope. An agent with full GitHub admin is a footgun.

Writing Your Own MCP Server

The protocol is straightforward. Anthropic publishes SDKs for TypeScript and Python that handle the JSON-RPC plumbing. A minimal server is roughly 50 lines: define your tools (name, description, JSON schema for arguments), implement handlers, expose over stdio.

A common pattern is wrapping an internal API your team already has — the result is that every developer’s Claude Code can hit your staging environment, query your service registry, or pull deployment status, all through natural language.

Trust Boundaries

MCP servers run on your machine with your permissions. A malicious server can read your filesystem, exfiltrate data, or pivot into your network. Treat installing a community MCP server like installing any package — read the source, prefer vendors you already trust, and use scoped credentials.

The Bigger Picture

MCP turns Claude Code from a coding assistant into a general-purpose work agent. Hook up your project tracker, your database, your monitoring, and your CI, and a single sentence — “what broke after the deploy at 14:00?” — fans out into queries across all of them and returns one synthesized answer. That is the promise. The protocol is the plumbing.