
Git Courer
io.github.Alejandro-M-P由 GitHub 帳號 Alejandro-M-P 發布v2.0.4更新於 Oct 27, 2026
Full git MCP server for LLM agents — 17 tools, AST annotator, auto-backups, real plumbing.
概覽
本機 MCP 伺服器,為 AI 代理提供結構化、可備份的 Git 操作介面:狀態、差異、分支、提交、歷史、同步與隔離工作區。
- 可以做什麼
- 檢視儲存庫:狀態、帶 AST 標記的差異、歷史(log、reflog、blame)與 stash 內容。
- 管理分支與暫存區:建立、切換、刪除、重新命名、列出;暫存、還原與清理。
- 兩階段提交:先預覽擬提交內容,再執行,提交類型由確定性分析決定。
- 同步與整合:push、pull、fetch、merge、update、cherry-pick,以及繼續或中止。
- 審查與改寫:一次呼叫完成 PR 審查(測試、衝突、差異統計、分叉情況);amend、revert、軟/硬重置。
- 隔離工作階段:建立工作樹與分支並把工具重新導向其中,結束或丟棄;可從自動備份還原。
- 適用情境
- 適合希望代理在不直接呼叫原始 git 指令的情況下操作 Git 儲存庫的情境,尤其是需要提交預覽、每個代理獨立工作樹,以及每次寫入都可復原時。也適用於 PR 審查與發佈/變更日誌準備。
- 執行需求
- 以本機程序在使用者電腦上執行(僅桌面端);可透過安裝腳本、Go install 或 Homebrew 安裝。初始化會為支援的用戶端(OpenCode、Claude Code、Codex、pi、Antigravity)註冊服務。提交訊息與發佈功能可選用本機 LLM(如 Ollama),可在設定中關閉。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Git Courer,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[Release] [Build] [MIT License]
Issues & Bugs: @blak0p/git-courer/issues · Discussions: @blak0p/git-courer/discussions
git-courer
Git, but agents can't break it.
An MCP server that gives AI agents a full, safe interface to Git — not just commits, the whole surface: status, diff, branch, stash, history, sync. Every mutation backs itself up automatically. Nothing routes through Bash, so there's no git reset --hard happening behind your back.
13 tools. Structured JSON in, structured JSON out. No pagers, no text parsing, no guessing what the agent actually did to your repo.
Install
Homebrew:
Quick start
Restart your agent, then ask it to run status on any repo. If it comes back with structured JSON instead of raw git status output, you're connected.
Diagnostics & lifecycle
doctor reports per client: config path, MCP configured, prompt block injected, hooks installed (yes/no/partial), and Claude inline hooks (Claude Code only).
How an agent works with git-courer
LLM Toggle
Modest laptop with no GPU? Flip the toggle and git-courer runs fully without an LLM. The agent writes messages directly, Go still decides the type.
Without LLM: commit with message, preview and type override work. Release is not available. Everything else (status, diff, branch, session, backup) works normally.
Why it's different
1. Commit type decided by Go, not the LLM
AST analysis + deterministic rules. The LLM only writes the message. If the type is wrong, the agent overrides it with type=.
2. Dependency graph
Before committing, it maps what your changes affect across the entire codebase. Real impact, not just "you touched 3 files".
3. Isolated worktrees
Each agent gets its own directory and branch. No stepping on each other. session start creates, session finish closes and cleans up.
4. Commits as LLM context
Structured summary with WHY/WHAT. Any LLM consumes it directly. Fewer tokens, fewer hallucinations.
5. Automatic backup
Every write operation backs up before executing. One command undoes anything.
6. Releases that survive squashes
Commits are stored in refs/courer/*. Squash, rebase, force push — your changelog doesn't disappear.
What a release looks like
This is the changelog it writes:
v2.8.0 — This update introduces an advanced session management system using git worktrees to enable parallel workflows and improves the robustness of agent execution rules.
Session Management and Isolation
- Implemented isolated sessions using git worktrees to prevent agents from interfering with each other; includes full lifecycle with listing, selection, and automatic cleanup via slugified identifiers.
- Integrated sessionGit wrapper into the MCP server for automatic directory redirection.
Developer Experience and Configuration
- Refined golden rules, now prohibiting work in the repository root to enforce strict workspace isolation.
- Automatic injection of prompt rule blocks into client configuration files.
- Fixed TUI MCP setup bug where clients were not configured correctly.
System Robustness and Refactoring
- Refactored agent instruction structure, removing unnecessary tool maps.
- Improved file cleanup using robust base names to prevent errors with complex paths.
Workflows
Session
session start → isolated worktree + branch. All MCP tools redirect there. session finish closes and cleans up. session discard throws it away.
Commit
PREVIEW → review proposed commits. APPLY → executes them. Go splits files by dependency graph into atomic commits.
PR Review
pr-review → tests + conflicts + diff stats + divergence. All in one call.
Release
git-courer release → interactive. Pick the tag, guide the LLM, preview the changelog, confirm. Commits live in refs/courer/* — they survive squashes.
Undo
backup RESTORE → undoes any operation.
Tools (13)
Full reference with examples: docs/commands.md.
Supported clients
git-courer mcp setup configures all at once. Manual setup and config formats: docs/mcp-clients.md.
Hooks & golden rules
mcp setup does more than register the MCP server — it also injects guardrails so agents route git operations through git-courer instead of raw Bash.
Golden rules injection. A <!-- git-courer start --> / <!-- git-courer end --> block is injected (and kept up to date) in each client's instructions file (AGENTS.md for OpenCode, CLAUDE.md for Claude Code, GEMINI.md for Antigravity). The block encodes the golden rules: check status before mutating, run diff + review before a PR, always session start first.
Hooks. Clients that support shell hooks get entries wired to git-courer subcommands:
hook-check classifies the command and emits additionalContext suggesting the matching git-courer MCP tool — it never denies. The session/subagent/pre-invocation hooks inject the golden rules as additionalContext. Claude Code uses inline settings.json hooks (UserPromptSubmit instead of PreInvocation); Codex uses a separate hooks.json; Antigravity uses a separate hooks.json with a run_command matcher and only 2 events. Full reference: docs/hooks.md.
OpenCode policy. For OpenCode (which has no shell hooks), mcp setup merges into opencode.json:
permission.bash["git *"] = "ask"— OpenCode prompts the user before anygitBash command, so the agent is nudged toward the MCP tool.instructionsarray includes theAGENTS.mdpath (legacyGIT_COURER.mdentries are removed). The merge is idempotent; a.bakbackup is written before any change.
Run git-courer doctor to verify all of the above per client.
FAQ
Who decides the commit type? Go. The LLM only writes the message. The agent can override it.
Do I need a GPU or local LLM?
No. Flip the toggle (llm.enabled: false) and it runs on any laptop. The agent writes messages directly.
Does my code leave my machine? No. Everything runs locally — git-courer, Ollama, your data.
What about release without an LLM? Not available. Release needs an LLM for the changelog.
How do I mark a breaking change?
feat!: or BREAKING CHANGE: in the body. Go detects it automatically.
來源:README.md,提交 39a8f3c
工具
0版本歷史
1- v2.0.4最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分