← Back to directory
R

Roslyn CodeLens MCP Server

Community
Roslyn-based semantic .NET/C# intelligence for AI agents
Category
Dev Tools #20 of 438
Stars
★ 65 Popular
Transport
stdio (local process)
Runtime
.NET 10+ · Node.js · Docker
Credentials
No credential needed
License
MIT
Last commit
Tools
67
68FMRS · C

A very comprehensive Roslyn semantic-analysis MCP server with 67 tools covering navigation, refactoring, test intelligence, quality auditing, and IL inspection. Performance is benchmarked, and a VS-style trust model guards analyzer execution. Works only with SDK-style .NET projects and requires the .NET 10 SDK. Maintained by an individual developer, not an official .NET/Roslyn product.

Strongest · Documentation 18/20 Weakest · Reliability 9/20

Reliability
9/20
Security and permissions
14/20
Maintenance
14/20
Documentation
18/20
Setup experience
13/20
Why each score
Reliability 9/20
The README describes a consistent response envelope, structured error codes (SymbolNotFound, SolutionNotTrusted, etc.), and detailed behavior for all 67 tools, implying a mature error-handling design; it also references a CI badge and `dotnet test` commands. However, this is a purely static review — no actual CI workflow file or test suite content was available to verify these claims, nor can tool descriptions be confirmed against real behavior. Per the static calibration rule, reliability cannot exceed 12 without verifiable execution evidence (real CI plus committed tests covering key paths), so a low-to-mid score is given given the evidence is text-only.
Security and permissions 14/20
The server implements a VS/Rider-style trust model: analyzer execution requires explicit `trust_solution` (or auto-trust only for solutions passed on the CLI at startup), analyzer DLLs are restricted to the NuGet global packages folder, SDK install dir, or the solution's own bin/obj, and `list_trusted_paths`/`revoke_trust` allow inspection and revocation. Write-capable operations (`apply_code_action`, `rename_symbol`, `change_signature`) all offer preview/diff modes before touching disk, showing confirmation discipline for risky actions. However, analyzers still run in-process without sandboxing, and outbound network behavior is not further documented. This does not reach red-line severity but also falls short of full least-privilege coverage across all scenarios.
Maintenance 14/20
The repo is not archived, is MIT licensed, has 42 stars and only 1 open issue, and the version number (2.18.0) suggests substantial iterative releases. The README includes a build-status badge, a dedicated docs site, and a GitHub Sponsors link, indicating some governance and ownership. However, no concrete commit history, release dates, or issue-response times were available in the reviewed material, so update cadence and dependency maintenance cannot be confirmed, precluding a top score.
Documentation 18/20
The README is very comprehensive: it lists all tools with one-line descriptions, documents the uniform response envelope, structured error codes, the three-tier external-assembly model, runtime configuration, a security trust model (with a link to SECURITY.md), quick-start configs for multiple clients (npx/dnx/Docker/dotnet tool/Claude Code plugin), a performance benchmark table, hot-reload behavior, and explicit project-compatibility limitations (how legacy projects are skipped). Docs are layered, well-exemplified, and disclose limitations clearly. A small deduction applies because the 67 tools only get one-line descriptions without per-tool parameter-level JSON schema documentation.
Setup experience 13/20
Four-plus install/connection paths are provided (npx, dnx, `dotnet tool install`, Docker, Claude Code plugin) with concrete client configuration JSON for each, which is documented very clearly. Per the static calibration rule, setup cannot exceed 15 without verifiable execution evidence; actual installation also depends on having the .NET 10 SDK on PATH, the npm package is merely a launcher that installs a .NET global tool, and the `dnx` mechanism is relatively new and potentially fragile — steps are clear but the path remains somewhat manual/fragile.

Static review · not runListed 2026-09-07

Read the FMRS scoring method →

Fit and risk

What it can accessReads local filesWrites / deletes local filesRuns commands or code

Best for

  • .NET/C# developers using MCP clients like Claude Code or VS Code
  • AI-assisted development workflows needing deep static analysis and safe refactoring
  • Teams maintaining large SDK-style .NET solutions

Not for

  • Non-.NET/C# codebases
  • Legacy non-SDK-style csproj projects (skipped with a warning)
  • Environments without the .NET 10 SDK (unless using Docker)

Required permissions

  • Reads and analyzes .NET solutions and source files on disk
  • Tools like apply_code_action can write/modify source files (preview mode available)
  • Running Roslyn analyzer DLLs requires explicit trust via trust_solution

Risks and side effects

  • Analyzer DLLs execute in-process; the trust model restricts them to NuGet global packages, the dotnet SDK dir, or solution bin/obj, but grant trust carefully
  • apply_code_action, rename_symbol, and change_signature modify source files directly; prefer preview mode first
  • The stdio server has read/write access to the loaded codebase
  • Solutions must be NuGet-restored before loading or reference resolution may fail

