MCP 源关系服务器
这是一个分析指定目录的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:无需扩展即可要求
设置
先决条件
Python 3.10 或更高版本
紫外线
安装
Claude 用于桌面设置
将以下内容添加到claude_desktop_config.json
:
如何使用
克劳德使用
/Users/xxx/GitHub/xxx/ のソースの依存関係を確認して
并像这样指示它,它将起作用
如果指定目录,则会分析其下的src
目录。如果您指定一个文件,则分析将基于该文件。它还支持从提示符输入路径。要与提示一起使用它,请选择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
红宝石
require 'module'
require_relative './module'
需要无扩展名
锈
mod module;
use crate::module;
use super::module;
use self::module;
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
分析指定目录中跨多种编程语言的源代码依赖关系,以识别文件关系,协助依赖关系管理和项目结构理解。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityProvides tools for collecting and documenting code from directories.Last updated -42515MIT License
- -securityFlicense-qualityAnalyzes codebases to generate dependency graphs and architectural insights across multiple programming languages, helping developers understand code structure and validate against architectural rules.Last updated -62214
- -securityAlicense-qualityA 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.Last updated -2GPL 3.0
- AsecurityAlicenseAqualityProvides 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 -13715MIT License