Skip to main content
Glama

MCP Source Relation Server

MCP Source Relation Server

This is an MCP server that analyzes the relationships of source code under src directory of a specified directory. It analyzes import statements for each language and identifies dependencies between files. By incorporating it into Claude, Claude can quickly check the dependencies of a project and help identify related files.

function

  • Supports multi-language import parsing

    • TypeScript/JavaScript: import statement, require statement

    • Python: import statement, from ... import statement

    • Ruby: require statement, require_relative statement

    • Rust: mod declaration, use statement

  • Corresponds to path aliases in tsconfig.json (such as @/components/... )

  • Supports special features for each language

    • Python: __init__.py , relative imports

    • Rust: mod.rs pattern

    • TypeScript: alias, index.ts

    • Ruby: require without extension

set up

Prerequisites

  • Python 3.10 or later

  • uv

install

# uvのインストール $ curl -LsSf https://astral.sh/uv/install.sh | sh $ cd /path/to/mcp-source-relation # ライブラリのインストール $ uv sync

Claude for Desktop Settings

Add the following to claude_desktop_config.json :

{ "mcpServers": { "source-relation": { "command": "uv", "args": [ "--directory", "/path/to/mcp-source-relation", # このプロジェクトディレクトリの絶対パスに書き換えてください "run", "source_relation.py" ] } } }

How to use

Use by Claude

/Users/xxx/GitHub/xxx/ のソースの依存関係を確認してand instruct it like this, it will work

`/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` を継承することで実現できる設計になっていることがわかります。

If you specify a directory, the src directory under it will be analyzed. If you specify a file, the analysis will be based on that file. It also supports path input from the prompt. To use it with a prompt, select Attach from MCP -> Choose an integration -> source-relation .

Output Format

The analysis results are output in JSON format as follows:

{ "dependencies": { "components/Button.tsx": [ "types/index.ts", "utils/theme.ts" ], "pages/index.tsx": [ "components/Button.tsx", "utils/api.ts" ] } }

All paths are relative to the src directory.

Supported import formats

TypeScript/JavaScript

  • import { Component } from './Component'

  • import type { Type } from '@/types'

  • import './styles.css'

  • require('./module')

  • Alias paths ( @/components/... )

Python

  • import module

  • from module import name

  • from .module import name

  • from ..module import name

Ruby

  • require 'module'

  • require_relative './module'

  • Require without extension

Rust

  • mod module;

  • use crate::module;

  • use super::module;

  • use self::module;

Deploy Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    Provides tools for collecting and documenting code from directories.
    Last updated -
    4
    28
    15
    MIT License
    • Apple
    • Linux
  • A
    security
    F
    license
    A
    quality
    Analyzes codebases to generate dependency graphs and architectural insights across multiple programming languages, helping developers understand code structure and validate against architectural rules.
    Last updated -
    6
    15
    15
  • -
    security
    -
    license
    -
    quality
    A tool that helps rank codebase files by importance (1-10 scale), track file dependencies, and provide summaries, all accessible through a simple JSON-based interface.
  • A
    security
    A
    license
    A
    quality
    Provides code context and analysis for AI assistants by extracting directory structures and code symbols using WebAssembly Tree-sitter parsers with zero native dependencies.
    Last updated -
    1
    102
    20
    MIT License
    • Linux
    • Apple

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/owayo/mcp-source-relation'

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