home / mcp / dependency mcp server

Dependency MCP Server

A Model Context Protocol (MCP) server for analyzing code dependencies

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "mkearl-dependency-mcp": {
      "command": "node",
      "args": [
        "path/to/dependency-mcp/dist/index.js"
      ],
      "env": {
        "CACHE_DIR": "path/to/dependency-mcp/.dependency-cache",
        "CACHE_TTL": "3600000",
        "MAX_LINES_TO_READ": "1000"
      }
    }
  }
}

DependencyMCP Server analyzes codebases to generate dependency graphs and architectural insights across multiple languages, helping you understand code structure, dependencies, and architectural patterns at a glance.

How to use

You interact with DependencyMCP Server through an MCP client to run analysis tasks, generate graphs, inspect file metadata, and evaluate architectural score against rules. Use the available tools to explore a project’s dependencies, export formats, and architectural compliance.

How to install

Prerequisites: ensure you have Node.js and npm installed on your system.

# 1) Clone the repository
git clone <repository-url>

# 2) Change into the project directory
cd dependency-mcp

# 3) Install dependencies
npm install

# 4) Build the project
npm run build

Additional setup and run

Configure and start the MCP server as a local process. You can customize environment variables to control file reading, caching, and TTL for the dependency cache.

# Optional: set environment variables for the running server
export MAX_LINES_TO_READ=1000
export CACHE_DIR=path/to/dependency-mcp/.dependency-cache
export CACHE_TTL=3600000

# Start the local DependencyMCP server (stdio config)
node path/to/dependency-mcp/dist/index.js

Configuration guidance

You can register the DependencyMCP server in your MCP settings to enable clients to communicate with it. The following configuration shows the stdio command and environment values used to run the server.

{
  "mcpServers": {
    "DependencyMCP": {
      "command": "node",
      "args": ["path/to/dependency-mcp/dist/index.js"],
      "env": {
        "MAX_LINES_TO_READ": "1000",
        "CACHE_DIR": "path/to/dependency-mcp/.dependency-cache",
        "CACHE_TTL": "3600000"
      }
    }
  }
}

Available tools

analyze_dependencies

Analyzes dependencies in a codebase and generates a dependency graph.

get_dependency_graph

Retrieves the dependency graph for a codebase in JSON or DOT format.

get_file_metadata

Fetches detailed metadata about a specific file, including imports and exports.

get_architectural_score

Scores the codebase against defined architectural rules and patterns.