Roslyn CodeLens MCP

Roslyn CodeLens MCP gives an agent a semantic map of a .NET solution: callers, type hierarchies, DI, diagnostics and safe renames

  • 74 ★ on the repository
  • Last commit
MCP server

Extended access

Why this level

  • Reads the source of the whole solution and, once you approve, runs Roslyn analyzer DLLs inside the server process
  • The rename and code fix tools can change solution files, and a preview lets you check edits beforehand
All reasons and checks

marcelroozekrans/roslyn-codelens-mcp

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add mcp/roslyn-codelens-mcp

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • Reads the source of the whole solution and, once you approve, runs Roslyn analyzer DLLs inside the server process
  • The rename and code fix tools can change solution files, and a preview lets you check edits beforehand

This is third-party code. Review the repository files before installing.

What it does

The MCP server loads a .sln or .slnx through Roslyn and answers code questions with tools instead of text search. The agent asks who calls a method, which classes implement an interface, what exceptions escape a method, where an event is subscribed. Each reference comes back tagged with its kind: read, write, invocation, cast, attribute or nameof. Beyond navigation the server audits quality. It computes cyclomatic and cognitive complexity, finds async and IDisposable misuse, circular dependencies and obsolete calls, enforces layering rules you supply, and diffs the public API against a baseline JSON or DLL. For tests it finds xUnit, NUnit and MSTest methods, lists uncovered symbols and drafts a test skeleton. Compiler diagnostics and code fixes are available, and a solution-wide rename comes with a preview. Symbols from NuGet packages work too: the server reads namespaces and types from assembly metadata, and peek_il shows the IL of a chosen method. Several solutions can be loaded at once and switched with set_active_solution.

Who it is for. C# and .NET developers who hand an agent a large solution and want exact answers about references and dependencies instead of grep guesses.

Good fit when

  • Before a refactor you need every caller of a method, including calls through an interface or delegate
  • The agent should find which tests cover a symbol and draft a test skeleton for an uncovered method
  • Before a library release you want the public API diffed against the last version to spot breaking changes
  • The solution has many projects and you need to check layer boundaries and dependency cycles

Not a fit when

  • The project is not C#: the server reads only .NET solutions through MSBuild
  • The machine has no .NET 10 or 11 SDK and cannot get one, and Docker is not an option
  • You need a quick string search across files: grep is enough
  • The solution was not restored, so package references do not resolve

Example request

Connect Roslyn CodeLens to this solution, list every caller of OrderService.Cancel, then check which tests cover it

MCP

Transport
stdio, http
Authentication
not required

Environment variables

ROSLYN_CODELENS_OPEN_PROJECT_TIMEOUT_SECONDS
Per-project MSBuild load timeout, 300 seconds by default

Limitations

  • The server needs the .NET 10 or 11 SDK. The npm package only launches the .NET global tool and ships no server code.
  • Roslyn analyzers run DLLs in-process, so a trust model applies: solutions passed on the command line are trusted for the session, others must be allowed with trust_solution.
  • In Docker the solution is mounted at /workspace and must be restored; paths in replies refer to the container and never to the host.
  • Responses are capped by limit (500 items by default), and a truncated flag marks a cut.

How to disable. Remove the roslyn-codelens entry from mcpServers in the client settings. A Claude Code plugin is removed with claude plugin uninstall, the global tool with dotnet tool uninstall -g RoslynCodeLens.Mcp. Trusted solutions live in trust.json, and revoke_trust withdraws trust.

FAQ

How do I connect Roslyn CodeLens to Claude Code?

Run claude install gh:MarcelRoozekrans/roslyn-codelens-mcp and the plugin starts the server through dnx. Only the .NET 10 or 11 SDK is required. For other clients add a server with command npx and arguments -y roslyn-codelens-mcp.

How is it different from text search?

Text search finds strings, while the server works with the Roslyn semantic model. It sees derived types, calls through interfaces, overloads and references to NuGet packages, so find_references does not miss a subclass or confuse same-named methods.

Is it safe to enable analyzers?

Analyzers run DLLs in-process, so the server asks for trust. Solutions passed on the command line are trusted for the session, others must be allowed through trust_solution. DLLs load only from the NuGet folder, the SDK or the solution's bin and obj.

Does the server run without the .NET SDK?

Yes, through Docker: the solution is mounted at /workspace and the image is built with docker build -t roslyn-codelens-mcp . from the repository. The solution must be restored beforehand.

Can one server serve several clients?

Yes. Start roslyn-codelens-mcp with the solution path and the --http flag; it listens on 127.0.0.1:3001 and --port changes the port. One warm process serves several local clients.

Discussion

No questions or reviews yet.

DevLens analyzes a repo once and serves agents ranked files, call flow and change impact over MCP, no file-by-file reading

MCP serverExtended access70Repository stars

An MCP to LSP bridge: the agent gets types, references, diagnostics and refactoring from rust-analyzer, pyright and gopls.

MCP serverExtended access81Repository stars

An MCP bridge to VS Code that gives agents language-server diagnostics and symbol references instead of slow tsc runs.

MCP serverBroad access105Repository stars

The openmcp CLI and a VS Code extension for debugging MCP servers: tools, prompts and resources, chat with a model, test cases

CLIExtended access750Repository stars

A bridge from an LSP language server to the agent: definitions, references, diagnostics, hover and symbol rename

MCP serverExtended access1.6KRepository stars

An MCP server that indexes code with tree-sitter so an agent reads single symbols, not files, traces paths and weighs edits

MCP serverMinimal access76Repository stars

Comparison with similar tools

Cards that share the main search query, and how they differ.

ToolOfficialAuthenticationRepository starsMain difference
Roslyn CodeLens MCP (this card)nonot required74
dotnet-claude-kitno829a set of .NET skills and rules with no Roslyn semantic analysis of the solution
CodeGraphnonot required77,481a code graph across many languages without the exact C# compiler model

README in short

The repository page opens with a list of several dozen tools: navigation, tests, dependencies, exceptions, diagnostics, refactoring, metrics. It then covers the response format with a limit and a truncation flag, error codes, three tiers of external assembly access and the analyzer trust model. The quick start gives five ways to run it: npx, dnx in VS Code, the Claude Code plugin, a global tool and Docker. A last section describes an HTTP mode on port 3001 for a shared server.

README badge

Report a problem