github-pr-mcp

github-pr-mcp

Enables GitHub repository operations (list/read files, create branches, commit files, open/list PRs) via an authless remote MCP server that keeps your GitHub token encrypted on Cloudflare, with access limited to allowed repositories.

Category
访问服务器

README

github-pr-mcp

A small, personal remote MCP server that gives an LLM client (Claude on claude.ai, in this case) scoped GitHub read/write access — list files, read files, create branches, commit files, open PRs — without ever putting your GitHub token in chat or in any client config.

The token lives as an encrypted secret on Cloudflare's side. The server is authless (no login required to call it), so the only thing standing between "anyone with the URL" and your repos is:

  1. The URL itself isn't public anywhere (don't commit it to a public repo, don't paste it into a chat that gets shared).
  2. ALLOWED_REPOS in wrangler.jsonc — every tool call checks the target repo against this allowlist and refuses anything not explicitly listed.
  3. Scope your GitHub PAT tightly (ideally a fine-grained PAT limited to just the repos you list in ALLOWED_REPOS, with only Contents + Pull requests read/write permissions).

If you want this to be more bulletproof later, Cloudflare Access / OAuth can be layered on top — see the "Going further" section at the bottom. For one person using this against their own repos, the above is a reasonable bar.

What's here

src/
  github.ts   - all the actual GitHub API logic (Octokit), repo-allowlist guard
  index.ts    - MCP tool definitions, wires tools to github.ts
wrangler.jsonc - Worker config + ALLOWED_REPOS
package.json
tsconfig.json

Tools exposed: list_repo_files, read_file, create_branch, commit_files, create_pull_request, list_open_pull_requests.

1. Create a scoped GitHub token

Go to github.com/settings/personal-access-tokens/new (fine-grained PAT, not classic):

  • Repository access: "Only select repositories" → pick the repos you want this server to touch (e.g. file-router).
  • Permissions: Repository permissions →
    • Contents: Read and write
    • Pull requests: Read and write
    • Metadata: Read-only (required, auto-selected)
  • Set an expiration you're comfortable with (90 days is reasonable; you'll rotate it via wrangler secret put when it expires, no redeploy needed).
  • Copy the token — you won't see it again.

2. Install dependencies

cd github-pr-mcp
npm install

3. Set ALLOWED_REPOS

Edit wrangler.jsonc, update the vars.ALLOWED_REPOS value to a comma-separated list of owner/repo you want this server allowed to touch:

"vars": {
  "ALLOWED_REPOS": "clemdevlin/file-router,clemdevlin/uploadkit"
}

4. Test locally first

npm run dev

In a separate terminal:

npx @modelcontextprotocol/inspector@latest

The inspector opens in your browser. For local testing it needs your token — create a .env file in the project root with:

GITHUB_TOKEN=ghp_your_token_here

wrangler dev reads .env automatically for local runs. Point the inspector at http://localhost:8787/mcp, hit Connect, then List Tools — you should see all six tools. Try list_repo_files against one of your allowlisted repos to confirm it actually talks to GitHub.

5. Set the real secret and deploy

The token never goes in wrangler.jsonc or any committed file — only as an encrypted Cloudflare secret:

npx wrangler login
npm run secret:put-token
# paste your PAT when prompted
npm run deploy

Wrangler will print your live URL, something like:

https://github-pr-mcp.<your-subdomain>.workers.dev/mcp

That /mcp URL is what you'll give to claude.ai.

6. Connect it in claude.ai

  1. Go to Settings → Connectors → Add custom connector.
  2. Paste in the Worker URL from step 5.
  3. Leave the OAuth Client ID/Secret fields blank (this server doesn't require them) and save.
  4. In any chat, enable it via the tools/"+" menu, and Claude should be able to search for and call the six tools above.

Rotating or revoking access

  • Rotate the token: generate a new fine-grained PAT, run npm run secret:put-token again with the new value. No redeploy needed.
  • Revoke everything immediately: delete the PAT on GitHub, or run npx wrangler delete to tear down the Worker entirely.
  • Change which repos are reachable: edit ALLOWED_REPOS in wrangler.jsonc, then npm run deploy.

Going further (optional)

If you ever want real per-request authentication instead of "obscure URL + repo allowlist," Cloudflare's remote-mcp-github-oauth template wraps this same pattern in a GitHub OAuth login flow, so the connector itself requires you to sign in before any tool call goes through. That needs a registered GitHub OAuth App and a KV namespace for token storage — more moving parts, not necessary unless this server's reach grows beyond "tools I personally use against my own repos."

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选