CodeBase Optimizer MCP Tool
A sophisticated Model Context Protocol (MCP) server that provides comprehensive codebase analysis, optimization, and duplicate detection capabilities for Claude Code.
Features
🔍 Comprehensive Analysis
Project structure and architecture detection
Cross-language code duplication detection
Microservices architecture validation
Configuration optimization analysis
Security and performance insights
🤖 AI-Powered Learning
Pattern recognition that improves with each use
Project-specific recommendations
Historical analysis tracking
Custom rule learning
🚀 Zero Setup Required
Integrates directly with Claude Code
No additional installations needed
Works with any programming language
Portable across all projects
Available Tools
Individual Analysis Functions
analyze_project_structure- Analyze project organization and architecturedetect_code_duplicates- Find duplicate code across multiple languagesvalidate_microservices_architecture- Validate microservices patternsoptimize_configurations- Analyze configuration managementgenerate_improvement_report- Generate comprehensive actionable report
Master Orchestrator Function
run_complete_project_analysis- 🎯 ONE-COMMAND COMPLETE ANALYSISRuns all analyses in optimal order
Provides prioritized action plan
Generates health score and improvement roadmap
Installation & Setup
1. Install Dependencies
2. Add to Claude Code MCP Configuration
Add this to your Claude Code MCP configuration:
3. Restart Claude Code
The tool will be automatically available in all Claude Code sessions.
Usage Examples
Quick Project Health Check
Focused Duplicate Detection
Microservices Validation
Comprehensive Report
Output Examples
Health Score Dashboard
Prioritized Recommendations
Action Plan
Supported Languages
Python (.py)
JavaScript (.js)
TypeScript (.ts)
Java (.java)
Go (.go)
Rust (.rs)
C/C++ (.c, .cpp)
PHP (.php)
Ruby (.rb)
Learning & Improvement
The tool automatically:
Learns patterns from each project analyzed
Builds knowledge database of common issues
Improves recommendations based on past successes
Adapts to your specific coding patterns
Troubleshooting
Common Issues
Tool not appearing in Claude Code:
Verify MCP configuration path is correct
Restart Claude Code after adding configuration
Check Python dependencies are installed
Analysis fails:
Ensure project path exists and is accessible
Check that Python can read the project directory
Verify no permission issues on the project folder
Performance issues:
Large projects (>10k files) may take longer to analyze
Use "quick" depth for faster analysis on huge codebases
Pattern database improves performance over time
Technical Details
Architecture
Engine: Sophisticated analysis engine with ML pattern recognition
Database: SQLite for pattern learning and improvement tracking
MCP Server: Standards-compliant Model Context Protocol implementation
Extensibility: Plugin system for custom analyzers
Data Storage
Pattern database stored in
codebase_patterns.dbNo sensitive data stored - only patterns and metrics
Database grows smarter with each project analyzed
Contributing
To extend the tool:
Add new analyzers to
codebase_optimizer_engine.pyExpose new functions in
server.pyUpdate tool schema for new parameters
Test with various project types
License
MIT License - Feel free to use and modify for your projects.
Made with ❤️ for better codebases everywhere