Skip to main content
Glama

DependencyMCP サーバー

コードベースを分析し、依存関係グラフとアーキテクチャに関する洞察を生成するモデルコンテキストプロトコル(MCP)サーバー。このサーバーは、複数のプログラミング言語にまたがるコード構造、依存関係、アーキテクチャパターンの理解に役立ちます。

特徴

  • 多言語サポート: TypeScript、JavaScript、C#、Pythonなどの依存関係を分析

  • 依存関係グラフ生成: JSONまたはDOT形式で詳細な依存関係グラフを作成します。

  • アーキテクチャ分析: アーキテクチャのレイヤーを推測し、ルールに基づいて検証します

  • ファイルメタデータ: ソースファイルからインポート、エクスポート、その他のメタデータを抽出します

  • スコアリングシステム: アーキテクチャのルールとパターンに照らしてコードベースを評価する

インストール

  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) });

get_file_metadata

特定のファイルに関する詳細なメタデータを取得します。

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

  • globパターンマッチングのためのminimatch

プロジェクト構造

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

新しい言語のサポートの追加

新しいプログラミング言語のサポートを追加するには:

  1. デフォルトのfileTypes配列にファイル拡張子を追加する

  2. parseFileImportsparseFileExportsで言語固有の正規表現パターンを実装する

  3. 言語固有のアーキテクチャパターンをinferArchitecturalLayerに追加する

ライセンス

マサチューセッツ工科大学

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    Analyzes source code dependencies across multiple programming languages in the specified directory to identify file relationships, assisting in dependency management and project structure understanding.
    Last updated -
    1
    1
    MIT License
  • -
    security
    A
    license
    -
    quality
    A Cloudflare Worker that analyzes source code to provide comprehensive explanations including architecture diagrams, core functionality analysis, and component breakdowns across multiple programming languages.
    Last updated -
    6
    Apache 2.0
  • A
    security
    -
    license
    A
    quality
    Interact with CodeLogic, a Software Intelligence platform that graphs complex code and data architecture dependencies, to boost AI accuracy and insight.
    Last updated -
    2
    31
    Mozilla Public License 2.0
    • Apple
    • Linux
  • A
    security
    A
    license
    A
    quality
    Provides tools for analyzing project structures, searching through codebases, managing dependencies, and performing file operations with advanced filtering capabilities.
    Last updated -
    6
    19
    1
    MIT License

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mkearl/dependency-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server