Show HN: XRAY MCP – AST-grep wrapped in a tiny server for code-aware AI

4 srijanshukla18 8 8/6/2025, 4:19:49 PM github.com ↗
Hi HN,

I built XRAY MCP after discovering that AI assistants were scanning my projects with plain grep and guessing. I tried direct tree-sitter integration and language servers; both felt heavy for a lightweight tool.

ast-grep hit a sweet spot: syntax-aware search in a single binary. XRAY MCP wraps it behind three endpoints—map, find, impact—so a model (or human) can answer questions like “what breaks if I change this function?” on demand.

It’s stateless, supports Python/JS/TS/Go, and installs quickly.

Repo: https://github.com/srijanshukla18/xray

Would love to know your thoughts!

Comments (8)

satyajeetjadhav · 5h ago
Looks interesting. In my experience the way current coding agents behave is - they make a change, then rely on linter to highlight errors due to the change. Once linter errors are highlighted, they try to fix them.

Providing access to something like this via mcp might help these coding agents plan better and limit or atleast understand the blast radius for refactors.

Will try.

srijanshukla18 · 5h ago
You've hit the nail on the head! "Understanding the blast radius" is the core problem xray mcp tries to solve.

The whole idea behind tools like what_breaks is to give the agent that foresight before it makes a change, moving it from a reactive "change -> lint -> fix" cycle to a more proactive "plan -> analyze -> change" workflow.

Thanks for checking it out!

About the linting use case specifically, I've found claude code hooks to be very beneficial. Not sure if other tools have an equivalent. Check that out too!

tcpip84 · 5h ago
Nice. Will check it out. I’ve tried using AI-assisted code search before and always hit the “grep guessing” problem you mentioned.
srijanshukla18 · 5h ago
exactly yep, hate it when it just keeps going in circles. thats a lot of extra tokens also you know! let me know your thoughts once you check it out
tushr · 5h ago
I am surprised that tools like Gemini CLI and Claude Code are not doing this by default.
srijanshukla18 · 5h ago
I know right! I am surprised that many of these cli tools just keep running around the codebase read whole files at once and grepping vaguely
importhuman · 5h ago
Will check this out. Is there a prompt I can use in the beginning that doesn't need me to add the xray prompt in future calls?
srijanshukla18 · 5h ago
Yes! depends on the code agent you are using. CLAUDE.md or GEMINI.md for example - you can be adding a one liner there - "always use xray mcp tools to make any changes or to explore a new codebase"