UNPKG

code-time-machine-mcp-server

Version:

Revolutionary MCP server that analyzes code evolution, predicts bugs, and provides historical insights about code patterns and development trends

213 lines (161 loc) • 7.5 kB
# šŸ•°ļø Code Time Machine MCP Server A revolutionary **Model Context Protocol (MCP) server** that analyzes code evolution, predicts bugs, and provides historical insights about code patterns and development trends. This is not your typical MCP server - it's a sophisticated code intelligence system that can see into the past and predict the future of your codebase! ## šŸš€ Quick Start **Want to see it in action right away?** ```bash node demo.js ``` This interactive demo shows you exactly what the Code Time Machine can do with sample code analysis! For detailed setup and usage instructions, see: - šŸ“– [Complete Usage Guide](USAGE_GUIDE.md) - Comprehensive documentation - šŸŽÆ [How to Use](HOW_TO_USE.md) - Step-by-step instructions - šŸŽ¬ `demo.js` - Interactive demonstration ## 🌟 Unique Features ### šŸ”® **Code Evolution Analysis** - Track how files change over time and predict future modifications - Analyze change frequency patterns and contributor behavior - Identify files at risk of becoming problematic ### šŸ› **Bug Hotspot Prediction** - Advanced pattern recognition to identify bug-prone code areas - Risk scoring based on historical data and code patterns - Actionable recommendations to prevent bugs before they happen ### šŸ“Š **Code Health Timeline** - Visualize code health metrics over time with trend analysis - Predict future health scores and identify concerning patterns - Track the impact of different development practices ### šŸ’³ **Technical Debt Evolution** - Monitor debt accumulation across code versions - Intelligent paydown strategies based on impact analysis - Early warning system for critical debt areas ### šŸ” **Code Pattern Mining** - Discover recurring good practices and anti-patterns - Learn from your team's collective coding wisdom - Identify refactoring opportunities automatically ### šŸ‘„ **Developer Impact Analysis** - Analyze how different contributors affect code quality - Track collaboration patterns and knowledge sharing - Identify training opportunities and code review focus areas ### šŸŒŖļø **Code Entropy Analysis** - Measure code disorder and predict when refactoring is needed - Calculate maintenance cost predictions - Provide entropy reduction strategies ## šŸš€ Getting Started ### šŸŽ¬ Try the Demo First ```bash # Clone the repository git clone https://github.com/abhishekrai43/code-guardian-mcp cd code-guardian-mcp # Install dependencies npm install # See the magic in action! node demo.js ``` ### Prerequisites - Node.js 18 or higher - TypeScript - Git repository for full functionality ### Installation 1. **Clone and build the server:** ```bash git clone https://github.com/abhishekrai43/code-guardian-mcp cd code-guardian-mcp npm install npm run build ``` 2. **Configure with Claude Desktop:** Add to your `claude_desktop_config.json`: ```json { "mcpServers": { "code-time-machine": { "command": "node", "args": ["path/to/code-guardian-mcp/dist/index.js"] } } } ``` 3. **Start analyzing your code!** šŸ“š **For detailed setup instructions, see [USAGE_GUIDE.md](USAGE_GUIDE.md)** ## šŸ› ļø Available Tools ### `analyze_code_evolution` Analyzes how code has evolved over time and predicts future changes. - **Input**: `file_path`, `timeframe_days` (optional) - **Output**: Evolution metrics, predictions, patterns, and recommendations ### `predict_bug_hotspots` Identifies areas of code likely to contain bugs based on historical patterns. - **Input**: `code`, `language`, `file_path` (optional) - **Output**: Bug risk analysis with actionable prevention strategies ### `code_health_timeline` Shows code health metrics over time with future predictions. - **Input**: `repository_path`, `file_pattern` (optional) - **Output**: Historical health trends and future projections ### `technical_debt_evolution` Tracks technical debt accumulation and suggests paydown strategies. - **Input**: `code`, `previous_versions` (optional) - **Output**: Debt analysis with strategic recommendations ### `code_pattern_mining` Discovers recurring patterns and anti-patterns in codebase evolution. - **Input**: `repository_path`, `pattern_type` - **Output**: Pattern discovery results with improvement suggestions ### `developer_impact_analysis` Analyzes how different developers contribute to code quality over time. - **Input**: `repository_path`, `author_filter` (optional) - **Output**: Developer impact metrics and collaboration insights ### `code_entropy_analysis` Measures code entropy and predicts when refactoring is needed. - **Input**: `code`, `language` - **Output**: Entropy metrics with refactoring urgency assessment ## šŸ’” Example Usage **šŸŽÆ See [HOW_TO_USE.md](HOW_TO_USE.md) for comprehensive examples and real-world scenarios!** ### Analyze a file's evolution: ``` "Analyze the evolution of src/main.ts over the last 6 months" ``` ### Predict bug hotspots: ``` "Check this JavaScript code for potential bug hotspots and security issues" ``` ### Get code health timeline: ``` "Show me the code health timeline for my repository over the past year" ``` ## šŸ“– Documentation - šŸ“‹ [Usage Guide](USAGE_GUIDE.md) - Complete documentation with examples - šŸŽÆ [How to Use](HOW_TO_USE.md) - Step-by-step instructions - šŸŽ¬ `demo.js` - Interactive demonstration - šŸ“ [Publication Guide](PUBLICATION.md) - How to share and promote - šŸ”§ [VS Code Extension Plan](VSCODE_EXTENSION_PLAN.md) - IDE integration roadmap ## šŸ”§ Technical Architecture The Code Time Machine MCP Server is built with: - **TypeScript** for type safety and modern JavaScript features - **Simple Git** for repository analysis and history tracking - **Fast Levenshtein** for code similarity detection - **Advanced Pattern Recognition** for bug prediction - **Statistical Analysis** for trend prediction and health scoring ## šŸŽÆ What Makes This Unique Unlike other MCP servers that focus on simple tasks, the Code Time Machine provides: 1. **Predictive Analytics**: Not just current state analysis, but future predictions 2. **Historical Intelligence**: Deep understanding of code evolution patterns 3. **Multi-dimensional Analysis**: Combines multiple metrics for comprehensive insights 4. **Actionable Recommendations**: Specific, practical advice for code improvement 5. **Developer-centric Insights**: Understanding human factors in code quality ## 🚦 Project Status - āœ… Core MCP server framework implemented - āœ… All 7 unique analysis tools defined - āœ… TypeScript compilation successful - āœ… Advanced pattern recognition system - āœ… Git integration for historical analysis - āœ… Comprehensive error handling - āœ… Ready for production use ## šŸ”® Future Enhancements - Machine learning integration for improved predictions - Real-time code quality monitoring - Integration with popular IDEs and CI/CD systems - Advanced visualization dashboards - Team collaboration analytics ## šŸ¤ Contributing This Code Time Machine MCP Server represents a new frontier in code intelligence. Contributions are welcome to make it even more powerful! ## šŸ“„ License MIT License - See LICENSE file for details --- **"See the past, understand the present, predict the future of your code."** šŸ•°ļøāœØ