Model-agnostic Java MCP server providing git workflow tools — branch creation, commits, commit message generation, and PR descriptions. Works on any git repo; operates on the current working directory by default.
gitpilot is a git assistant exposed as MCP tools. Claude Code (or any MCP client) can read git status, create feature branches, stage and commit changes, and generate conventional commit messages or PR descriptions — all through typed tool calls instead of shell commands.
Two tiers of tools:
| Tier | Tools | AI? | How |
|---|---|---|---|
| 1 — pure git | gitStatus, gitCreateFeatureBranch, gitCommit, gitShowStagedChanges |
No | JGit (pure Java) |
| 2 — AI-assisted | gitGenerateCommitMessage, gitGeneratePrDescription |
Yes | Spring AI ChatClient — config-driven, model-agnostic |
- Model-agnostic. No LLM provider hardcoded. AI tools use Spring AI's
ChatClient. Swap Anthropic → OpenAI → Ollama inapplication.yml. - Git-first. Tier 1 tools are pure JGit — no AI, no API keys needed. The server is useful even without an LLM provider configured.
- MCP-native. Tools are
@Tool-annotated beans over stdio. The LLM discovers and calls them; no shell commands, no prompt injection. - Safe by default. All destructive operations (commit, branch create) are explicit tools with required params. No silent force-pushes, no history rewriting. The LLM must name what it's doing.
- Java 21 + Spring Boot 3.4
- Spring AI 1.0.4 (
spring-ai-mcp-server-spring-boot-starter) - JGit 7.0 (
org.eclipse.jgit) — pure Java git, no CLI dependency - Gradle wrapper:
gradlew(generated by IntelliJ orgradle wrapper)
# No env vars required for tier 1 (pure git) tools.
./gradlew bootRun
# For tier 2 (AI-assisted), add provider key:
$env:ANTHROPIC_API_KEY = "sk-ant-..."
./gradlew bootRun<type>: <short description>
<body — optional, for non-obvious changes>
Related: docs/<nn>-<Topic>.md
Obsidian: gitpilot/<note>.md
Types: feat, fix, docs, chore, refactor.
- Code. Make the change. One concern per commit.
- Docs. Update the relevant
docs/file in the SAME commit.- Architecture change →
docs/01-Architecture.md - New tool →
docs/03-MCP-Tool-Registry.md+docs/README.md - Config/env change →
README.mdsetup section
- Architecture change →
- Obsidian. Mirror key changes to
C:\Users\kartik\Documents\Obsidian Vault\gitpilot\within the same session. At minimum, updateproject-status.md. - Verify.
./gradlew compileJavamust pass. - Commit. Conventional commit. No amend, no
--no-verifyon main. - Merge. Direct to
mainfor solo work. Short-livedfeat/*branches for experiments, merged and deleted.
main— always green.feat/<name>— short-lived, delete after merge.- No
develop, norelease/.
gitpilot/
├── build.gradle
├── README.md
├── CLAUDE.md ← this file
├── docs/
│ ├── README.md ← doc index
│ ├── 01-Architecture.md ← ecosystem fit, data flow
│ ├── 02-Development.md ← workflow, conventions, tool patterns
│ ├── 03-MCP-Tool-Registry.md ← catalog of all registered tools
│ └── MCP-Creation-Guide.md ← step-by-step MCP server guide (reference)
├── src/main/java/com/gitpilot/agent/
│ ├── GitpilotApplication.java ← @SpringBootApplication
│ ├── config/
│ │ ├── GitConfig.java ← @ConfigurationProperties("git")
│ │ └── McpConfig.java ← MCP transport hooks
│ ├── repository/
│ │ └── GitRepository.java ← JGit operations (status, diff, branch, commit)
│ └── tools/
│ └── GitTools.java ← @Tool-annotated MCP methods
└── src/main/resources/
├── application.yml ← default config (env-var placeholders)
└── application-local.yml ← local secrets (gitignored)
- GitRepository: all JGit operations. Returns strings (formatted diffs, status, commit hashes). No git CLI shelling out.
- GitTools: @Tool methods that call GitRepository. Format output as Markdown for LLM readability. Handle exceptions with clear error strings.
- AI tools: inject
ChatClientvia constructor. System prompt defines the role. User prompt passes structured context (diff, commit history). Always have a fallback when the AI call fails. - Config:
git.repo-pathdefaults touser.dir. Override withGIT_REPO_PATHenv var. Secrets from env vars, never from files. - No codegen. No Lombok, no MapStruct, no annotation processors beyond Spring Boot's defaults.
Project memory lives at
C:\Users\kartik\.claude\projects\C--Users-kartik-Desktop-code-gitpilot\memory\.
Update it after significant architectural decisions.
This project is documented in Obsidian at:
C:\Users\kartik\Documents\Obsidian Vault\gitpilot\
Key notes mirror the docs/ files. Update both when something changes.