PR Viewer MCP Server
Enables PR review workflows by launching a diff visualizer against a git repo and returning 'accepted' or 'rejected' based on user decision.
README
PR Viewer MCP Server
MCP server for PR review workflows. Launches a diff visualizer against a git repo
and returns "accepted" or "rejected" when the user is done.
Setup
uv sync --group dev
Tools
| Tool | Description |
|---|---|
health_check |
Confirms the server is reachable. |
open_review |
Starts the configured visualizer and blocks until the user accepts or rejects. |
open_review parameters:
| Parameter | Default | Description |
|---|---|---|
repo_path |
— | Absolute path to a git repo. |
base_ref |
main |
The base git ref (e.g. main, origin/main). |
head_ref |
HEAD |
The head ref to diff against base (branch name, commit SHA, etc.). |
Returns "accepted" or "rejected" as a string.
Wiring in a visualizer
Create a shell script that receives the repo context via env vars and writes the
review decision to $RESULT_PATH when the user is done:
#!/usr/bin/env bash
# Env vars provided by the server:
# REPO_PATH – absolute path to the git repo
# BASE_REF – base ref (e.g. main)
# HEAD_REF – head ref (e.g. feature/add-greet)
# RESULT_PATH – path this script must write "accepted" or "rejected" to
# launch your visualizer here, then write the result
echo "accepted" > "$RESULT_PATH"
The default visualizer (scripts/launch-octorus.sh) opens octorus in a new
Terminal.app window and prompts accept/reject after the user quits.
Connecting Claude Code
Add to ~/.claude/mcp.json (global, available in every repo):
{
"mcpServers": {
"pr-viewer": {
"command": "uv",
"args": ["run", "--directory", "/path/to/pr-viewer", "pr-viewer-mcp"]
}
}
}
Or scope it to one repo by placing the same block in .mcp.json at the project root.
Because open_review blocks until you finish reviewing, Claude can act on
the result in the same turn. Useful prompts:
Open a review of feature/add-greet in /path/to/repo against main.
If it's accepted, merge it with `gh pr merge --merge`.
If it's rejected, post a comment explaining what needs to change.
Review the diff between main and HEAD in the current repo.
Summarize what changed and wait for my decision before doing anything.
Manual end-to-end test with a toy repo
1. Create the toy repo
./scripts/setup-toy-repo.sh
Creates ./toy-repo/ with a main branch and a feature/add-greet branch.
To remove it when done:
./scripts/teardown-toy-repo.sh
2. Start the MCP inspector
uv run mcp dev src/pr_viewer_mcp/server.py
Open the inspector URL printed in the terminal (default: http://localhost:5173).
3. Call open_review
In the MCP inspector, select the open_review tool and fill in:
{
"repo_path": "<absolute-path-to-project>/toy-repo",
"base_ref": "main",
"head_ref": "feature/add-greet"
}
The tool blocks — the inspector shows a spinner until the result file is written.
4. Complete the review
Either review in octorus (a Terminal.app window opens) and answer the accept/reject prompt, or write the result directly from another terminal:
# find the path in the server logs, then:
echo "accepted" > /tmp/tmp<hash>.review_result
The tool returns "accepted" or "rejected" and the inspector shows the result.
Programmatic use
For pipelines that don't use Claude, open_review is still a regular blocking MCP
tool call:
import asyncio
from mcp.client.stdio import stdio_client, StdioServerParameters
from mcp.client.session import ClientSession
async def main() -> None:
server = StdioServerParameters(
command="uv",
args=["run", "--directory", "/path/to/pr-viewer", "pr-viewer-mcp"],
)
async with stdio_client(server) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
result = await session.call_tool("open_review", {
"repo_path": "/path/to/repo",
"base_ref": "main",
"head_ref": "feature/my-branch",
})
decision = result.content[0].text # "accepted" or "rejected"
print(decision)
asyncio.run(main())
Tests
uv run pytest
The integration tests (tests/test_integration.py) run the server in-process via
mcp.shared.memory with a FakeVisualizer that writes the result immediately,
confirming that open_review returns the correct string.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。