Claude Code MCP GitHub Sentry PostgreSQL developer tools

Claude Code MCP Servers: GitHub, Sentry, and PostgreSQL Setup Guide (2026)

The Prompt Shelf ·

The premise of MCP is simple: instead of pasting a GitHub issue into chat, you tell Claude to go read it. Instead of exporting a database query and uploading the CSV, Claude runs the query directly. Once you’ve seen Claude triage a Sentry alert, trace it through your codebase, and propose a fix — all without you copying anything — the copy-paste workflow feels like a step backward.

This guide sets up the three MCP servers that deliver the most immediate value for most development teams: GitHub, Sentry, and PostgreSQL. Each section covers the exact setup commands, authentication configuration, environment-variable-safe team sharing, and the real queries you’ll use daily.


How MCP Servers Work in Claude Code

MCP (Model Context Protocol) servers connect Claude Code to external systems. Claude Code ships with an MCP client that speaks HTTP, SSE, stdio, and WebSocket transports. You configure servers once; Claude uses their tools whenever a task requires it.

Transport Types

TransportWhen to useAuthentication
httpRemote cloud services (GitHub, Sentry, Notion)OAuth or Bearer token via headers
stdioLocal servers, custom scriptsEnvironment variables
sseDeprecated; use http instead-
wsEvent-push serversBearer token in headers

The Tool Search Optimization

By default, MCP tool schemas are not loaded at session start. Claude Code loads only tool names and server instructions. When Claude needs a specific tool, it runs a ToolSearch to find and load the schema. This keeps your context window available for actual work even with 20+ servers configured.

To disable deferral for a server whose tools you need on every turn:

{
  "mcpServers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "alwaysLoad": true
    }
  }
}

GitHub MCP Server

What Claude Can Do with GitHub Connected

  • Read any issue or PR by number without you pasting the content
  • Review PRs with inline comments, checking against your CLAUDE.md standards
  • Create branches, open PRs, and add labels programmatically
  • List open PRs assigned to you or filtered by label
  • Analyze commit history for a file or author
  • Cross-reference issues with PRs and commits

Setup

Generate a fine-grained Personal Access Token at github.com/settings/personal-access-tokens. Select the repositories you want Claude to access, then grant:

  • Contents: Read and write (to read and edit files)
  • Issues: Read and write (to read issues and add comments)
  • Pull requests: Read and write (to review PRs and create them)
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer YOUR_GITHUB_PAT"

Verify the connection:

/mcp

You should see github in the list with a tool count next to it.

Sharing with Your Team Without Exposing the Token

Project-scoped MCP servers in .mcp.json can be committed to version control — but never commit literal tokens. Use environment variable expansion:

{
  "mcpServers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${GITHUB_PAT}"
      }
    }
  }
}

Each developer sets GITHUB_PAT in their local environment (shell profile, .envrc, or equivalent). Claude Code expands ${GITHUB_PAT} at connection time and never writes the resolved value anywhere.

Add this to your repo README:

## Claude Code Setup

Set `GITHUB_PAT` in your environment (fine-grained PAT with Contents/Issues/PRs read/write):

```bash
export GITHUB_PAT=github_pat_...

Claude Code will automatically use the GitHub MCP server for PR reviews and issue tracking.


When a team member opens Claude Code for the first time in this project, they'll see an approval dialog for the `.mcp.json` entries. This gives each developer explicit control over which project-scoped servers they trust.

### Daily GitHub Workflows

```text
Review PR #456 against our CLAUDE.md coding standards and leave inline comments
What are the most recent issues labeled "bug" that don't have a PR yet?
Implement the feature described in issue #234 and open a PR
Which files changed in the last 5 commits and who changed them?
Find all PRs from the last week that modified src/auth/

Restricting GitHub MCP Permissions

To allow read operations but block Claude from creating or modifying content:

{
  "permissions": {
    "allow": ["mcp__github__get_*", "mcp__github__list_*", "mcp__github__search_*"],
    "deny": ["mcp__github__create_*", "mcp__github__update_*", "mcp__github__delete_*"]
  }
}

