Skip to main content
Glama
mkearl

DependencyMCP Server

by mkearl

DependencyMCP 服务器

模型上下文协议 (MCP) 服务器,用于分析代码库以生成依赖关系图和架构洞察。该服务器有助于理解跨多种编程语言的代码结构、依赖关系和架构模式。

特征

  • 多语言支持:分析 TypeScript、JavaScript、C#、Python 等语言的依赖关系

  • 依赖图生成:以 JSON 或 DOT 格式创建详细的依赖图

  • 架构分析:推断架构层并根据规则进行验证

  • 文件元数据:从源文件中提取导入、导出和其他元数据

  • 评分系统:根据架构规则和模式评估代码库

Related MCP server: mcp-codebase-oracle

安装

  1. 克隆存储库

  2. 安装依赖项:

npm install
  1. 构建项目:

npm run build

配置

添加到您的 MCP 设置文件(通常位于 ~/.config/cline/mcp_settings.json 或同等位置):

json { 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 } } }

环境变量:

  • MAX_LINES_TO_READ:从每个文件读取的最大行数(默认值:1000)

  • CACHE_DIR:存储依赖项缓存文件的目录(默认值:.dependency-cache)

  • CACHE_TTL:缓存生存时间(毫秒)(默认值:1 小时 = 3600000)

可用工具

分析依赖关系

分析代码库中的依赖关系并生成依赖关系图。

const result = await client.callTool("DependencyMCP", "analyze_dependencies", {
  path: "/path/to/project",
  excludePatterns: ["node_modules", "dist"], // optional
  maxDepth: 10, // optional
  fileTypes: [".ts", ".js", ".cs"] // optional
});

获取依赖关系图

获取 JSON 或 DOT 格式的代码库依赖关系图。

const result = await client.callTool("DependencyMCP", "get_dependency_graph", {
  path: "/path/to/project",
  format: "dot" // or "json" (default)
});

获取文件元数据

获取有关特定文件的详细元数据。

const result = await client.callTool("DependencyMCP", "get_file_metadata", {
  path: "/path/to/file.ts"
});

获取建筑分数

根据架构规则和模式对代码库进行评分。

const result = await client.callTool("DependencyMCP", "get_architectural_score", {
  path: "/path/to/project",
  rules: [
    {
      pattern: "src/domain/**/*",
      allowed: ["src/domain/**/*"],
      forbidden: ["src/infrastructure/**/*"]
    }
  ]
});

示例输出

依赖图(JSON)

{
  "src/index.ts": {
    "path": "src/index.ts",
    "imports": ["./utils", "./services/parser"],
    "exports": ["analyze", "generateGraph"],
    "namespaces": [],
    "architecturalLayer": "Infrastructure",
    "dependencies": ["src/utils.ts", "src/services/parser.ts"],
    "dependents": []
  }
}

建筑乐谱

{
  "score": 85,
  "violations": [
    "src/domain/user.ts -> src/infrastructure/database.ts violates architectural rules"
  ],
  "details": "Score starts at 100 and deducts 5 points per violation"
}

发展

该服务器使用 TypeScript 构建并使用:

  • Zod 用于模式验证

  • diff 用于文件比较

  • minimatch 用于全局模式匹配

项目结构

dependency-mcp/
├── src/
│   └── index.mts    # Main server implementation
├── package.json
├── tsconfig.json
└── README.md

添加对新语言的支持

要添加对新编程语言的支持:

  1. 将文件扩展名添加到默认的fileTypes数组

  2. parseFileImportsparseFileExports中实现特定于语言的正则表达式模式

  3. 将任何特定于语言的架构模式添加到inferArchitecturalLayer

执照

麻省理工学院

Available Tools

6 tools
check_version_existsA

Check if a specific version exists. Use for dependency validation, CI/CD checks, or ensuring version compatibility. Returns whether the version exists with package details and timestamp.

ParametersJSON Schema
NameRequiredDescriptionDefault
package_nameYesName of the package to check
versionYesVersion to check for existence
registryYesPackage registry/manager to check

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses the primary behavior: the tool returns whether the version exists along with package details and timestamp. The verb 'check' implies read-only operation, though it does not explicitly state side-effect-freeness or auth requirements, which are unlikely to be a concern for this type of lookup.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long and delivers the core purpose, and then direct use cases, and the return outcome. Every sentence contributes value without redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the tool's purpose, usage scenarios, and what the caller receives. The schema is complete with all parameters described. It does not differentiate from check_versions_exist explicitly, but the simple nature of the tool means the description is sufficiently complete for an agent to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers 100% of parameters with descriptions, so the tool description adds little extra meaning. The phrase 'specific version' aligns with package_name and version but does not enrich understanding beyond what the schema already provides. This is the baseline for full schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'Check if a specific version exists,' which clearly identifies the action (checking) and resource (version existence). The word 'specific' distinguishes it from sibling tools like check_versions_exist, and it does not confuse with get_package_info or get_latest_version.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly states 'Use for dependency validation, CI/CD checks, or ensuring version compatibility,' giving clear context for when to invoke the tool. It does not mention alternatives or exclusions, but the use cases are specific enough to guide the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

