DS DevShelfHub Projects · AI tools
MCP Advanced · 11 min read Page 16 of 25

MCP — Connecting Claude to Everything

By DevShelfHub

Claude Code is powerful inside your repo. The Model Context Protocol lets it reach outside — into GitHub, Sentry, your database, Google Drive, and any other system that speaks MCP — through one open standard instead of a dozen bespoke integrations.

Series progress16 / 25
MCP tutorial — connect Claude Code to GitHub, databases, and external tools via Model Context Protocol

What MCP actually is

The Model Context Protocol is an open standard for connecting AI tools to external data sources and services. Each MCP server exposes three kinds of primitives:

Tools

Functions Claude can call — query a database, open an issue, fetch an error report.

Resources

Data Claude can read — files, records, documents, dashboards.

Prompts

Slash commands that invoke pre-defined workflows the server ships with.

Both sides of the wire: Claude Code is both an MCP client (it connects to servers) and an MCP server (it can expose itself to other tools via claude --mcp-server).

Three installation types

There are three ways to attach a server, depending on where it runs and how it talks.

Option 1 — Remote HTTP server

Modern servers. HTTPS, no local process, OAuth flow in the browser.

bash
claude mcp add --transport http https://mcp.sentry.io/v1

Option 2 — Remote SSE server

Server-Sent Events. Used by some older remote servers.

bash
claude mcp add --transport sse https://mcp.example.com/sse

Option 3 — Local stdio server

A local process talking over stdin/stdout. Best for proprietary tools, local databases, and custom integrations. Declared in .mcp.json.

json
// .mcp.json
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "POSTGRES_CONNECTION_STRING": "${POSTGRES_CONNECTION_STRING}"
      }
    }
  }
}

Installation scopes

Where a server is registered decides who can see it. Pick the narrowest scope that fits.

Scope Location Use it for
Local ~/.claude/mcp.json Your personal servers, available in every project
Project .mcp.json in repo root Project-specific servers, shared with the team via git
User Separate per-user key Per-user config in managed environments

The hierarchy is local > project > user; later scopes can override earlier ones. Inside .mcp.json, use ${VARIABLE_NAME} for environment-variable expansion at runtime — never hardcode secrets into a file you commit.

Practical examples

A handful of servers covers most day-to-day workflows.

bash
# Connect to GitHub for code reviews and PR management
claude mcp add github --transport http https://api.github.com/mcp

# Connect to Sentry for error monitoring
claude mcp add sentry --transport http https://mcp.sentry.io/v1

# Connect to your PostgreSQL database
claude mcp add --local postgres -- npx @modelcontextprotocol/server-postgres

# Connect to Google Drive for documentation
claude mcp add gdrive --transport http https://mcp.google.com/drive

Once connected, you orchestrate across services in plain language:

text
> Check our Sentry dashboard for errors in the last 24 hours and create GitHub issues for the top 3.
> Query the users table and tell me if there are any orphaned records.
> Pull the API specification from Google Drive and update our implementation to match it.

OAuth authentication

Remote servers that require OAuth trigger a browser window for the consent flow on first use. For programmatic and CI use, pre-configure the credentials so no human interaction is needed.

json
{
  "mcpServers": {
    "github": {
      "transport": "http",
      "url": "https://api.github.com/mcp",
      "oauth": {
        "clientId": "${GITHUB_CLIENT_ID}",
        "clientSecret": "${GITHUB_CLIENT_SECRET}"
      }
    }
  }
}

MCP tool search — scaling to large tool sets

Every connected server adds its tool definitions to the context window. With many servers that bloat adds up fast. MCP Tool Search defers tool definitions: Claude only loads the full spec for tools it actually decides to use in a session.

json
{
  "mcp": {
    "toolSearch": {
      "enabled": true,
      "exemptServers": ["critical-server"]
    }
  }
}

For server authors: add rich semantic descriptions to your tools — search recall is only as good as the descriptions it matches against.

Claude Code as an MCP server

The protocol runs both ways. Launch Claude Code as a server and other MCP-compatible clients — orchestration systems, other AI frameworks, custom tooling — can call it. To go further, see building your own MCP servers.

bash
claude --mcp-server

Practice project

Connect at least three MCP servers relevant to your work — for example GitHub, your database, and your project-management tool. Then build a single workflow that orchestrates all three in one Claude Code session: read an issue, query the database for the affected rows, and open a PR with the fix.

MCP FAQ

What is MCP in Claude Code?

The Model Context Protocol (MCP) is an open standard for connecting AI tools to external data sources and services. Each MCP server exposes three kinds of primitives: tools (functions Claude can call, like querying a database or opening an issue), resources (data Claude can read, like files and dashboards), and prompts (slash commands that invoke pre-defined workflows).

What are the three MCP server installation types?

There are three ways to attach a server depending on where it runs and how it talks: a remote HTTP server over HTTPS with a browser OAuth flow, a remote SSE (Server-Sent Events) server used by some older remote servers, and a local stdio server that runs as a local process over stdin/stdout and is declared in .mcp.json — best for proprietary tools, local databases, and custom integrations.

What are MCP installation scopes?

Where a server is registered decides who can see it. Local scope (~/.claude/mcp.json) holds your personal servers across every project, project scope (.mcp.json in the repo root) holds servers shared with the team via git, and user scope holds per-user config in managed environments. The hierarchy is local > project > user, and later scopes can override earlier ones. Pick the narrowest scope that fits.

How does MCP tool search reduce context usage?

Every connected server adds its tool definitions to the context window, and with many servers that bloat adds up fast. MCP tool search defers tool definitions so Claude only loads the full spec for tools it actually decides to use in a session. Enable it in config and optionally exempt critical servers that should always stay loaded.

Can Claude Code act as an MCP server?

Yes — the protocol runs both ways. Claude Code is both an MCP client that connects to servers and an MCP server that can expose itself to other tools. Launch it with claude --mcp-server and other MCP-compatible clients such as orchestration systems, other AI frameworks, and custom tooling can call it.

Quick summary

  • MCP servers expose tools, resources, and prompts over one open standard
  • Install via remote HTTP, remote SSE, or local stdio depending on the server
  • Choose scope (local > project > user) and expand secrets with ${VAR}
  • OAuth handles auth; tool search keeps large tool sets out of the context window