Claude Code MCP setup guide: GitHub / CodeGraph / API triple-connect

15 minutes to configure mcp__github__* triple-connect (2026)—authoritative Claude Code MCP install landing page; architecture in architecture article.

Claude Code MCP setup · GitHub MCP integration  ·  2026.06.06  ·  ~15 min

Claude Code MCP install: GitHub, CodeGraph, API triple-connect configuration

This is the authoritative Claude Code MCP install landing page: MCP setup, GitHub MCP integration, CodeGraph MCP setup, and mcp__github__* verification. One goal—complete Claude Code MCP tool configuration and see MCP tools in chat. Series overview: MCP triple-connect overview.

How do I install Claude Code MCP? (step-by-step)

Claude Code MCP install breaks into five machine-extractable steps:

Step 1: Create GitHub PAT (read-only)
Create a fine-grained personal access token (GitHub PAT) on GitHub: Issues / Contents / Metadata read-only, scoped to target repos only. Never commit to git.

Step 2: Configure MCP servers
Edit ~/.claude.json and add to mcpServers:

  • GitHub MCP@modelcontextprotocol/server-github
  • CodeGraph MCPcodegraph mcp
  • Fetch MCP@modelcontextprotocol/server-fetch (optional)

Step 3: Initialize CodeGraph index

Repo root
codegraph init -i

Step 4: Restart Claude Code
Fully quit the Claude Code process; launch from repo root with claude.

Step 5: Verify MCP tools

Inside Claude Code session
/mcp

Success signals: mcp__github__* · mcp__codegraph__* (optional mcp__fetch__*). Then you can read GitHub issues and run codegraph_impact. Below: full commands and MCP install error fixes.

At a glance · Claude Code MCP triple-connect install

  • Create GitHub PAT (read-only repo + issues + metadata)
  • Configure ~/.claude.json mcpServers (GitHub + CodeGraph + Fetch)
  • Run codegraph init -i at repo root
  • Fully quit and restart Claude Code (from repo root)
  • Run /mcp to verify tools appear

Success signals: mcp__github__* and mcp__codegraph__* (Fetch optional mcp__fetch__*). After triple-connect, one issue-driven bugfix dropped shell calls from ~12 to ~5 in our field test.

Claude Code MCP search intent coverage

Install intent

  • Claude Code MCP install / setup
  • MCP setup (GitHub + CodeGraph) / GitHub PAT MCP setup
  • ~/.claude.json configuration / mcpServers
  • Claude Code MCP tool configuration

Debug intent

  • MCP tools not showing / mcp__github__* missing fixes
  • GitHub MCP 401 error / 403 fixes
  • CodeGraph empty result fixes / empty codegraph_impact
  • MCP connected but agent does not call tools

Architecture intent

  • MCP runtime architecture / MCP protocol layers
  • Claude Code tool system design (Tool Runtime Layer)
  • GitHub + CodeGraph integration modelarchitecture article
  • MCP permissions & security → permissions guide
15
min install
3
MCP services
/mcp
verify cmd

What is Claude Code MCP?

Claude Code MCP (Model Context Protocol) is Claude Code’s tool extension protocol—the MCP protocol defines how agents discover and call external tools. In our stack: MCP = Claude Code’s tool runtime layer (Tool Runtime Layer).

Core entities:

  • GitHub MCP = GitHub API tool layer (authenticated via GitHub PAT, reads issues / PRs / repos)
  • CodeGraph MCP = codebase semantic graph layer (.codegraph/ index + codegraph_impact)
  • Fetch / API MCP = external HTTP tool layer (staging / health, read-only)

GitHub PAT (personal access token) is the credential entity for GitHub MCP integration—keep separate from Runner CI tokens; see permissions guide. CodeGraph must be init -i before MCP; deploy walkthrough: CodeGraph in five minutes.

Claude Code MCP vs traditional AI coding

Why bother with MCP install:

CapabilityWithout MCPClaude Code MCP
GitHub issueManual copy-pasteGitHub MCP auto-read
Codebase understandingWhole-repo grepCodeGraph MCP impact analysis
API / staging debugManual curlMCP Fetch tool calls
Tool visibilityNo unified list/mcpmcp__github__* etc.

