DEV Community

Srijan Shukla
Srijan Shukla

Posted on

From Grep to ast-grep: Building XRAY MCP for Code-Aware AI

I enjoy coding with AI assistants, but they failed the moment I asked a structural question:

“Show me everything that calls authenticate()."

They guessed—because under the hood they were using plain text search.

After experiments with grep scripts (too noisy), tree-sitter bindings (too fragile), and LSPs (too heavy), I found ast-grep. It offers syntax-aware search without the infrastructure weight.

XRAY MCP is my wrapper around ast-grep: a tiny server exposing map, find, and impact endpoints. An assistant can now map the repo, locate a symbol, and see its references before suggesting changes.

The code is open source if you want to try the approach.

https://github.com/srijanshukla18/xray

Top comments (0)