check_versions_existA

Check if specific versions exist for multiple packages. Use for bulk dependency validation, CI/CD pipeline checks, or ensuring multiple package version compatibility. Processes up to 100 packages in parallel with individual error handling.

ParametersJSON Schema
NameRequiredDescriptionDefault
packagesYesArray of package objects with name and version
registryYesPackage registry/manager to check

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description discloses important behavioral traits: parallel processing, a limit of 100 packages, and individual error handling. This adds meaningful context beyond the name and schema, though it does not mention return format or read-only confirmation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with purpose, then usage examples, then behavior. Every sentence earns its place with zero fluff or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple check tool with two well-documented parameters and no output schema, the description covers purpose, use cases, and key behavioral constraints. It is complete enough for an agent to select and invoke correctly. A minor gap is the lack of return value description, but this is not essential for a boolean-like existence check.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already describes both parameters thoroughly (100% coverage). The description adds value by explaining the batch nature ('multiple packages', 'up to 100 packages') and the parallel processing, which gives practical meaning to the 'packages' parameter without contradicting the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Check'), resource ('specific versions for multiple packages'), and scope (bulk), distinguishing it from singular sibling tools. It also adds use cases like 'bulk dependency validation' and 'CI/CD pipeline checks', leaving no ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit use cases are given ('bulk dependency validation, CI/CD pipeline checks, or ensuring multiple package version compatibility'). It does not explicitly name alternatives or when not to use, but the 'multiple packages' scope versus siblings like check_version_exists implies a clear contrast.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_latest_versionA

Get the latest version of a package. Use for dependency updates, version checks, or when you need the most recent stable release. Returns package name, latest version, description, and timestamp.

ParametersJSON Schema
NameRequiredDescriptionDefault
package_nameYesName of the package to check
registryYesPackage registry/manager to check

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Since no annotations are provided, the description must carry the full burden of behavioral disclosure. It does disclose what is returned ('Returns package name, latest version, description, and timestamp'), which is useful. However, it does not explicitly state that this is a read-only operation, mention failure modes, or address prerequisites, leaving gaps in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two well-structured sentences. The first sentence states the core purpose, and the second sentence gives both usage guidance and return information. Every word earns its place, with no fluff or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is low-complexity (2 parameters, no output schema), and the description covers the essential aspects: what it does, when to use it, and what it returns. It could be more complete by explicitly noting that it handles only a single package (vs. a batch tool) or by describing registry-specific behavior, but these are minor gaps given the simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for both parameters, so the baseline is 3. The description does not add any parameter-specific semantics beyond what the schema already provides, such as the enum choices for registry or the meaning of package_name. It adds no extra value here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action and resource: 'Get the latest version of a package.' This is a specific verb+resource pair that is easily distinguished from siblings like check_version_exists or get_package_info. The added mention of return values further clarifies its scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage context: 'Use for dependency updates, version checks, or when you need the most recent stable release.' However, it does not name alternatives or exclusions (e.g., when to use get_latest_versions instead), so it lacks the explicit when-not guidance of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_latest_versionsA

Get latest versions for multiple packages simultaneously. Use when checking 3+ dependencies - processes up to 100 packages in parallel. Returns individual results for each package with error isolation. Much faster than individual calls for multiple packages.