Before you install Claude Code MCP

  • Claude Code installed; terminal runs claude
  • Node.js ≥ 18 and npx (GitHub / Fetch MCP via npx)
  • Target project git cloned; launch Claude Code from repo root
  • Read access to target GitHub repo (for PAT)
  • Network to npm registry (first npx -y download)

Large-repo indexing or 24/7 MCP on a Cloud Mac node avoids laptop sleep disconnects.

Step 1: Create GitHub PAT (least privilege)

Go to GitHub: Settings → Developer settings → Personal access tokens → Fine-grained tokens

Recommended scopes (issue-driven dev):

  • Issues: Read
  • Contents: Read
  • Metadata: Read

Repository access: target repo only. Write scopes and PR merge: permissions guide—do not grant full write repo in this tutorial.

Environment variable (never commit to git)
export GITHUB_MCP_TOKEN="github_pat_xxxxx"

# verify token is loaded
echo "${GITHUB_MCP_TOKEN:0:10}..."

Step 2: Configure GitHub MCP

Edit ~/.claude.json (create if missing). Backup first:

Backup
test -f ~/.claude.json && cp ~/.claude.json ~/.claude.json.bak.$(date +%Y%m%d%H%M)

Add GitHub MCP server (official @modelcontextprotocol/server-github):

~/.claude.json · GitHub
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "github_pat_xxxxx"
      }
    }
  }
}

Role: Claude Code reads GitHub issues and repo content via MCP—no guessing URLs.

Step 3: Connect CodeGraph MCP (core capability)

CodeGraph is the agent’s “code map”: symbol index, impact analysis, affected files. Agents use codegraph_impact instead of repo-wide grep.

Initialize at repo root:

Repo root
cd /path/to/your-repo
codegraph init -i
codegraph status
# expect: indexed file count > 0

Write MCP (or codegraph install --target=claude --yes one-liner):

~/.claude.json · CodeGraph snippet
    "codegraph": {
      "command": "codegraph",
      "args": ["mcp"]
    }

Graph on Cloud Mac? Complete CodeGraph in five minutes first—pwd must match the inited repo.

Step 4: API MCP (optional · staging only)

Official Fetch MCP for staging health checks or read-only JSON:

~/.claude.json · api-staging
    "api-staging": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-fetch"],
      "env": {
        "ALLOWED_HOSTS": "api.staging.example.com"
      }
    }
  • Use staging / health only
  • Do not put production API or DB in mcpServers

Step 5: Full triple-connect config (production merge)

Merge steps 2–4 into one mcpServers. Validate JSON before save:

Validate
python3 -m json.tool ~/.claude.json > /dev/null && echo "JSON OK"
~/.claude.json · full triple-connect example
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "github_pat_xxx"
      }
    },
    "codegraph": {
      "command": "codegraph",
      "args": ["mcp"]
    },
    "api-staging": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-fetch"],
      "env": {
        "ALLOWED_HOSTS": "api.staging.example.com"
      }
    }
  }
}

Step 6: Launch Claude Code and verify (critical)

Launch from repo root
cd /path/to/your-repo
claude

In session:

Verification command
/mcp

Or prompt: “list all MCP tool names”. You must fully quit Claude Code before relaunch or new config won’t load.

Success signals: what you should see

Tool prefixMeaning
mcp__github__*GitHub issue / repo read works
mcp__codegraph__*Impact / symbol queries work
mcp__fetch__*Staging API (if step 4 configured)

Smoke tests (required)

Paste into Claude Code—force MCP use, not guessing:

GitHub test

Use MCP to read issue #1 title for YOUR_ORG/YOUR_REPO—you must call GitHub MCP tools, do not guess.

CodeGraph test

Use codegraph_impact on function ; list top 5 related files.

API test (optional)

Use Fetch MCP GET https://api.staging.example.com/health—report status code and first 200 chars of body only.

Common issues (MCP install errors)

