
Git Mcp
io.github.selfagency由 GitHub 帳號 selfagency 發布v0.4.2更新於 Oct 24, 2026
A Git MCP server that doesn't suck
概覽
在本機執行的 Git MCP 伺服器,讓 AI 程式助理透過 18 組工具檢視、提交、分支、推送、改寫歷史並建立拉取請求。
- 可以做什麼
- 檢視儲存庫:狀態、差異、日誌、blame、reflog、設定和提交搜尋,並提供狀態、日誌、分支和差異的唯讀 MCP 資源。暫存、提交、修補、還原、重設和復原變更,硬重設和 nuke 需要確認。管理分支、遠端、fetch、pull 和 push,並處理 stash、rebase、cherry-pick、merge、bisect、標籤、工作樹和子模組。驅動 Git Flow、Git LFS 以及含備份與還原的歷史改寫。統計儲存庫分析資料,在 GitHub、GitLab、Forgejo、Gitea 和 Bitbucket 上建立、列出和合併拉取請求,並查詢 git-scm 文件與 man 手冊。
- 適用情境
- 適合希望程式助理透過結構化工具而非原始 shell 指令操作 Git 的情境,涵蓋日常提交與分支工作,以及復原、歷史改寫、工作樹、LFS 和拉取請求。最適合 Claude Desktop、VS Code Copilot 或 Cursor 等桌面助理在本機儲存庫上使用。
- 執行需求
- 以 npm 套件形式透過 stdio 在本機執行,需要 Node.js 以及 npx 或全域安裝,還需要 Git 本身。預設儲存庫透過 GIT_REPO_PATH 或 --repo-path 參數設定,否則每次呼叫都要傳 repo_path。Git Flow 需要 PATH 中有 git-flow-next CLI。拉取請求操作使用 gh、glab 或 tea CLI,或使用 GITHUB_TOKEN、GITLAB_TOKEN、FORGEJO_TOKEN、BITBUCKET_TOKEN 等權杖。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Git Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
git-mcp
A Git MCP server that doesn't suck
Exposes the full Git workflow to any MCP-compatible AI agent — inspect, write, branch, remote, stash, rebase, LFS, git-flow, documentation lookup, and more. Designed to be safe by default, composable, and fast. Powered by simple-git.
Built for coding agents in tools like GitHub Copilot, Claude Code, Cursor, and OpenAI Codex, while remaining compatible with any MCP client that can call tools and resources.
Features
- 18 tools with 80+ actions covering everyday Git workflows, advanced recovery, history rewriting, repository analytics, forge pull requests, and external VCS awareness
- Safety-first — destructive operations require explicit confirmation; force push and hook bypass are opt-in via server config
- GPG/SSH signing for commits and tags, with server-level auto-sign support
- Git LFS — track patterns, manage objects, install hooks, migrate history
- Git Flow — drives the git-flow-next CLI, so the finish state machine, conflict recovery, and worktree lifecycle stay correct as the CLI evolves. Preset init, overview, config CRUD, generalized topic actions, and classic feature/release/hotfix/support aliases
- Documentation lookup — search git-scm.com and fetch man pages directly from the LLM
- MCP Resources — URI-addressable read-only views of status, log, branches, and diff
- Bundled agent skill —
skills/git-mcp-workflow/documents MCP-first Git workflows, recovery, worktrees, releases, and advanced operations for AI agents and coding agents; installable viaskills-npmand skill.sh - External VCS awareness —
git_but_check/git_jj_checkdetect GitButler and Jujutsu and guide agents to prefer their native CLIs/MCP (withbut teardownguidance) over git-mcp tools when appropriate - History rewrite —
git_rewrite: reword, squash, rewrite-messages, and backup/restore for safe commit-history rewriting - Repository analytics —
git_analytics: contributors, churn, activity, summary, and file-stats computed from local git history - Pull requests —
git_pr: create/list/merge PRs/MRs on GitHub, GitLab, Forgejo, Gitea, and Bitbucket via provider CLI or REST API - Tangled & Entire awareness —
git_tangled_check/git_entire_checkdetect Tangled hosting and Entire session/context management - Multi-repo — pass
repo_pathper-call or configure a server-level default - Worktrees —
git_worktree: plaingit worktreeby path, or branch-addressed worktrees viagit flow worktreewith path templates and provenance-aware cleanup - Cross-platform — macOS, Linux, Windows (Git for Windows), all covered by CI
Quick Start
npx (no install)
Install globally
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
VS Code (Copilot)
Add to .vscode/mcp.json in your project:
Configuration
All configuration is via environment variables. Pass them in your MCP client config:
Tool Reference
Tools are grouped by domain. Each root tool takes an action parameter that selects the operation. Where an action is marked as default, omitting action will use it.
Context (git_context)
Status (git_status)
History (git_history)
Commits (git_commits)
Branches (git_branches)
Remotes (git_remotes)
Workspace (git_workspace)
Git Flow (git_flow)
Drives the git-flow-next CLI, which must be installed and on PATH
(brew install git-flow-next, or the releases page).
Set GIT_FLOW_BINARY to override the path. When the binary is missing, the tool returns an install
hint rather than failing opaquely.
Flags are scoped to the target verb: worktree and worktree_path apply to start and checkout,
while keep_worktree and force_worktree apply to finish and delete. A mismatch raises instead
of being silently dropped. See the tool reference for the full parameter list.
Worktree (git_worktree)
Two backends. Path-addressed actions drive plain git worktree and need nothing but git;
branch-addressed flow_* actions drive git flow worktree, which addresses worktrees by branch
name, computes paths from the gitflow.worktreePath template, and tags provenance so cleanup can
tell a git-flow-created worktree (removed) from a hand-made one (detached, uncommitted work
preserved).
See the tool reference.
LFS (git_lfs)
Documentation (git_docs)
History Rewrite (git_rewrite)
Analytics (git_analytics)
Pull Requests (git_pr)
Uses the provider CLI (gh/glab/tea) when installed locally, otherwise the REST API with a *_TOKEN env var. Provider auto-detected from the origin remote; self-hosted instances use GIT_FORGE_PROVIDER.
External VCS Awareness
Health Check (git_ping)
Returns server status. Useful for confirming the server is reachable.
MCP Resources
URI-addressable read-only snapshots (subscribe-capable):
Bundled Agent Skill
git-mcp ships a bundled agent skill at skills/git-mcp-workflow/ that teaches any skills-npm-compatible agent to use the MCP tool surface instead of running raw git CLI commands. The skill covers:
- Why LLMs must not use the Git CLI (quoting hazards, silent failures)
- Inspect-before-mutate workflow rules
- Safety order for undo and recovery operations
- Full registered tool surface with action reference
- Workflow playbooks: feature branch, rebase, recovery, worktree, backport, release tagging, Git Flow, merge
- Git concept explanations anchored to MCP tools
Installing the skill
If your agent supports skills-npm:
Or add to your project's package.json so it runs automatically:
Then add to .gitignore:
Safety
- All mutating tools have
destructiveHint: truein their MCP annotations git_commits action=reset mode=hardrequiresconfirm=truegit_commits action=nukerequiresconfirm=true- Force push (
--force) is disabled unlessGIT_ALLOW_FORCE_PUSH=true;force_with_leaseis always available - Hook bypass (
--no-verify) is disabled unlessGIT_ALLOW_NO_VERIFY=true git_flowhook and filter execution is disabled unlessGIT_ALLOW_FLOW_HOOKS=true- Paths are validated against the repository root — traversal attempts are rejected
- Credentials and tokens are never included in responses
Development
License
MIT © Daniel Sieradski
來源:README.md,提交 e96db03
工具
0版本歷史
1- v0.4.2最新Oct 14, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。