Giving AI Agents Eyes Into Your .NET Codebase
When I started using AI coding assistants seriously, I kept running into the same wall: the AI would confidently suggest a refactor, get the type hierarchy wrong, and send me chasing a bug it introduced. Not because it was bad at coding — but because it was reading my codebase the way a text editor from 1995 would: as flat files, searched by pattern.
That’s why I built Roslyn CodeLens MCP.
What It Does
Roslyn CodeLens MCP is a Model Context Protocol server that gives AI agents real semantic understanding of .NET codebases. Instead of grep, it uses the Roslyn compiler API — the same engine that powers Visual Studio’s IntelliSense, refactoring, and diagnostics.
That means an AI agent can:
find_implementations— see every class implementing an interface, not just ones with obvious namesfind_callers— know every call site before suggesting a renameget_type_hierarchy— walk base classes and derived types correctlyget_di_registrations— understand the DI graph without running the appget_diagnostics— read compiler errors and Roslyn analyzer warningsapply_code_action— execute Roslyn refactorings with a diff preview before writing to disk
Over 30 tools in total, from dead code detection to cyclomatic complexity analysis.
Why MCP?
MCP lets any supporting AI client — Claude Code, VS Code Copilot, Cursor — connect to the server and call its tools during a conversation. The AI decides when to call find_callers before proposing a rename, or get_diagnostics after generating code. You don’t have to prompt it; the tool availability shifts how it reasons.
Getting Started
Install as a .NET global tool:
dotnet tool install -g RoslynCodeLens.Mcp
Or install as a Claude Code plugin:
claude install gh:MarcelRoozekrans/roslyn-codelens-mcp
The server is also listed on Glama.ai and available on NuGet.
Source and full tool reference: github.com/MarcelRoozekrans/roslyn-codelens-mcp