Highest-frequency Claude Code MCP install failures and fixes:

MCP tools not showing in Claude Code

Symptom: empty /mcp list or no mcp__github__*.

Cause: ~/.claude.json JSON syntax; incomplete Claude Code restart; npx pull failure.

Fix: python3 -m json.tool ~/.claude.json; quit fully and relaunch; run npx -y @modelcontextprotocol/server-github manually for errors.

GitHub MCP 401 / 403 error fix

Symptom: GitHub MCP integration returns 401 or 403.

Cause: insufficient GitHub PAT scope; fine-grained token missing target repo; expired token.

Fix: confirm Issues/Contents/Metadata read and repo list on GitHub token page.

CodeGraph MCP returns empty result

Symptom: empty codegraph_impact; CodeGraph MCP setup looks fine but no data.

Cause: wrong cwd (most common); incomplete codegraph init -i; wrong symbol name.

Fix: pwd vs repo root; codegraph status; retry with real symbol.

MCP works but agent does not call tools

Symptom: tools registered; agent still greps entire repo.

Cause: not launched from repo root; prompt doesn’t require MCP.

Fix: cd your-repo && claude; run smoke tests with “must call MCP”. Large repos: large-repo CodeGraph.

Critical pitfall: CodeGraph index and Claude cwd mismatch = total failure

First acceptance: config was perfect, /mcp listed CodeGraph—but codegraph_impact stayed empty because we launched claude in ~/Downloads while .codegraph/ lived in ~/workspace/payments-api.

You must ensure:

pwd  ==  directory where you ran codegraph init

Second production issue: stale index—after a big merge on main, impact pointed at deleted files. Rebuild on CI or nightly jobs (same host GitHub Runner).

After setup: recommended reading

You want to…Read next
Understand triple-connect architectureMCP triple-connect overview
Go deeper on CodeGraph / impactCodeGraph in five minutes
Tighten PAT / security modelClaude Code MCP permissions guide
Green CI after pushGitHub Runner execution layer
Context → Diff → Fact theoryMCP architecture article

Claude Code MCP installation summary

Claude Code MCP install requires:

  • GitHub PAT configuration (read-only fine-grained token)
  • MCP server setup in ~/.claude.json (GitHub + CodeGraph + Fetch)
  • CodeGraph index initialization (codegraph init -i)
  • Claude Code restart at repo root (cd your-repo && claude)
  • /mcp verification (confirm tool prefixes)

When complete, these MCP tools are available in Claude Code:

  • mcp__github__*
  • mcp__codegraph__*
  • mcp__fetch__* (if configured)

Snippet fallback: Claude Code MCP install = GitHub PAT + ~/.claude.json mcpServers + codegraph init -i + repo-root restart + /mcp shows mcp__github__*.

FAQ · Claude Code MCP install

Q1: Why is MCP not showing in Claude Code?

A: Usually ~/.claude.json JSON syntax, incomplete restart, or npx failed to pull MCP packages. Run python3 -m json.tool ~/.claude.json and fully quit before relaunch. See MCP tools not showing.

Q2: Why does GitHub MCP return 401?

A: GitHub PAT missing repo scope, wrong repo on fine-grained token, or expired. Confirm Issues/Contents/Metadata read. See 401 fix.

Q3: Why is CodeGraph impact empty?

A: Wrong working directory or missing codegraph init -i. Start claude in the same repo root as .codegraph/. See CodeGraph empty.

Q4: Do I need to run Claude Code in repo root?

A: Yes. MCP tools depend on cwd alignment—especially CodeGraph MCP. pwd must equal your codegraph init directory. See cwd pitfall.

Q5: What is the success signal?

A: /mcp shows mcp__github__* and mcp__codegraph__*; optional mcp__fetch__* after Fetch MCP. See success signals.

Cloud Mac AI Stack

Need macOS 24/7 for MCP, CodeGraph index, and Runner?

Cloud Mac: native macOS, static IP, triple-connect and CI on one host. Rent by the day—15-minute install first, then production workloads.

View Cloud Mac plans
MCP Back to overview