MCP Source Relation Server
local-only server
The server can only run on the client’s local machine because it depends on local resources.
Integrations
Analyzes JavaScript files for import statements and require statements to determine file dependencies
Analyzes Python files for import statements, from...import statements, init.py, and relative imports to determine file dependencies
Analyzes Ruby files for require statements and require_relative statements, including those without extensions, to determine file dependencies
MCP Source Relation Server
指定されたディレクトリの src
配下のソースコードの関連性を解析するMCPサーバーです。
言語ごとのインポート文を解析し、ファイル間の依存関係を特定します。
Claudeに組み込むことで、Claudeがプロジェクトの依存関係を素早く確認でき、関連するファイルの特定に役立ちます。
機能
- 複数言語のインポート解析をサポート
- TypeScript/JavaScript:
import
文、require
文 - Python:
import
文、from ... import
文 - Ruby:
require
文、require_relative
文 - Rust:
mod
宣言、use
文
- TypeScript/JavaScript:
- tsconfig.jsonのパスエイリアス(
@/components/...
など)に対応 - 言語ごとの特殊な機能に対応
- Python:
__init__.py
、相対インポート - Rust:
mod.rs
パターン - TypeScript: エイリアス、
index.ts
- Ruby: 拡張子なしのrequire
- Python:
セットアップ
必要条件
- Python 3.10以上
- uv
インストール
Claude for Desktopでの設定
claude_desktop_config.json
に以下の設定を追加してください:
使用方法
Claudeでの使用
/Users/xxx/GitHub/xxx/ のソースの依存関係を確認して
のように指示すると動作します
ディレクトリを指定した場合はその下の src
ディレクトリを解析します
ファイルを指定した場合はそのファイルを基準に解析します
promptからのパス入力にも対応しています
promptで利用する場合は、Attach from MCP
->Choose an integration
->source-relation
を選択してください
出力形式
解析結果は以下のようなJSON形式で出力されます:
すべてのパスはsrc
ディレクトリを基準とした相対パスで表示されます。
サポートされるインポート形式
TypeScript/JavaScript
import { Component } from './Component'
import type { Type } from '@/types'
import './styles.css'
require('./module')
- エイリアスパス(
@/components/...
)
Python
import module
from module import name
from .module import name
from ..module import name
Ruby
require 'module'
require_relative './module'
- 拡張子なしのrequire
Rust
mod module;
use crate::module;
use super::module;
use self::module;
You must be authenticated.
Analyzes source code dependencies across multiple programming languages in the specified directory to identify file relationships, assisting in dependency management and project structure understanding.