SuperAPI AI Directory

xray

Code intelligence via ast-grep: map project structure, fuzzy-find symbols and assess change impact in Python, JS/TS and Go.

Open website Compare
PricingOpen sourceGitHub 开源项目 · 52 Stars
GitHub stars52GitHub

Sources: GitHub

About this tool

XRAY MCP is a tool that provides AI assistants with progressive code intelligence and navigation capabilities, performing structured code analysis through ast-grep. It is designed to solve the common problems AI assistants face when understanding codebases, such as being unable to view code structure, not knowing function dependencies, and lacking impact analysis. XRAY provides AI assistants with code navigation capabilities, which can be used simply by adding "use XRAY tools" to the prompt.

Main Capabilities

XRAY provides three core tools:

  • Map (explore_repo): View the project structure, display the symbol skeleton, and help gradually understand the codebase from the macro to the micro level.
  • Find (find_symbol): Locate functions and classes through fuzzy search, with support for viewing function signatures and docstrings.
  • Impact (what_breaks): Find where a symbol is referenced and assess the impact of changes.

In addition, it also provides the what_depends tool, used to find the code that a symbol depends on (calls and imports).

Usage

XRAY uses a stateless design, requiring no database or persistent index, and runs ast-grep queries in real time for each operation, ensuring accurate results. There are various installation methods:

  • Use the uv automated installation script for quick setup.
  • Use uvx to run directly without installation.
  • Install persistently as a tool.
  • Install in development mode.

After installation, you need to configure an AI assistant (such as Claude, Cursor, VS Code) to use XRAY. You can use the mcp-config-generator.py script in the repository to generate the configuration, or configure it manually. After configuration is complete, add "use XRAY tools" to the prompt to invoke it.

Applicable Scenarios

XRAY is suitable for scenarios that require AI assistants to deeply understand a codebase, such as code refactoring, impact analysis, and symbol lookup. It is especially suitable for large projects, and the focus_dirs parameter can be used to focus on specific directories to avoid information overload.

Limitations

XRAY performs structured analysis based on ast-grep, but results may include matches in comments or strings, and the AI assistant will intelligently filter them based on context. It does not rely on the Language Server Protocol (LSP), so there is no need to install and configure multiple language servers, but its functionality is simpler than LSP. Supported languages include Python, JavaScript, TypeScript, and Go. In terms of performance, it startsquickly, symbol search speed depends on the size of the codebase, and memory usage is extremely small.