DEV Community

Cover image for I gave my AI agent the compiler's eyes — here's what changed
Ladislav Sopko
Ladislav Sopko

Posted on

I gave my AI agent the compiler's eyes — here's what changed

— grepping across my monorepo, reading 50 files, half of them irrelevant, then guessing.

So I built two MCP servers. They changed everything.

The problem every AI coding agent has

Whether you use Claude Code, Cursor, Copilot, or anything else — when your AI needs to understand code, it defaults to text search. Grep, ripgrep, file reads, regex.

On a real codebase (mine is 1,500+ C#/.NET projects), that means:

  • "Who calls PublishAsync?" → grep → 200 string matches → read 50 files → half are tests/docs/comments → guess which are real callers
  • "What breaks if I change this?" → no idea, read everything that mentions it
  • "How does GetRequiredService work in the DI container?" → clone dotnet/runtime, search, give up

Cost: 40,000-60,000 tokens per question. Often wrong.

The fix: give the AI the compiler's eyes

I built two MCP servers that solve opposite sides of the same problem:

LSAI — your code, live

LSAI runs on your machine and wraps real LSP servers — the same language servers your IDE uses:

Language LSP Server
C# Roslyn (in-process)
Python ty
Java jdtls
TypeScript/JS typescript-language-server
Rust rust-analyzer
Go gopls
PHP intelephense
C/C++ clangd

14 MCP tools. The highlights:

lsai_callers("PublishAsync")
→ 15 callers, exact file:line, compiler-resolved

lsai_impact("PublishAsync")  
→ MEDIUM risk, 15 references, 27 tests affected
  Tests: PublishServiceTests, V32SpecComplianceTests...

lsai_hierarchy("BaseService")
→ full inheritance chain, interfaces, implementations
Enter fullscreen mode Exit fullscreen mode

Install once, add one line to .mcp.json:

{
  "mcpServers": {
    "lsai": {
      "command": "~/.lsai/run",
      "args": ["--stdio"]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Your code never leaves your machine. LSAI is 100% local.

xmp4 — every library, pre-indexed

xmp4 is the other lens. It has 900+ OSS libraries already indexed across 12 languages — 15,000+ navigable projects. When your AI needs to understand how a third-party API actually works, it reads the real source, not docs:

xmp4_source("GetRequiredService", project="dotnet/runtime")
→ public interface ISupportRequiredService {
    object GetRequiredService(Type serviceType);
  }

xmp4_callers("MongoClient.connect")
→ 26 real call sites across 4 repos, typed
Enter fullscreen mode Exit fullscreen mode

One line in your MCP config, no install, no API key:

{
  "mcpServers": {
    "xmp4": {
      "type": "http",
      "url": "https://mcp.example4.ai/mcp"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

17 MCP tools. Covers C#, Java, TypeScript, Python, Rust, PHP, Go, JavaScript, Dart, Ruby, C++, Scala.

The tandem — where it gets powerful

Here's what happened yesterday in a real session. I needed to understand a dependency chain:

Step 1 — LSAI on my code:

lsai_callees("PublishAsync")
→ CreateScope()             — PublishService.cs:22
→ GetRequiredService<Ctx>   — PublishService.cs:23
→ Where<PublishedProject>   — PublishService.cs:74
Enter fullscreen mode Exit fullscreen mode

My AI now knows my code calls GetRequiredService. But how does that work?

Step 2 — xmp4 on the library:

xmp4_source("GetRequiredService", project="dotnet/runtime")
→ ISupportRequiredService interface
→ Throws InvalidOperationException if not registered
Enter fullscreen mode Exit fullscreen mode

Now it knows the contract AND the failure mode.

Step 3 — LSAI for risk assessment:

lsai_impact("PublishAsync")
→ MEDIUM risk — 15 refs, 27 tests
→ All test names listed, all lines numbered
Enter fullscreen mode Exit fullscreen mode

Three calls. The AI traced from my code → into a library's internals → back to risk assessment. ~1,500 tokens total. No grep. No guessing. No cloning.

The numbers

I measured this on real tasks across 4 tier-1 libraries (spring-boot, tokio, django, efcore):

Approach Tokens Accuracy
xmp4 1,558 Exact (compiler-resolved)
grep + clone 47,200 Approximate (string match)
GitMCP 65,629 Approximate (text search)
Context7 n/a Can't answer (docs only)

42x fewer tokens than GitMCP. 30x fewer than grep. Full benchmark whitepaper.

Get started

LSAI (your code):

curl -fsSL https://github.com/0ics-srls/Zerox.Lsai.Public/releases/latest/download/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

xmp4 (libraries): add the JSON config above. That's it.

Visual Studio users: there's also vs-mcp — same concept but as a VS extension with 41 Roslyn-powered tools.

Landing page: example4.ai

Both free. Both actively developed — I ship improvements every week. Both speak standard MCP, so they work with Claude Code, Cursor, VS Code, Claude Desktop, and any other MCP client.


I'm building this because I needed it myself. If you're spending tokens on code exploration instead of code generation, these two might help. Happy to answer questions.

Top comments (0)