Sentry MCP Server

What Claude Can Do with Sentry Connected

  • Query error occurrences by timeframe, project, and environment
  • Read full stack traces with source context and breadcrumbs
  • Correlate errors to recent deployments and releases
  • Identify which commit introduced a new error type
  • Draft fixes by combining Sentry context with your local codebase

Setup

Sentry’s MCP server uses OAuth:

claude mcp add --transport http sentry https://mcp.sentry.dev/mcp

Authenticate:

/mcp

Find sentry in the list and follow the browser OAuth flow. Your credentials are stored securely and refreshed automatically.

Common Sentry Workflows

What are the most common errors in the production environment in the last 24 hours?
Show me the full stack trace for Sentry issue SEN-4521, including breadcrumbs
Which deployment introduced the "TypeError: Cannot read properties of undefined" errors that started yesterday?
Find all unresolved errors in the checkout service from the last 7 days and group them by type

Correlating Sentry Errors with Your Codebase

The power of MCP is combining multiple contexts. When Claude has both Sentry connected and access to your local files:

Sentry shows TypeError in auth.handleCallback() starting at 14:30 UTC.
Read the stack trace from issue SEN-7823, then find the relevant code in src/auth/,
and propose a fix.

Claude reads the Sentry error, finds the relevant source files, traces the error through your actual code, and proposes a fix — without you doing any of the copy-paste.


PostgreSQL MCP Server

What Claude Can Do with PostgreSQL Connected

  • Query your database in natural language
  • Inspect schema: tables, columns, indexes, foreign keys
  • Run aggregations and analytics without writing SQL manually
  • Cross-reference database state with code changes
  • Debug data issues by examining actual records

Setup

The @bytebase/dbhub server supports PostgreSQL with a connection string:

claude mcp add --transport stdio db -- npx -y @bytebase/dbhub \
  --dsn "postgresql://username:password@hostname:5432/database_name"

For a read-only analytics user:

claude mcp add --transport stdio analytics-db -- npx -y @bytebase/dbhub \
  --dsn "postgresql://readonly_user:[email protected]:5432/analytics"

Security note: Use a read-only database user for analytics queries. If Claude needs to write, create a separate connection with write permissions and add it as a second server.

Secure Connection Strings via Environment Variables

{
  "mcpServers": {
    "db": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@bytebase/dbhub", "--dsn", "${DATABASE_URL}"]
    }
  }
}

Set DATABASE_URL in your environment. Never commit the connection string with credentials.

Database Workflows

What's our total revenue this month versus last month?
Show me the schema for the orders table including all foreign keys and indexes
Find customers who signed up in the last 30 days but haven't made a purchase
Which products have inventory below 10 units?
How many API requests did we serve in the last hour, broken down by endpoint?

Restricting Database MCP Permissions

Allow reads but block any write operations:

{
  "permissions": {
    "deny": [
      "mcp__db__execute_write_query",
      "mcp__db__run_migration",
      "mcp__db__delete_*"
    ]
  }
}

For exact tool names, run /mcp and inspect the tools listed for your database server.


Managing Multiple MCP Servers

Viewing Server Status

/mcp

Shows all configured servers, their connection status, and tool count. Servers that are connecting in the background appear as pending.

Server Commands

# List all configured servers
claude mcp list

# Get details for a specific server
claude mcp get github

# Remove a server
claude mcp remove github

Scope Selection

When adding a server, choose the right scope:

# Local scope (default) — only you, current project
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer $PAT"

# Project scope — committed to .mcp.json, team-shared
claude mcp add --transport http github --scope project https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer ${GITHUB_PAT}"

# User scope — all your projects, private to you
claude mcp add --transport http github --scope user https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer $PAT"

Importing from Claude.ai

If you’ve configured MCP servers in Claude.ai connectors, they’re automatically available when you’re logged in with a Claude.ai subscription:

