An intelligent MCP (Model Context Protocol) server that automatically generates and updates documentation based on code changes, designed to work directly with Cursor.
- AI-Powered Documentation: Uses Gemini to generate clear, accurate documentation
- Code Analysis: CodeRabbit structures and analyzes code changes
- Code Execution: Daytona executes code snippets in secure sandboxes
- Quality Evaluation: Galileo.ai evaluates documentation accuracy and tone
- Self-Correction: Automatic improvement loop when quality thresholds aren't met
- Git Integration: Automatic commits and version control
- MCP Integration: Works directly in Cursor via Model Context Protocol
pip install -r requirements.txtCreate a .env file with your API keys (optional - system works with fallbacks):
# Gemini Configuration (recommended)
GEMINI_API_KEY=your_gemini_api_key
# Daytona Configuration
DAYTONA_API_KEY=your_daytona_api_key
DAYTONA_API_URL=https://app.daytona.io/api
# Galileo Configuration
GALILEO_API_KEY=your_galileo_api_key
GALILEO_PROJECT_ID=your_project_id
# CodeRabbit Configuration
CODERABBIT_API_KEY=your_coderabbit_api_key
# Git Configuration
GIT_REPO_PATH=.
GIT_BRANCH=main
# Quality Thresholds
MIN_DOC_QUALITY_SCORE=0.7
MAX_SELF_CORRECTION_ATTEMPTS=3Run the configuration helper:
python update_mcp_config.pyOr manually edit %USERPROFILE%\.cursor\mcp.json (Windows) or ~/.cursor/mcp.json (macOS/Linux):
{
"mcpServers": {
"live-document-editor": {
"command": "python",
"args": ["C:\\path\\to\\HackSprint\\mcp_server.py"],
"env": {}
}
}
}After updating the configuration, restart Cursor completely to load the MCP server.
Once connected, you can use these MCP tools directly in Cursor:
-
process_code_changes- Process Git code changes and generate documentationUse the process_code_changes tool to generate documentation for my recent code changes -
get_git_diff- Get Git diff for the current repositoryUse the get_git_diff tool to show me the current Git diff -
update_documentation- Update or create a documentation fileUse the update_documentation tool to update README.md with [content] -
commit_documentation- Commit documentation changes to GitUse the commit_documentation tool to commit the documentation -
get_recent_commits- Get recent Git commitsUse the get_recent_commits tool to show me the last 5 commits
Git Repository → MCP Server (mcp_server.py)
↓
├─ CodeRabbit: Structure code changes
├─ Gemini: Generate documentation
├─ Daytona: Execute code snippets
├─ Galileo: Evaluate documentation quality
└─ Self-Correction Loop: Improve until quality threshold met
↓
Final Output → Git Repository (Commit to main)
.
├── mcp_server.py # Main MCP server entry point (for Cursor)
├── src/
│ ├── orchestrator.py # MCP orchestrator with Gemini
│ ├── git_handler.py # Git integration
│ ├── config.py # Configuration management
│ └── mcp_servers/
│ ├── coderabbit.py # CodeRabbit server
│ ├── daytona_server.py # Daytona server
│ └── galileo_server.py # Galileo server
├── requirements.txt # Dependencies
└── MCP_SETUP.md # Detailed MCP setup guide
- Coordinates all MCP servers
- Uses Gemini for intelligent decision-making
- Manages self-correction loops
- Structures code changes from Git diffs
- Analyzes code complexity
- Categorizes modifications
- Executes code snippets in secure sandboxes
- Reports execution success/failure
- Handles code validation
- Evaluates documentation quality
- Assesses accuracy, tone, and clarity
- Provides feedback for improvement
- Monitors repository changes
- Commits documentation updates
- Manages version control
- Code Changes Detected: Git diff triggers the system
- Structure Analysis: CodeRabbit analyzes and structures the changes
- Documentation Generation: Gemini generates initial documentation
- Code Execution: Daytona executes code snippets to validate examples
- Quality Evaluation: Galileo evaluates documentation quality
- Self-Correction: If quality is low, the system self-corrects using Gemini
- Final Output: High-quality documentation is committed to Git
The system includes fallback mechanisms:
- If Gemini is unavailable, basic documentation is generated
- CodeRabbit uses local parsing (no API required)
- Galileo uses local evaluation algorithms
- Daytona is optional for code execution
However, for best results, configure all API keys.
- Check the path: Ensure the path in
mcp.jsonis correct - Check Python path: Make sure
pythonis in your PATH - Check dependencies: Ensure all dependencies are installed:
pip install -r requirements.txt
- Check logs: Look for errors in Cursor's Developer Console (
Ctrl+Shift+I)
- Ensure the directory is a Git repository (
git init) - Check file permissions
- Verify Git is installed and in PATH
- MCP_SETUP.md - Detailed MCP setup and usage guide
- ARCHITECTURE.md - System architecture details
- SYSTEM_DESIGN.md - Workflow diagrams and design
MIT License