
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 分