Skip to main content
Glama
mcp-github-push

mcp-github-push

by kintil555

mcp-github-push

轻量级 MCP 服务器,让 Claude(或其他 MCP 客户端)能够直接将项目推送到 GitHub,无需在电脑上执行 git clone/git pull。作为 GitHub 连接器的替代方案,更节省 token,且不会占用本地存储。

采用终端 CLI 形式——通过 npm 安装,一次性设置 token,然后注册到你的 MCP 客户端即可。

为什么这与内置的 GitHub 连接器不同?

  • 不会将仓库克隆到磁盘。 所有操作直接通过 GitHub REST/Git Data API 完成,因此不占用本地存储。

  • 一次提交包含多个文件。 使用 Git Data API(blob → tree → commit → ref),将多个文件的更改合并为一次整洁的提交,而不是每个文件都产生一次提交。

  • 推送前必须确认。 必须先调用 github_preview_push 工具来显示更改摘要;只有在用户明确同意后,才能调用 github_push_confirmed。

  • Token 本地存储,安全。 配置文件权限为 600,仅所有者用户可读。

Related MCP server: github-pr-mcp

安装

选项 A — 无需 Node.js(可直接使用的可执行文件)

完全不需要安装 Node.js。从 Releases 页面 下载适合你操作系统的二进制文件:

  • Windows: mcp-github-push-win-x64.exe

  • Linux: mcp-github-push-linux-x64

  • macOS: mcp-github-push-macos-x64

从终端运行:

# Windows (PowerShell/CMD)
mcp-github-push-win-x64.exe setup

# Linux/macOS
chmod +x mcp-github-push-linux-x64
./mcp-github-push-linux-x64 setup

然后在 MCP 客户端配置中注册 exe 文件的完整路径:

{
  "mcpServers": {
    "github-push": {
      "command": "C:\\path\\ke\\mcp-github-push-win-x64.exe",
      "args": ["start"]
    }
  }
}

选项 B — 通过 npm(需要 Node.js 18+)

npx @kintil555/mcp-github-push setup

按照说明操作:

  1. 创建 Personal Access Token(推荐使用 fine-grained)并授予目标仓库 Contents: Read and write 权限。

  2. 在提示时粘贴 token(终端输入会被隐藏)。

  3. Token 会自动验证并保存到 ~/.config/mcp-github-push/config.json。

注册到 MCP 客户端

将其添加到你的 MCP 客户端配置中(例如 Claude Desktop 的 claude_desktop_config.json):

{
  "mcpServers": {
    "github-push": {
      "command": "npx",
      "args": ["-y", "@kintil555/mcp-github-push", "start"]
    }
  }
}

重启客户端。可供 Claude 使用的工具:

工具

功能

github_whoami

检查 token 是否有效并查看权限范围

github_repo_exists

检查仓库是否存在

github_create_repo

创建新仓库

github_read_file

从仓库读取文件内容

github_preview_push

预览推送前的更改(不进行任何修改)

github_push_confirmed

实际推送——仅在用户同意后执行

其他 CLI 命令

npx @kintil555/mcp-github-push status   # cek token masih valid
npx @kintil555/mcp-github-push logout   # hapus token tersimpan

从源码构建

git clone https://github.com/kintil555/mcp-github-push.git
cd mcp-github-push
npm install
npm run build

GitHub Actions 中的 CI 会在每次推送到 main 或 PR 时自动构建并执行类型检查,并在创建新版本标签时发布到 npm。

安全性

  • Token 保存在 ~/.config/mcp-github-push/config.json,权限为 600。

  • 使用限定到特定仓库的 fine-grained PAT,而不是具有完全访问权限的 classic token。

  • 设置 token 有效期并定期轮换。

  • github_push_confirmed 的设计确保 AI 模型无法在未提供 confirmed: true 参数的情况下推送——请确保你的 MCP 客户端也在执行前向用户展示工具调用以供审查。

许可证

MIT

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables to interact with GitHub repositories directly from Claude, supporting actions like viewing repos, checking status, committing and pushing changes, and managing pull requests.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    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.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables a connected Claude account to create, update, and commit files to GitHub repositories directly through MCP tools, removing the need for manual git push operations.
    230 npm
    MIT