
MCP Source Relation Server
Analyzes source code dependencies across multiple programming languages in the specified directory to identify file relationships, assisting in dependency management and project structure understanding.
owayo
Tools
get_source_relation
Analyze dependencies between source files
README
MCP Source Relation Server
指定されたディレクトリの src
配下のソースコードの関連性を解析するMCPサーバーです。
言語ごとのインポート文を解析し、ファイル間の依存関係を特定します。
Claudeに組み込むことで、Claudeがプロジェクトの依存関係を素早く確認でき、関連するファイルの特定に役立ちます。
<a href="https://glama.ai/mcp/servers/jmnzj9317i"><img width="380" height="200" src="https://glama.ai/mcp/servers/jmnzj9317i/badge" alt="Source Relation Server MCP server" /></a>
機能
- 複数言語のインポート解析をサポート
- 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
インストール
# uvのインストール
$ curl -LsSf https://astral.sh/uv/install.sh | sh
$ cd /path/to/mcp-source-relation
# ライブラリのインストール
$ uv sync
Claude for Desktopでの設定
claude_desktop_config.json
に以下の設定を追加してください:
{
"mcpServers": {
"source-relation": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-source-relation", # このプロジェクトディレクトリの絶対パスに書き換えてください
"run",
"source_relation.py"
]
}
}
}
使用方法
Claudeでの使用
/Users/xxx/GitHub/xxx/ のソースの依存関係を確認して
のように指示すると動作します
`/Users/owa/GitHub/mcp-source-relation/` のソースコードの依存関係を確認してみましょう。
依存関係の分析結果から、以下のような構造が確認できます:
1. メインの解析モジュール: `src/source_analyzer.py`
- 各言語固有の解析モジュールを利用しています(Ruby, Python, TypeScript, Rust)
2. 言語別の解析モジュール:
- `src/analyzers/ruby.py`
- `src/analyzers/python.py`
- `src/analyzers/typescript.py`
- `src/analyzers/rust.py`
- すべて `src/analyzers/base.py` を継承しています
3. 共通基盤:
- `src/analyzers/base.py`: 基本的な解析機能を提供
- `src/utils/path.py`: パス操作のユーティリティ
- `src/configs/typescript.py`: TypeScript固有の設定
特徴的な点:
- 各言語の解析モジュールは共通の基底クラス(base.py)を継承しており、一貫性のある設計になっています
- TypeScriptのみ独自の設定ファイル(configs/typescript.py)を持っています
- パス操作は共通のユーティリティモジュール(utils/path.py)に集約されています
この構造から、新しい言語のサポートを追加する場合は、`src/analyzers/` に新しいモジュールを追加し、`base.py` を継承することで実現できる設計になっていることがわかります。
ディレクトリを指定した場合はその下の src
ディレクトリを解析します
ファイルを指定した場合はそのファイルを基準に解析します
promptからのパス入力にも対応しています
promptで利用する場合は、Attach from MCP
->Choose an integration
->source-relation
を選択してください
出力形式
解析結果は以下のようなJSON形式で出力されます:
{
"dependencies": {
"components/Button.tsx": [
"types/index.ts",
"utils/theme.ts"
],
"pages/index.tsx": [
"components/Button.tsx",
"utils/api.ts"
]
}
}
すべてのパスは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;
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
MCP Package Docs Server
Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
@kazuph/mcp-taskmanager
Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.
Gitingest-MCP
An MCP server for gitingest. It allows MCP clients like Claude Desktop, Cursor, Cline etc to quickly extract information about Github repositories including repository summaries, project directory structure, file contents, etc
Linear MCP Server
Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.
mermaid-mcp-server
A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.
Jira-Context-MCP
MCP server to provide Jira Tickets information to AI coding agents like Cursor

Linear MCP Server
A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.