Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
Roslyn-based MCP server giving AI agents deep semantic understanding of .NET/C# codebases — 67 tools for navigation, call graphs, diagnostics & code fixes, safe refactoring, code-quality auditing, test intelligence, DI graphs, and IL/external-assembly inspection.
Jump to setup instructionsNo tool list is on record. This does not mean the server has no tools. Tools were not run.
No setup evidence yet No matching config or report on record. This does not mean the server is incompatible.
Same catalog task: Write & edit code.
Model Context Protocol integration for CodeIndexer
Same catalog task: Write & edit code.
MCP server for ESLint
Same catalog task: Write & edit code.
MCP session management for Metorial. Provides session handling and tool lifecycle management for Model Context Protocol.
Fetched from the repository for this visit.
A Roslyn-based MCP server that gives AI agents deep semantic understanding of .NET codebases — type hierarchies, call graphs, DI registrations, diagnostics, refactoring, and more.
A hosted deployment is available on Fronteir AI.
viaDispatch: truefind_uncovered_symbolsAddSingleton<IFoo, Foo>()), single-generic, typeof pair and factory-lambda formsrequired members. Pass fromProject to learn whether that project can actually reach each option — it honours InternalsVisibleTo, so it answers "can my test project call this internal constructor?"read, write, readwrite, invocation, method_group, object_creation, cast, type_check, typeof, base_type, type_constraint, type_argument, declaration, attribute, nameof, xml_doc) and reported per occurrence with a column; filter server-side with kinds (e.g. ["write","readwrite"] for mutation sites)ok/notFound/ambiguous/metadata/unsupportedKind) so a batch never fails wholesale[Obsolete] call site grouped by deprecation message and severity, errors first; for planning migrationsforbid and allowOnly) against the real semantic type graph rather than using directives; violations are grouped per boundary with a reference count and example sitesmetric picks which one the threshold and sort use — cognitive is the better refactoring-priority signal, cyclomatic the better test-budget oneasync void misuse, missing awaits, fire-and-forget tasks; per-violation report with severityIDisposable/IAsyncDisposable instances not wrapped in using/await using/returned/assigned to field; severity error/warning per violation. Tasks are not reported, since a task needs no disposing.summary.filteredOutparams and extension methods, reports the overrides and interface implementations it cascaded to, and warns about record properties, deconstructions and positional patterns the rewrite does not reachactivate: false to load it without switchingrebuild_solution) to run in the background; returns a taskId to polltaskId. Optional waitSeconds (default 0, capped at 50) waits on the server until the task finishes instead of pollingget_diagnostics with includeAnalyzers: true)extension blocks including properties and static membersAll list-returning tools wrap their results in a uniform envelope:
{
"items": [ ... ],
"totalCount": 142,
"truncated": false,
"limit": 500,
"summary": { ... }
}
When truncated is true, the items are the top N by the tool's natural sort order (severity-first, worst-first, by-project, etc.) — usually that's exactly what you want. Raise limit only if the missing tail items matter for the task.
Tools that include a summary aggregate today:
get_diagnostics — { error, warning, info, hidden } countsfind_references — { byProject: { name: count }, byKind: { kind: count } }find_callers, find_attribute_usages — { byProject: { name: count } }search_symbols, find_reflection_usage — { byKind: {...} }find_unused_symbols — { byKind, filteredOut: { testMethod, testContainer, mcpTool, generated, composition, interop } }find_naming_violations — { byRule: {...} }get_complexity_metrics — { max, avg, overThreshold, maxCognitive } (the first three describe the selected metric)Single-object tools (get_type_overview, get_symbol_context, apply_code_action, etc.) return their bespoke shape directly — the envelope only wraps list-returning tools.
When a tool can't proceed (symbol not resolved, solution not trusted, file not found, ambiguous match, etc.), the response is an isError: true content block carrying a structured JSON body:
{
"code": "SolutionNotTrusted",
"message": "Solution 'Foo.sln' is not trusted for analyzer execution. ...",
"details": { "solutionPath": "C:\\Foo.sln" }
}
Error codes (switch on code to handle each):
SymbolNotFound — type / method / property could not be resolved.SolutionNotTrusted — get_diagnostics or get_code_fixes requested analyzers but the solution hasn't been authorized via trust_solution.AmbiguousMatch — set_active_solution, unload_solution or a tool's solution argument matched multiple solutions; details.matches lists them.FileNotFound — file path or baseline doesn't exist (or isn't in any loaded project).ProjectNotFound — the name given to set_active_solution, unload_solution or a tool's solution argument didn't match any loaded solution.InvalidArgument — caller-supplied input was malformed, unsupported, or out of range.Internal — unexpected error not modeled above; message carries the underlying exception text.Cancellation: the MCP framework's native cancellation is honored. Cancelling a tools/call request mid-flight terminates the operation; long-running tools (get_diagnostics with analyzers, get_code_actions, apply_code_action, get_code_fixes) check the token at hot-loop boundaries.
Metadata-origin symbols (from NuGet packages and referenced assemblies) are first-class citizens:
find_references, find_callers, find_implementations): Accepts closed-source type and member names. Resolves them from assembly metadata and reports all source-level usage sites.inspect_external_assembly): Browse namespaces, types, members, and XML doc comments from any referenced assembly without decompiling.peek_il): Decompile a specific method to annotated ilasm-style IL using ICSharpCode.Decompiler — useful for understanding the internals of NuGet libraries.Location-returning results include an Origin field (source or metadata) and an IsGenerated flag to distinguish hand-written code from closed-source or generated output.
ROSLYN_CODELENS_OPEN_PROJECT_TIMEOUT_SECONDS — per-project MSBuild load timeout (default 300). When a project exceeds this duration during workspace open, it's recorded as a SkippedProjects entry with kind: "Timeout" and the rest of the solution still loads. Useful when a legacy or malformed project wedges the BuildHost-net472 subprocess.get_diagnostics and get_code_fixes can load Roslyn analyzers — DLLs that execute in-process. To prevent untrusted analyzers from running automatically, this server uses a VS/Rider-style trust model:
trust_solution MCP tool.bin/obj. Other paths are skipped.Use the list_trusted_paths and revoke_trust tools to inspect and manage trust state. Persistent trust is stored at %APPDATA%\roslyn-codelens\trust.json.
See SECURITY.md for the full threat model.
{
"mcpServers": {
"roslyn-codelens": {
"type": "stdio",
"command": "npx",
"args": ["-y", "roslyn-codelens-mcp"]
}
}
}
The npm package ships no server code — it is a launcher that installs the RoslynCodeLens.Mcp
.NET global tool at a matching version and execs it, so the .NET 10 or 11 SDK must be on PATH.
Subsequent starts skip the install entirely and work offline.
Add to your MCP settings (.vscode/mcp.json or VS settings):
{
"servers": {
"roslyn-codelens": {
"type": "stdio",
"command": "dnx",
"args": ["RoslynCodeLens.Mcp", "--yes"]
}
}
}
claude install gh:MarcelRoozekrans/roslyn-codelens-mcp
The plugin needs only the .NET 10 or 11 SDK: it runs the server through dnx, pinned to the
plugin's version, so there is no global tool to install or keep up to date.
dotnet tool install -g RoslynCodeLens.Mcp
Then add to your MCP client config:
{
"mcpServers": {
"roslyn-codelens": {
"command": "roslyn-codelens-mcp",
"args": [],
"transport": "stdio"
}
}
}
Runs without a .NET SDK on the host; the solution is bind-mounted at /workspace.
docker build -t roslyn-codelens-mcp .
docker run -i --rm -v "$PWD:/workspace" roslyn-codelens-mcp
The mounted solution must be restored for MSBuildWorkspace to resolve its
references, and tool output reports container paths rather than host paths — see
docs/site/docs/getting-started/docker.md.
The server automatically discovers .sln files by walking up from the current directory. You can also pass one or more solution paths directly:
# Single solution
roslyn-codelens-mcp /path/to/MySolution.sln
# Multiple solutions — switch between them with set_active_solution
roslyn-codelens-mcp /path/to/A.sln /path/to/B.sln
When multiple solutions are loaded, use list_solutions to see what's available and set_active_solution("B") to switch context. The first path is active by default.
The active solution is shared by every caller. When several agents use one server, each on its own
solution, pass solution on each call instead of switching. Every tool that works on a solution
accepts it. It is matched by absolute path first, then by exact file name, then by a case-insensitive
substring, the same way set_active_solution matches. A name that matches nothing fails with
ProjectNotFound, and a name that matches several fails with AmbiguousMatch. Neither falls back
to the active solution.
load_solution(path: "/repos/orders/Orders.sln", activate: false)
find_callers(symbol: "OrderService.Submit", solution: "Orders.sln")
load_solution with activate: false loads a solution without changing the active one. If no
solution is active yet, it becomes active anyway.
By default the server speaks stdio. Pass --http to expose the same tools over
streamable HTTP instead — useful for
one long-lived server (warm Roslyn workspace, no per-client startup cost) shared by several
local MCP clients:
roslyn-codelens-mcp /path/to/MySolution.sln --http # http://127.0.0.1:3001
roslyn-codelens-mcp /path/to/MySolution.sln --http --port 8080
{
"mcpServers": {
"roslyn-codelens": {
"type": "http",
"url": "http://127.0.0.1:3001"
}
}
}
The HTTP endpoint binds to 127.0.0.1 only and is intended for single-user, local use: all
connected clients share the same solution state (set_active_solution affects everyone; pass
solution per call to avoid that, see Parallel agents on one server), and
there is no authentication. --host can widen the binding, but the server will warn — its tools
can read and modify source files, so only do this on networks you fully trust.
Pass --tools with a comma-separated list of tool names to register only those tools. The others
are not listed by tools/list and cannot be called. This keeps the tool descriptions an agent has
to load small, and it keeps tools such as the refactoring tools away from agents that should only
navigate. Unlike the tool picker of an MCP client, the restriction travels with the server
configuration. The option may be repeated; an unknown name stops the server with an error.
{
"mcpServers": {
"roslyn-codelens": {
"command": "roslyn-codelens-mcp",
"args": ["/path/to/MySolution.sln", "--tools", "find_references,find_callers,go_to_definition"]
}
}
}
All type lookups use pre-built reverse inheritance maps, member indexes, and attribute indexes for O(1) access. Benchmarked on an i9-12900HK with .NET 10.0.7:
| Tool | Latency | Memory |
|---|---|---|
go_to_definition | 2.1 µs | 576 B |
find_implementations | 2.5 µs | 720 B |
get_project_dependencies | 2.8 µs | 1.5 KB |
get_type_hierarchy | 3.5 µs | 1.3 KB |
find_circular_dependencies | 3.7 µs | 2.7 KB |
get_symbol_context | 4.1 µs | 1.0 KB |
get_source_generators | 16 µs | 23 KB |
analyze_data_flow | 19 µs | 1.6 KB |
find_attribute_usages | 72 µs | 904 B |
get_generated_code | 78 µs | 24 KB |
analyze_control_flow | 115 µs | 14 KB |
inspect_external_assembly (summary) | 159 µs | 35 KB |
find_large_classes | 265 µs | 3.5 KB |
get_di_registrations | 478 µs | 16 KB |
inspect_external_assembly (namespace) | 564 µs | 259 KB |
find_reflection_usage | 705 µs | 19 KB |
get_complexity_metrics | 781 µs | 25 KB |
get_code_actions | 792 µs | 54 KB |
get_file_overview | 797 µs | 101 KB |
get_diagnostics | 822 µs | 99 KB |
get_nuget_dependencies | 849 µs | 48 KB |
get_public_api_surface | 885 µs | 247 KB |
get_type_overview | 1.1 ms | 104 KB |
peek_il | 1.1 ms | 34 KB |
find_disposable_misuse | 3.5 ms | 286 KB |
find_uncovered_symbols | 3.8 ms | 224 KB |
search_symbols | 3.9 ms | 557 KB |
analyze_method | 5.8 ms | 333 KB |
find_async_violations | 7.0 ms | 335 KB |
find_tests_for_symbol (direct) | 8.4 ms | 396 KB |
find_callers | 10 ms | 337 KB |
find_tests_for_symbol (transitive) | 12 ms | 399 KB |
find_naming_violations | 15 ms | 788 KB |
find_unused_symbols | 23 ms | 1.0 MB |
find_references | 28 ms | 1013 KB |
analyze_change_impact | 33 ms | 1.3 MB |
| Solution loading (one-time) | ~4.1 s | 16 MB |
The server watches .cs, .csproj, .props, and .targets files for changes. When a change is detected, affected projects are lazily re-compiled on the next tool query — only stale projects and their downstream dependents are re-compiled, not the full solution.
Location-returning tools include an IsGenerated flag to distinguish source-generator output from hand-written code.
The server analyses every project that MSBuildWorkspace can load under the .NET SDK runtime.
SDK-style projects (<Project Sdk="...">) can target any .NET version, including net48, net8.0, and net10.0.
Legacy non-SDK-style .NET Framework projects are attempted during a full solution load on Windows. Install Visual Studio or Visual Studio Build Tools with MSBuild and the project's .NET Framework targeting pack.
Legacy projects are skipped on other platforms, during filtered loads, and when the full solution load falls back to per-project loading. Projects MSBuild cannot load are reported in list_solutions under SkippedProjects and summarised by load_solution.
dotnet build
dotnet test
dotnet run --project benchmarks/RoslynCodeLens.Benchmarks -c Release
peek_il tool.Roslyn CodeLens MCP is part of a small family of .NET projects for AI work:
IChatClient: prompt injection, hallucination and PII detection with an audit trail.Roslyn CodeLens MCP uses these ZeroAlloc libraries, which are source generators and analyzers with no reflection at runtime:
MIT
Loading reviews...
GitHub checked 136h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.