Setup

Before you start

Runtime:.NET 10+ · Node.js · Docker

Other optional settings (1)
ROSLYN_CODELENS_OPEN_PROJECT_TIMEOUT_SECONDS optional Per-project MSBuild load timeout in seconds (default 300); projects exceeding it are skipped and reported in SkippedProjects. Set before starting the server.

npm: add "mcpServers": {"roslyn-codelens": {"type": "stdio", "command": "npx", "args": ["-y", "roslyn-codelens-mcp"]}} to your MCP client config; the .NET 10 SDK must be on PATH. NuGet: run dotnet tool install -g RoslynCodeLens.Mcp then configure command roslyn-codelens-mcp, or use dnx RoslynCodeLens.Mcp --yes. Claude Code: claude install gh:MarcelRoozekrans/roslyn-codelens-mcp. Docker is also supported, bind-mounting the solution at /workspace (solution must be restored).

.mcp.json
{"mcpServers":{"roslyn-codelens":{"type":"stdio","command":"npx","args":["-y","roslyn-codelens-mcp"]}}}

Shown for Claude Code. Other clients may use a different file or key (VS Code uses "servers") — the configurator below converts it.

.vscode/mcp.json
{
  "servers": {
    "roslyn-codelens": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "roslyn-codelens-mcp"
      ]
    }
  }
}

Goes in your project's .vscode/mcp.json (VS Code uses a "servers" key).

Terminal
claude mcp add roslyn-codelens -- npx -y roslyn-codelens-mcp

Run it in a terminal; replace any <…> placeholders with your own values first.

Check that it works

Connect the client and confirm the 67 tools (e.g. go_to_definition, get_diagnostics, trust_solution) appear in the tool list; then load a .sln and call list_solutions — seeing the loaded solution proves the connection works.

Troubleshooting

  1. Verify the .NET 10 SDK is installed and on PATH (required by the npx launcher)
  2. Solutions must be compilable SDK-style projects; legacy projects are skipped and listed in SkippedProjects
  3. If diagnostics with analyzers return SolutionNotTrusted, authorize the solution via trust_solution
  4. Project load timeouts (default 300s) are recorded as SkippedProjects; adjust ROSLYN_CODELENS_OPEN_PROJECT_TIMEOUT_SECONDS
  5. Docker output reports container paths, and the mounted solution must be restored
  6. If a symbol is not found, confirm the solution is loaded and active via list_solutions

Things to try

Once connected, you can ask your AI assistant things like:

  • Find all classes implementing IFoo and show the file each one lives in.
  • Analyze the exception flow of OrderService.Submit: which exceptions can escape this method?
  • Rename this method to CalculateTotal and show me a preview diff before writing anything.
  • Which public methods in my solution have no test coverage? Sort them by cyclomatic complexity.

Tools 67

