I was tired of watching LLM agents fail at basic Git operations. Standard integrations pass raw text, hang on pagers, or scream because they can't parse unstructured git diff outputs.
git-courer is a full Model Context Protocol (MCP) server written in Go that treats Git properly. No bash spawning, no unstructured text to parse. Everything communicates via structured JSON.
Here is an actual commit message it generated completely locally:
fix: fix mcp server connection handling
WHY
The previous implementation lacked proper error handling for connection
failures in the MCP server, leading to unhandled panics or silent
failures when the local LLM backend was unreachable.
WHAT
* Added connection timeout logic to the local client calls.
* Implemented retry mechanisms with exponential backoff for transient
backend errors.
The Architecture & Tool Pack
Read Tools (status, diff, history, blame): Completely structured JSON and fully paginated. A single status call replaces over 5 standard Git commands for the agent.
Write Tools (commit, merge, rebase, branch, stash, stage, sync...): Every single mutation auto-creates a backup before executing. If the LLM messes up, a RESTORE command brings you back exactly where you were.
Safety Model: Destructive operations (hard resets, force pushes, branch deletions) require an explicit confirmed=true gate. The agent is forced to ask you first. dry_run=true is also available for peace of mind.
The Semantic Annotator (Why it's different)
Instead of just feeding raw code to the LLM, git-courer uses go-enry + go-tree-sitter to parse the AST and tag every hunk semantically before the LLM even sees it.
It detects tags like NEW_FUNC, MOD_SIG, MOD_BODY, DELETED, and BREAKING_CHANGE. The commit type (feat, fix, refactor) is determined deterministically from these AST tags rather than guessed by the model.
The Commit Pipeline
Atomic Commits: One staged area = one commit. It actively prevents the agent from creating giant, messy multi-feature commits.
In-Memory Previews: The PREVIEW tool uses write-tree to snapshot the staging area into a job_id. The working tree is never touched during the preview stage. APPLY then uses commit-tree + update-ref to seal the deal cleanly.
Client & Backend Support
13 Clients Configured Automatically: Runs out of the box with git-courer mcp setup for Claude Code, Cursor, Windsurf, OpenCode, Cline, Roo Code, VS Code, Zed, Claude Desktop, Continue, and more.
100% Local-First: Works with any backend exposing an OpenAI-compatible /v1 API (Ollama, LM Studio, llama.cpp).
The project is fully open source. I’d love to hear your thoughts on the architecture, the plumbing pipeline, or any features you'd like to see added!
Repo: github.com/Alejandro-M-P/git-courer
[link] [comments]