Git Auto Coach MCP Server
A lightweight Python MCP (Model Context Protocol) server that integrates with Claude Desktop to give on-demand Java code quality feedback—right from your local Git repository, with a single prompt.
🚀 Overview
With Git Auto Coach, you can:
- Analyze Java files in any local Git repo for:
- Spelling mistakes
- Checkstyle violations (Google style)
- Missing Javadoc on public types/methods
- Java naming convention issues
- Launch automatically when you start Claude Desktop
- Get results in under a second with one simple prompt
- Learn by doing—see best practices applied to your own code
🔧 Features
- MCP protocol integration using
mcp[cli] - Spell checking using
codespell - Java linting using
checkstyle - Lightweight Javadoc and naming checks via Python
- Logs all debug messages to Claude's debug window
🛠️ Prerequisites
You must have the following installed:
- Python 3.8+
- Git
- Java Runtime (for running Checkstyle)
- Claude Desktop
- Checkstyle:
- Option 1: via your OS package manager (recommended)
- Option 2: manual JAR download
- Optional:
codespellfor spell checking
📦 Installation Steps
1. Clone the Repository
git clone https://github.com/yourusername/git-auto-coach.git
cd git-auto-coach
2. Create a Virtual Environment
python -m venv .venv
# On macOS/Linux:
source .venv/bin/activate
# On Windows (PowerShell):
.\.venv\Scripts\Activate.ps1
3. Install Required Python Packages
pip install "mcp[cli]" codespell
4. Install Checkstyle
- Via Package Manager:
# macOS/Linux:
brew install checkstyle
# Windows:
winget install checkstyle
- Manual JAR Download:
-
Go to:
https://repo1.maven.org/maven2/com/puppycrawl/tools/checkstyle/ -
Download the latest
checkstyle-xx-all.jar -
Save it to:
tools/checkstyle.jar
5. Download Google Checkstyle Config
wget -O google_checks.xml https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml
⚙️ Configuration in Claude Desktop
1. Open Claude Desktop Config
Locate your claude_desktop_config.json file. On Windows, it's typically:
%APPDATA%\Claude\claude_desktop_config.json
2. Add the MCP Server Configuration
Add the following block under "mcpServers":
{
"mcpServers": {
"gitAutoCoach": {
"command": "C:\\full\\path\\to\\.venv\\Scripts\\python.exe",
"args": ["-u", "C:\\full\\path\\to\\git_auto_coach.py"]
}
}
}
Make sure:
- The Python path is from the virtual environment you used earlier
- You use double backslashes (
\\) in JSON strings on Windows
▶️ Usage
✅ To Run Inside Claude Desktop
- Start Claude Desktop
- Click the 🛠️ (MCP) icon
- Select
gitAutoCoach - Prompt:
analyze_repo D:/path/to/your/repository
✅ To Run Locally for Testing
python git_auto_coach.py D:/path/to/your/repository
🧪 Output Example
✔️ No spelling mistakes.
🔧 Checkstyle issues:
– [ERROR] Sample.java:10: 'if' construct must use '{}' [NeedBraces]
📄 Javadoc issues:
– Sample.java:4 missing Javadoc for public type
🏷️ Naming issues:
– sample.java class name should be TitleCase
🐞 Troubleshooting
- If you get timeout errors in Claude, make sure:
- No analysis phase takes longer than 4 minutes
- You’ve removed or optimized slow subprocesses (like
git grep)
- If
checkstyleorcodespellaren't found:- Ensure they're installed and available in the environment Claude uses
- Use debug logs to trace performance:
Claude → Settings → Show Developer Tools → Console
🤝 Contributing
Pull requests are welcome!
- Fork this repository
- Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes
- Push to your fork
- Open a PR
📄 License
This project is licensed under the MIT License.