find_implementations read-only
Find all classes/structs implementing an interface or extending a class
find_callers read-only
Find every call site for a method, property, or constructor
find_event_subscribers read-only
Find every += / -= site for an event symbol with resolved handler
find_tests_for_symbol read-only
List xUnit/NUnit/MSTest methods exercising a production symbol, with optional transitive walk
get_test_summary read-only
Per-project inventory of test methods with framework, attributes, data rows, and locations
find_uncovered_symbols read-only
Find public methods/properties no test reaches, sorted by cyclomatic complexity
generate_test_skeleton read-only
Emit a compilable test-class skeleton (as text) with auto-detected test framework
get_type_hierarchy read-only
Walk base classes, interfaces, and derived types
Show 59 more tools
get_di_registrations read-only
Scan for DI service registrations (generic, typeof-pair, and factory-lambda forms)
get_instantiation_options read-only
Answer 'how do I construct this type' with constructors, factories, DI registrations, and required members
get_project_dependencies read-only
Get the project reference graph
get_symbol_context read-only
One-shot context dump for any type
get_public_api_surface read-only
Enumerate every public/protected type and member in production projects
find_breaking_changes read-only
Diff the current API against a baseline JSON or DLL and report breaking changes
find_reflection_usage read-only
Detect dynamic/reflection-based usage
get_exception_flow read-only
Report exceptions that escape a method with their propagation paths
find_throw_sites read-only
Find every site an exception type is thrown, optionally including derived types
find_catch_blocks read-only
Find every catch for a type, flagging filtered, rethrowing, and swallowing handlers
find_references read-only
Find all references to a symbol, tagged with kinds like read/write/invocation
go_to_definition read-only
Find the source file and line where a symbol is defined
get_method_source read-only
Fetch full declaration source for one or many members by name in a single call
resolve_stack_trace read-only
Map a pasted .NET stack trace to file/line/symbol, undoing compiler name mangling
get_diagnostics read-only
List compiler errors, warnings, and Roslyn analyzer diagnostics
get_code_fixes read-only
Get available code fixes with structured text edits for any diagnostic
search_symbols read-only
Fuzzy workspace symbol search by name
get_nuget_dependencies read-only
List NuGet package references per project
find_attribute_usages read-only
Find types and members decorated with a specific attribute
find_obsolete_usage read-only
List every [Obsolete] call site grouped by deprecation message and severity
find_circular_dependencies read-only
Detect cycles in project or namespace dependency graphs
check_architecture read-only
Enforce layering rules against the real semantic type graph
get_complexity_metrics read-only
Report cyclomatic complexity, cognitive complexity, and max nesting depth per member
find_naming_violations read-only
Check .NET naming convention compliance
find_async_violations read-only
Detect sync-over-async, async void misuse, missing awaits, and fire-and-forget tasks
find_disposable_misuse read-only
Detect IDisposable/IAsyncDisposable instances not wrapped in using/await using
find_large_classes read-only
Find oversized types by member or line count
find_god_objects read-only
Find types combining high size with high cross-namespace coupling
find_unused_symbols read-only
Dead code detection via reference analysis with automatic filtering of tests and generated code
get_project_health read-only
Composite audit aggregating 7 quality dimensions per project
get_source_generators read-only
List source generators and their output per project
get_generated_code read-only
Inspect generated source code from source generators
inspect_external_assembly read-only
Browse types, members, and XML docs from closed-source assemblies
peek_il read-only
Decompile any method to ilasm-style IL bytecode
get_code_actions read-only
Discover available refactorings and fixes at any position
apply_code_action writes
Execute any Roslyn refactoring by title, with preview mode
rename_symbol writes
Solution-wide safe rename via Roslyn's Renamer with preview and conflict reporting
change_signature writes
Add, remove, and reorder method parameters and rewrite every call site
list_solutions read-only
List all loaded solutions and which one is currently active
set_active_solution writes
Switch the active solution by partial name
load_solution writes
Load an additional .sln/.slnx at runtime and make it active
unload_solution writes
Unload a loaded solution to free memory
rebuild_solution writes
Force a full reload of the analyzed solution
start_background_task writes
Queue a long-running tool to run in the background
get_task_status read-only
Get status, result, or error of a background task by taskId
list_running_tasks read-only
List background tasks running or completed within the last 5 minutes
trust_solution writes
Authorize a solution to run Roslyn analyzers
list_trusted_paths read-only
Inspect the persistent trust store and session-trusted solutions
revoke_trust writes
Revoke previously-granted trust for a solution path
analyze_data_flow read-only
Variable read/write/capture analysis within a statement range
analyze_control_flow read-only
Branch/loop reachability analysis within a statement range
analyze_change_impact read-only
Show all files, projects, and call sites affected by changing a symbol
get_type_overview read-only
Compound tool: type context + hierarchy + file diagnostics in one call
analyze_method read-only
Compound tool: method signature + callers + outgoing calls in one call
get_overloads read-only
Every overload of a method/constructor with full parameter detail
get_extension_methods read-only
Every extension member applicable to a type, including C# 14 extension blocks
get_operators read-only
Every user-defined and conversion operator on a type
get_call_graph read-only
Transitive caller/callee graph with depth bound and cycle detection
get_file_overview read-only
Compound tool: types in a file + file-scoped diagnostics in one call

Use cases

Give AI agents semantic navigation and call-graph analysis of .NET codebases
Perform safe solution-wide renames and signature changes
Audit code quality: complexity, naming, async misuse, dead code
Find untested public symbols via test intelligence and generate test skeletons
Inspect types and IL of closed-source NuGet dependencies

Supported clients

Claude Code
VS Code
Visual Studio

Listed from the project's documentation, not tested by this site.

Overview

Roslyn CodeLens is a Roslyn-based MCP server that gives AI agents deep semantic understanding of .NET/C# codebases over stdio. It exposes 67 tools for navigation, call graphs, diagnostics and code fixes, safe refactoring, code-quality auditing, test intelligence, DI graphs, and IL/external-assembly inspection. Installable via npm (npx launcher), NuGet (.NET global tool), Claude Code plugin, or Docker; requires the .NET 10 SDK.

Similar servers

Context7 80 · B

Upstash's official server providing up-to-date third-party library docs for AI coding assistants

★ 63.3k · Tools 2 Compare with this →

Source revision 45f6b21fdd17 Data synced 2026-10-19 Read the FMRS scoring method