ParametersJSON Schema
NameRequiredDescriptionDefault
packagesYesArray of package names to check
registryYesPackage registry/manager to check

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of disclosing behavior. It adds valuable context: parallel processing of up to 100 packages, individual results per package, and error isolation. These details hint at fault tolerance and performance characteristics, which are not visible in the schema. It stops short of specifying rate limits or exact return structure, but for a read-only check tool, this is adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences, each earning its place. The first states the core purpose, the second gives a usage rule and limit, and the third describes behavior and benefit. It is front-loaded with the main idea and contains no redundant filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (two well-documented params, no output schema, no annotations), the description covers the essential aspects: purpose, when to use, behavioral traits, and performance rationale. It does not describe the exact return format, but the 'individual results for each package' hint and the context of sibling tools like get_latest_version make the tool's output predictable enough. A slightly richer description of error handling would push it to a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%: both parameters (packages and registry) have descriptions and the registry has an enum. The description adds context about batch usage and parallelism, but does not add syntax or format details beyond what the schema already provides. This is the baseline for well-documented schemas.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Get latest versions for multiple packages simultaneously.' This clearly distinguishes it from siblings like get_latest_version (singular) and check_version_exists by emphasizing the plural, batch nature. The intent is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit usage context with a quantitative threshold: 'Use when checking 3+ dependencies' and a capability limit: 'processes up to 100 packages in parallel.' It also justifies why to use it ('Much faster than individual calls'), though it does not explicitly name the alternative tool or mention when NOT to use it. This is clear guidance, but not fully exhaustive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_package_infoA

Get detailed package information including all versions. Use for dependency audits, security reviews, or when you need comprehensive package metadata. Returns versions list, homepage, repository, and full package details.

ParametersJSON Schema
NameRequiredDescriptionDefault
package_nameYesName of the package to get info for
registryYesPackage registry/manager to check

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description does most of the work. It discloses the return behavior ('Returns versions list, homepage, repository, and full package details') but doesn't cover other behavioral aspects like rate limits, authorization, or whether results are cached. For a read-only 'get' tool, this is adequate but not exceptional.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no filler. The first sentence states purpose, the second adds use cases and return details. Fully front-loaded and every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only package info tool, the description covers what, when, and what comes back. The lack of an output schema is acceptable given the description explicitly lists the key fields. It doesn't explain how to handle errors or edge cases, but those aren't essential for this simple tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are already well-documented. The description adds no additional semantics beyond what's in the schema, making the baseline 3 appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Get detailed package information including all versions' with a specific verb and resource. It explicitly differentiates from siblings like get_latest_version and check_version_exists by emphasizing comprehensive metadata and all versions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit use cases: 'Use for dependency audits, security reviews, or when you need comprehensive package metadata.' It does not mention when not to use or alternatives, but the context is clear enough to distinguish this from simpler sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_packages_infoA

Get comprehensive package details for multiple packages. Use for dependency audits, security reviews, or bulk package analysis. Processes up to 100 packages in parallel. Returns detailed info for each package with error isolation - failed packages don't break the batch.

ParametersJSON Schema
NameRequiredDescriptionDefault
packagesYesArray of package names to get info for
registryYesPackage registry/manager to check

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden and discloses key behaviors: 'Processes up to 100 packages in parallel' and 'error isolation - failed packages don't break the batch.' This adds significant operational context, though it omits authentication or return format details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each earning its place: purpose, usage guidance, and operational limits. No fluff or redundancy, and the first sentence immediately states the tool's core function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description mentions 'Returns detailed info for each package' and error isolation, but does not specify the return structure. For a batch tool of this simplicity, this is adequate; additional detail on output format or authentication would make it near-complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for both parameters (packages array, registry enum). The description adds the parallel batch limit of 100 for the packages parameter, but beyond that it does not significantly enhance parameter semantics beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description states 'Get comprehensive package details for multiple packages' with a specific verb and resource, and the explicit 'multiple packages' distinguishes it from the sibling get_package_info tool. It also lists concrete use cases (dependency audits, security reviews, bulk package analysis), making the purpose unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly says 'Use for dependency audits, security reviews, or bulk package analysis,' giving clear context. It does not explicitly name alternatives or when not to use, but the plural scope and sibling names imply that singular requests belong to get_package_info.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updates
    • First observedcheck_version_exists
    • First observedcheck_versions_exist
    • First observedget_latest_version
    • First observedget_latest_versions
    • First observedget_package_info
    • First observedget_packages_info

TDQS

A4.2/5.0

Scored across 6 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: single vs. multi-package operations, version existence checks vs. latest version retrieval vs. detailed package info. The descriptions reinforce these distinctions, making misselection unlikely.

Naming Consistency5/5

Tool names follow a consistent verb_noun pattern throughout (e.g., check_version_exists, get_latest_version). All use snake_case and maintain parallel naming for singular and plural variants, making the set predictable and readable.

Tool Count5/5

Six tools are well-scoped for a dependency management server, covering core operations like validation, updates, and audits. Each tool earns its place by addressing distinct use cases without redundancy or bloat.

Completeness4/5

The toolset provides strong coverage for dependency checking, version retrieval, and package info, with efficient bulk operations. A minor gap exists in update or install actions, but agents can work around this for most dependency management workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers