Skip to main content
Glama
MCP Source Relation Server

MCP Source Relation Server

by owayo

MCP Source Relation Server

지정된 디렉토리의 src 아래의 소스 코드의 관련성을 해석하는 MCP 서버입니다. 언어별 가져오기 문을 구문 분석하여 파일 간 종속성을 확인합니다. Claude에 통합하면 Claude가 프로젝트 종속성을 신속하게 확인할 수 있으며 관련 파일을 식별하는 데 도움이 됩니다.

기능

  • 다국어 가져오기 분석 지원

    • TypeScript/JavaScript: import 문, require 문

    • Python: import 문, from ... import 문

    • Ruby : require 문, require_relative 문

    • Rust: mod 선언, use 문

  • tsconfig.json의 경로 별칭( @/components/... 등)에 대응

  • 언어별 특수 기능에 대응

    • Python: __init__.py , 상대 가져오기

    • Rust: mod.rs 패턴

    • TypeScript: 별칭, index.ts

    • Ruby: 확장자 없이 require

Related MCP server: QoutaMCP

설정

요건

  • 파이썬 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 디렉토리를 구문 분석합니다. Choose an integration source-relation Attach from MCP 합니다.

출력 형식

해석 결과는 다음과 같은 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/... )

파이썬

  • import module

  • from module import name

  • from .module import name

  • from ..module import name

루비

  • require 'module'

  • require_relative './module'

  • 확장자 없이 require

Rust

  • mod module;

  • use crate::module;

  • use super::module;

  • use self::module;

Available Tools

1 tool
get_source_relationC

Analyze dependencies between source files

Inputs: path (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.5/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clearly defined purpose of analyzing dependencies between source files, making it impossible for an agent to misselect between non-existent alternatives.

    Naming Consistency5/5

    A single tool inherently exhibits perfect naming consistency, as there are no other tools to compare against. The tool name 'get_source_relation' follows a clear verb_noun pattern, which would be consistent if more tools existed.

    Tool Count2/5

    A single tool is generally too few for most server purposes, as it limits functionality and suggests an incomplete or overly narrow scope. While it might be appropriate for a highly specialized task, it feels thin and insufficient for comprehensive source dependency analysis, which typically involves multiple operations like listing, updating, or visualizing relations.

    Completeness2/5

    The tool set is severely incomplete for the inferred domain of source dependency analysis. With only a 'get' operation, there are obvious gaps such as creating, updating, deleting, or listing source relations, and no support for lifecycle management or advanced queries. This will likely cause agent failures when more complex operations are needed.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      Analyzes codebases to generate dependency graphs and architectural insights across multiple programming languages, helping developers understand code structure and validate against architectural rules.
      6
      20
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables inspection and analysis of project structures to detect languages, frameworks, entry points, and dependencies across multiple programming languages including Node.js, Python, PHP, Go, Java, and Rust.
      3
      7 npm
      1
      ISC
    • A
      license
      Not graded
      quality
      D
      maintenance
      Generates and queries a graph representation of a codebase to identify entities and their relationships, such as function calls and inheritance. It supports multiple languages including Python, JavaScript, and Rust to help users navigate and understand complex code structures.
      22
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables token-efficient semantic search and analysis over any directory of files through hybrid search, directory overview, structural analysis, and dependency graphs.
      14
      MIT