Manage and analyze project dependencies, offering caching and flexible configuration for efficient tracking across compl...
Created byApr 23, 2025
DependencyMCP Server
A Model Context Protocol (MCP) server that analyzes codebases to generate dependency graphs and architectural insights. This server helps understand code structure, dependencies, and architectural patterns across multiple programming languages.
Features
**Multi-Language Support**: Analyzes dependencies in TypeScript, JavaScript, C#, Python, and more
**Dependency Graph Generation**: Creates detailed dependency graphs in JSON or DOT format
**Architectural Analysis**: Infers architectural layers and validates against rules
**File Metadata**: Extracts imports, exports, and other metadata from source files
**Scoring System**: Evaluates codebase against architectural rules and patterns
Installation
Clone the repository
Install dependencies:
Build the project:
Configuration
Add to your MCP settings file (usually located at ~/.config/cline/mcp_settings.json or equivalent):
Environment Variables:
MAX_LINES_TO_READ: Maximum number of lines to read from each file (default: 1000)
CACHE_DIR: Directory to store dependency cache files (default: .dependency-cache)
CACHE_TTL: Cache time-to-live in milliseconds (default: 1 hour = 3600000)
Available Tools
analyze_dependencies
Analyzes dependencies in a codebase and generates a dependency graph.
get_dependency_graph
Gets the dependency graph for a codebase in JSON or DOT format.
get_file_metadata
Gets detailed metadata about a specific file.
get_architectural_score
Scores the codebase against architectural rules and patterns.
Example Output
Dependency Graph (JSON)
Architectural Score
Development
The server is built with TypeScript and uses:
Zod for schema validation
diff for file comparison
minimatch for glob pattern matching
Project Structure
Adding Support for New Languages
To add support for a new programming language:
Add file extensions to the default `fileTypes` array
Implement language-specific regex patterns in `parseFileImports` and `parseFileExports`
Add any language-specific architectural patterns to `inferArchitecturalLayer`