SX

srijanshukla18/xray

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

52 stars 9 forks 质量 84 趋势 8MIT

srijanshukla18/xray 是从 https://github.com/srijanshukla18/xray. 导入的 MCP 服务器候选。

概览

srijanshukla18/xray 是从 https://github.com/srijanshukla18/xray. 导入的 MCP 服务器候选。

概述(AI 翻译)

一个MCP服务器,允许编码代理在无需读取整个文件的情况下,查看代码库的形状——布局、签名、定义、引用。

为什么

编码代理已经有grep、glob和文件读取。他们在哪些地方刻录上下文:

  • 读取一个1500行的文件以学习三个函数签名。 read_interface 返回文件的API——每个类、方法、函数和类型及其签名、单行文档和行号——因此代理只读取它所需的行。
  • Grepping 名称并浏览注释、字符串和部分匹配。 find_symbol 仅返回定义,排名模糊。what_breaks 返回标识符引用,排除注释和字符串字面量。
grep / rg X光 激光
设置 无 uv tool install 每种语言的服务器
仅查找定义 ✗ ✓ ✓
跳过评论和字符串 ✗ ✓ ✓
文件 API 无正体 ✗ ✓ 部分(文档符号)
类型感知引用 ✗ ✗(基于姓名) ✓

XRAY 介于两者之间:通过树置器实现语法感知,零每种语言设置,并且诚实地不解析类型。

安装

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

XRAY

An MCP server that lets coding agents see a codebase’s shape — layout, signatures, definitions, references — without reading whole files.

Why

Coding agents already have grep, glob and file reads. Where they burn context is:

  • Reading a 1,500-line file to learn three function signatures. read_interface returns the file’s API — every class, method, function and type with its signature, one-line doc and line number — so the agent reads only the lines it needs.
  • Grepping a name and wading through comments, strings and partial matches. find_symbol returns definitions only, ranked, fuzzy. what_breaks returns identifier references with comments and string literals excluded.
grep / rg XRAY LSP
Setup none uv tool install a server per language
Finds definitions only ✗ ✓ ✓
Skips comments & strings ✗ ✓ ✓
File API without the bodies ✗ ✓ partial (document symbols)
Type-aware references ✗ ✗ (name-based) ✓

XRAY sits between the two: syntax-aware via tree-sitter, zero per-language setup, and honest about not resolving types.

Install

uv tool install git+https://github.com/srijanshukla18/xray

Then register the xray-mcp command with your client.

Claude Code

claude mcp add xray -s user -- xray-mcp

Claude Desktop, Cursor, VS Code, others — add to the client’s MCP config:

{ "mcpServers": { "xray": { "command": "xray-mcp" } } }

To run without installing: uvx --from git+https://github.com/srijanshukla18/xray xray-mcp.

There is also install.sh, which installs uv if needed and then runs the command above.

Tools

All paths in results are absolute. root_path is the project directory.

explore_repo(root_path, max_depth=None, include_symbols=False, focus_dirs=None, max_symbols_per_file=5)

Directory tree honouring .gitignore (via git ls-files, or a .gitignore parser outside git). Directories cut off by max_depth show their file count. Output is capped at 1,000 lines.

explore_repo("/home/me/xray", max_depth=2)

/home/me/xray/
├── src/
│   └── xray/ (6 files)
├── tests/
│   ├── __init__.py
│   └── test_xray.py
├── pyproject.toml
└── README.md

focus_dirs takes paths relative to the root; with include_symbols=True each file lists its signatures:

explore_repo("/home/me/xray", focus_dirs=["src/xray/core"], include_symbols=True, max_symbols_per_file=3)

/home/me/xray/
└── src/
    └── xray/
        └── core/
            ├── files.py
            │   ├── def list_files(root: Path) -> List[str]  # Return POSIX paths, relative to root, of every non-ignored…
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "xray": { "command": "xray-mcp" } } }