Skip to main content

gh-pr-mcp

PyPI Python CI License: AGPL-3.0 uv MCP

A minimal MCP (Model Context Protocol) server exposing a focused set of GitHub PR and review helpers that the gh CLI doesn't cover well: structured PR review threads, GraphQL thread resolve/unresolve, inline-comment review submission, and per-comment edit/delete via the REST API.

Published to PyPI as gh-pr-mcp. The console script and MCP server are both named gh-pr-mcp.

Philosophy

git and gh are already great at what they do. Wrapping them tool-by-tool just bloats the agent's tool list and gets in the way. The tools that earn a spot here are the ones that:

  1. Reduce token spend by composing verbose gh JSON output into a tight summary (e.g. pr_view, pr_list, run_view, run_job_view, pr_checks), or
  2. Use the GitHub API directly for operations the gh CLI can't do in a single call (review-thread resolve/unresolve via GraphQL, replying to a specific review comment, editing/deleting review comments, posting a review with inline comments at specific lines).

Everything else — git status, git diff, gh pr create, gh issue list, etc. — is faster, simpler, and more flexible to call via the shell directly.

Tools

Tool What it does Why it's here
gh_pr_view PR details, body, reviews, comments, checks rollup, review decision + pending reviewers Token-reducing summary
gh_pr_list Open/closed PRs with mergeable state Token-reducing summary
gh_pr_checks CI check status Token-reducing summary
gh_pr_files Changed-files diffstat (status, +adds/-dels, renames), no patch blobs Token-reducing summary for un-checked-out PRs
gh_run_view Workflow run status + job list Token-reducing summary
gh_run_job_view Per-job details and (large) step logs Helps when CI logs are massive
gh_pr_review_threads Inline review comments grouped into threads, filterable by bot/human/active/outdated/resolved/unresolved REST + GraphQL combined; gh cannot do this
gh_pr_resolve_thread Mark a review thread resolved GraphQL mutation only
gh_pr_unresolve_thread Mark a review thread unresolved GraphQL mutation only
gh_pr_reply_comment Reply to a specific inline review comment by id REST; no gh equivalent
gh_pr_edit_comment Edit an existing review comment REST; no gh equivalent
gh_pr_delete_comment Delete a review comment REST; no gh equivalent
gh_pr_add_review Submit a review with inline comments at specific lines REST; gh pr review only supports top-level body

Recommended permission setup: allow everything in this server, and (separately) deny Bash(gh api …) so the model is funnelled through these helpers rather than rolling its own API calls.

GitHub Enterprise

Every tool picks the API host from the checkout's git remotes (gh's own remote order: upstream, github, origin), so enterprise repos work with no configuration as long as gh auth login --hostname <host> has been done. GH_HOST overrides the detection. The repo argument also accepts the three-part host/owner/name form when you need to target a different host than the checkout you're standing in.

Development

uv sync
uv run pytest          # tests
uv run pyrefly check   # type check
uv run gh-pr-mcp       # run the server over stdio

MCP configuration

Project-scoped (worktree under active development)

.mcp.json in your project root points at the worktree:

{
  "mcpServers": {
    "gh-pr-mcp-dev": {
      "command": "uvx",
      "args": ["--from", "/path/to/gh-pr-mcp-dev", "gh-pr-mcp"]
    }
  }
}

Global config (stable)

From PyPI:

{
  "mcpServers": {
    "gh-pr-mcp": {
      "command": "uvx",
      "args": ["gh-pr-mcp"]
    }
  }
}

Or straight from the repo without PyPI:

{
  "mcpServers": {
    "gh-pr-mcp": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/gordon-to/gh-pr-mcp", "gh-pr-mcp"]
    }
  }
}

gh must be installed and authenticated (gh auth login) — the tools shell out to it.

Architecture

src/gh_mcp/
├── server.py        # FastMCP app + tool registration
├── app.py           # mcp + @tool decorator
├── run.py           # subprocess helpers + input validation
└── tools/gh/
    ├── _api.py                # gh api GET/POST/PATCH/DELETE + GraphQL helpers
    ├── pr_view.py             # pr_view, pr_checks, pr_files, pr_review_threads
    ├── pr_list.py             # pr_list
    ├── pr_review.py           # pr_add_review, pr_reply_comment
    ├── pr_resolve_thread.py   # pr_resolve_thread, pr_unresolve_thread
    ├── pr_edit_comment.py
    ├── pr_delete_comment.py
    └── run_view.py            # run_view, run_job_view

License

AGPL-3.0-only. If you run a modified version as a network service, the AGPL requires you to offer that modified source to its users.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gh_pr_mcp-0.1.2.tar.gz (64.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gh_pr_mcp-0.1.2-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file gh_pr_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: gh_pr_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 64.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for gh_pr_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0425738a9979583f4c5b9ee221e3e02e1868184b9d1baa0d584a202e2bbecfc8
MD5 ce6ddf8016c92e67b267c7594d08a329
BLAKE2b-256 54d0fddbd9155c0d6a9fb575829d36b9c66e2fe57f681a96d020afed475b0e52

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_pr_mcp-0.1.2.tar.gz:

Publisher: publish.yml on gordon-to/gh-pr-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gh_pr_mcp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gh_pr_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for gh_pr_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4634908325c80191bd1a1f979ecf4a320240c05ca0869a26c235d7991779906e
MD5 b1ef8c4eca80f6a06fde7fbc671d185b
BLAKE2b-256 9a18096ce6bd846f2295bb4832ed538caaf4ca7b85cfdd63dc77c8031b8170d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for gh_pr_mcp-0.1.2-py3-none-any.whl:

Publisher: publish.yml on gordon-to/gh-pr-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page