MMI Architecture Analyzer
An MCP server for evaluating C# project architecture quality using the Modularity Maturity Index (MMI) framework. It provides tools for detecting layering violations, circular dependencies, and encapsulation issues with interactive D3.js visualizations.
README
MMI Architecture Analyzer
Model Context Protocol (MCP) server for analyzing C# project architecture quality using the MMI (Modularity Maturity Index) framework by Carola Lilienthal.
Overview
This MCP server provides automated analysis of .NET/C# projects to assess architecture quality across four critical dimensions from Carola Lilienthal's MMI framework:
- Dimension 2: Layering - Validates Clean Architecture layer dependencies
- Dimension 5: Encapsulation - Analyzes public vs internal type visibility
- Dimension 8: Abstraction Levels - Detects mixing of business logic with technical details
- Dimension 9: Circular Dependencies - Identifies dependency cycles using Tarjan's algorithm
Features
Token-Optimized Reports: Compact mode reduces token usage by 66%
Interactive Heatmap: D3.js visualization with cycle detection
Incremental Analysis: File-hash caching for 70% faster monitoring
Live Monitoring: Real-time analysis with trend tracking
Cycle Detection: Graph-based circular dependency analysis with visual highlighting
Installation
Prerequisites
- Node.js 18 or higher
- Cursor IDE
Setup
- Clone this repository:
git clone https://github.com/lady-logic/mmi-analyzer.git
cd mmi-analyzer
- Install dependencies:
npm install
- Configure in Cursor:
Add to your Cursor MCP settings (~/.cursor/config.json or via Settings β MCP):
{
"mcpServers": {
"mmi-analyzer": {
"command": "node",
"args": ["C:/path/to/mmi-analyzer/src/server.js"]
}
}
}
Note: Use absolute paths. On Windows, use forward slashes.
- Restart Cursor
Usage
The MMI Analyzer provides seven tools accessible via Cursor's AI assistant:
1. Complete MMI Analysis
analyze_mmi(projectPath: "D:/Projects/MyApp")
analyze_mmi(projectPath: "D:/Projects/MyApp", mode: "detailed") // Full report
Runs all four dimension analyses and provides an overall architecture quality score.
2. Interactive Architecture Heatmap
visualize_architecture(projectPath: "D:/Projects/MyApp")
Generates D3.js visualization showing:
- Files as nodes colored by quality score (green=excellent, red=critical)
- Dependencies as links (gray=normal, red=violations, pink=cycles)
- Animated pulsing for circular dependencies
- Interactive filtering by layer or cycles
- Click nodes to see detailed issues
3. Circular Dependency Analysis
analyze_cycles(projectPath: "D:/Projects/MyApp")
analyze_cycles(projectPath: "D:/Projects/MyApp", mode: "detailed")
Detects circular dependencies across the entire project:
- Uses graphlib's Tarjan algorithm for cycle detection
- Analyzes ALL C# dependencies (using statements)
- Severity classification:
- π΄ CRITICAL: Domain layer involved in cycle
- π HIGH: 2-way circular dependency
- π‘ MEDIUM: 3-4 files in cycle
- π΅ LOW: 5+ files in cycle
- Shows complete cycle paths
4. Live Monitoring
start_monitoring(projectPath: "D:/Projects/MyApp")
get_monitoring_status()
stop_monitoring(projectPath: "D:/Projects/MyApp")
Watches .cs files and automatically analyzes changes with trend visualization.
5. Layering Analysis
analyze_layering(projectPath: "D:/Projects/MyApp")
Detects Clean Architecture violations (e.g., Domain depending on Infrastructure).
6. Encapsulation Analysis
analyze_encapsulation(projectPath: "D:/Projects/MyApp")
Identifies over-exposed types that should be internal.
7. Abstraction Level Analysis
analyze_abstraction(projectPath: "D:/Projects/MyApp")
Finds mixing of business logic with technical details (SQL, HTTP, File I/O).
Report Modes
Compact Mode (Default)
- Token-optimized output (~66% reduction)
- Grouped violations
- Concise recommendations
- Perfect for quick checks and monitoring
Detailed Mode
- Full violation listings
- Code examples
- Comprehensive tables
- Ideal for documentation and deep analysis
Example Output
# Complete MMI Analysis Report
Overall MMI Score: 4.2/5 (Gut)
## MMI Scorecard
| Dimension | Score | Level | Status |
|------------------------|-------|------------|--------|
| Layering | 5/5 | Exzellent | β
|
| Encapsulation | 4/5 | Gut | β
|
| Abstraction Levels | 3/5 | Akzeptabel | π‘ |
| Circular Dependencies | 5/5 | Exzellent | β
|
## π― Priority Actions
1. **Fix abstraction mixing** - Remove SQL queries from Domain layer
Heatmap Visualization
The interactive heatmap provides real-time visual feedback:
Color Coding:
- π’ Green: Excellent (4.5-5.0)
- π΅ Blue: Good (3.5-4.5)
- π Orange: Acceptable (2.5-3.5)
- π΄ Red: Critical (<2.5)
- π£ Pink: Circular dependency
Interactive Features:
- Drag nodes to rearrange
- Zoom and pan
- Filter by layer or cycles
- Click nodes for detailed issues
- Animated pink pulsing links show cycles
Architecture
mmi-analyzer/
βββ src/
β βββ server.js # MCP server implementation
β βββ config/
β β βββ report-config.js # Report mode configuration
β βββ analyzers/
β β βββ layering.js # Dimension 2: Layer dependencies
β β βββ encapsulation.js # Dimension 5: Type visibility
β β βββ abstraction.js # Dimension 8: Abstraction mixing
β β βββ cycle-analyzer.js # Dimension 9: Circular dependencies
β βββ formatters/ # Report formatters (compact/detailed)
β β βββ cycle-formatter.js # Cycle-specific formatting
β β βββ combined-formatter.js # 4D MMI reports
β βββ monitoring/ # File watching & history
β βββ visualizations/ # Heatmap generator with cycle viz
β βββ utils/
β βββ file-cache.js # Hash-based caching
βββ package.json
βββ README.md
Scoring System
MMI Scores (0-5):
- 5 - Exzellent: State-of-the-art architecture
- 4 - Gut: Strong architecture, minor improvements needed
- 3 - Akzeptabel: Solid foundation, some refactoring recommended
- 2 - VerbesserungswΓΌrdig: Significant technical debt
- 1 - Schlecht: Major refactoring required
- 0 - Kritisch: Architecture fundamentally broken
Cycle Scoring:
- 0 cycles = 5 points
- <1% files in cycles = 4 points
- <3% files in cycles = 3 points
- <5% files in cycles = 2 points
- <10% files in cycles = 1 point
- β₯10% files in cycles = 0 points
Performance
- Compact reports: ~2,400 tokens (vs. 7,000 detailed)
- Monitoring: Only analyzes changed files (70% reduction)
- Caching: MD5 hash-based file tracking
- Cycle detection: O(V + E) using Tarjan's SCC algorithm
- First analysis: Full scan, subsequent: incremental
Breaking Cycles
When circular dependencies are detected, the tool suggests resolution strategies:
- Dependency Inversion - Introduce interfaces
- Event-Driven Architecture - Use message bus (e.g., MassTransit)
- Extract Common Dependencies - Create shared module
- Merge Components - Combine artificially separated code
- Anti-Corruption Layer - Add translation layer
Troubleshooting
Server not connecting
- Check absolute paths in Cursor config
- Verify Node.js version:
node --version(needs 18+) - Check logs:
mmi-analyzer.login server directory
No analysis results
- Ensure the project path contains
.csfiles - Verify project follows folder structure (
Domain/,Application/,Infrastructure/)
Cache issues
- Delete
.mmi-cache.jsonin project root to force full re-analysis
Cycles not detected
- Ensure files have proper
namespacedeclarations - Check that
usingstatements reference project namespaces - Multiple files can share the same namespace (supported)
Contributing
Contributions welcome! This is an experimental tool for learning MCP server development.
License
MIT
References
- MMI Framework: Carola Lilienthal - Langlebige Softwarearchitekturen
- MCP Protocol: Anthropic Model Context Protocol
- Clean Architecture: Robert C. Martin
- Cycle Detection: Tarjan's Strongly Connected Components algorithm
Status: Experimental | Version: 0.4.0
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.