/mcp

Claude.ai connectors appear with a marker in the list. They don’t load when ANTHROPIC_API_KEY or cloud provider credentials are active — only with Claude.ai authentication.


Authentication Patterns

Static Bearer Token (GitHub-style)

{
  "mcpServers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${GITHUB_PAT}"
      }
    }
  }
}

OAuth (Sentry, Notion, etc.)

Just add the server and run /mcp to initiate the browser OAuth flow. Claude Code stores the token securely and refreshes it automatically.

headersHelper for Short-Lived Tokens

When tokens expire frequently (AWS SigV4, short-lived JWTs, Kerberos), use headersHelper:

{
  "mcpServers": {
    "internal-api": {
      "type": "http",
      "url": "https://mcp.internal.company.com",
      "headersHelper": "/opt/scripts/get-mcp-token.sh"
    }
  }
}

The script receives CLAUDE_CODE_MCP_SERVER_NAME and CLAUDE_CODE_MCP_SERVER_URL and must write a JSON object to stdout:

#!/bin/bash
# get-mcp-token.sh

TOKEN=$(aws secretsmanager get-secret-value \
  --secret-id mcp-api-token \
  --query SecretString \
  --output text)

echo "{\"Authorization\": \"Bearer $TOKEN\"}"

The helper runs fresh on each connection — at session start and on reconnect. It has a 10-second timeout.

Restricting OAuth Scopes

To grant only specific OAuth scopes (useful when an MCP server advertises more than you need):

{
  "mcpServers": {
    "slack": {
      "type": "http",
      "url": "https://mcp.slack.com/mcp",
      "oauth": {
        "scopes": "channels:read chat:write search:read"
      }
    }
  }
}

oauth.scopes overrides what the server requests, locking Claude Code to a security-team-approved subset.


Handling Large MCP Outputs

Some MCP tools return large results — database query outputs, full PR diffs, Sentry event details. Claude Code warns when output exceeds 10,000 tokens and has a default maximum of 25,000 tokens.

Increase the limit when working with large datasets:

MAX_MCP_OUTPUT_TOKENS=50000 claude

Or set it persistently in settings:

{
  "env": {
    "MAX_MCP_OUTPUT_TOKENS": "50000"
  }
}

If you’re building a custom MCP server and a specific tool legitimately needs to return large outputs:

{
  "name": "get_full_schema",
  "description": "Returns the complete database schema",
  "_meta": {
    "anthropic/maxResultSizeChars": 200000
  }
}

Automatic Reconnection

HTTP and SSE servers reconnect automatically on disconnection, with exponential backoff: up to five attempts, starting at 1 second and doubling each time. After five failures, the server is marked as failed and you can retry manually from /mcp.

Stdio servers (local processes) are not automatically reconnected.


The Anthropic MCP Directory

The Anthropic Directory lists reviewed MCP servers. Any remote server in the directory can be added with claude mcp add. New servers appear regularly — check the directory before building a custom integration for a popular service.

# Example: adding a directory-listed server
claude mcp add --transport http notion https://mcp.notion.com/mcp

Some directory servers require OAuth authentication. Run /mcp after adding to initiate the flow.


Production MCP Configuration Example

A .mcp.json for a typical web application team:

{
  "mcpServers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${GITHUB_PAT}"
      }
    },
    "sentry": {
      "type": "http",
      "url": "https://mcp.sentry.dev/mcp"
    },
    "analytics-db": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@bytebase/dbhub", "--dsn", "${ANALYTICS_DB_URL}"]
    }
  }
}

With corresponding environment variables in each developer’s shell:

  • GITHUB_PAT: Fine-grained PAT for this repository
  • ANALYTICS_DB_URL: Read-only PostgreSQL connection string

Sentry uses OAuth — each developer authenticates once via the browser flow.


Related Articles

Explore the collection

Browse all AI coding rules — CLAUDE.md, .cursorrules, AGENTS.md, and more.

Browse Rules