loading…
Search for a command to run...
loading…
Roslyn-based MCP server with 22 semantic code intelligence tools for .NET. Type hierarchies, call graphs, DI registrations, diagnostics, code fixes, complexity
Roslyn-based MCP server with 22 semantic code intelligence tools for .NET. Type hierarchies, call graphs, DI registrations, diagnostics, code fixes, complexity metrics, and more. Sub-millisecond lookups via pre-built indexes.
NuGet NuGet Downloads Build Status License Docs
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.
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.
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
dotnet tool install -g RoslynCodeLens.Mcp
Then add to your MCP client config:
{
"mcpServers": {
"roslyn-codelens": {
"command": "roslyn-codelens-mcp",
"args": [],
"transport": "stdio"
}
}
}
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.
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 |
|---|---|---|
find_circular_dependencies |
675 ns | 1.2 KB |
go_to_definition |
834 ns | 576 B |
get_project_dependencies |
883 ns | 1.3 KB |
find_implementations |
1.5 µs | 720 B |
get_symbol_context |
2.2 µs | 1000 B |
get_type_hierarchy |
2.6 µs | 1.3 KB |
get_source_generators |
4.1 µs | 7.1 KB |
analyze_data_flow |
5.8 µs | 880 B |
get_generated_code |
25 µs | 7.8 KB |
inspect_external_assembly (summary) |
27 µs | 22 KB |
find_attribute_usages |
43 µs | 832 B |
analyze_control_flow |
70 µs | 13 KB |
get_complexity_metrics |
94 µs | 6.0 KB |
find_large_classes |
100 µs | 896 B |
get_diagnostics |
104 µs | 22 KB |
get_nuget_dependencies |
124 µs | 15 KB |
get_di_registrations |
131 µs | 12 KB |
get_file_overview |
160 µs | 24 KB |
get_type_overview |
183 µs | 25 KB |
find_reflection_usage |
197 µs | 15 KB |
peek_il |
286 µs | 30 KB |
find_callers |
434 µs | 37 KB |
analyze_method |
489 µs | 37 KB |
inspect_external_assembly (namespace) |
527 µs | 268 KB |
get_code_actions |
783 µs | 50 KB |
search_symbols |
1.1 ms | 70 KB |
find_references |
2.2 ms | 197 KB |
find_unused_symbols |
2.4 ms | 201 KB |
analyze_change_impact |
2.8 ms | 235 KB |
find_naming_violations |
7.6 ms | 654 KB |
| Solution loading (one-time) | ~1.5 s | 8.8 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.
dotnet build
dotnet test
dotnet run --project benchmarks/RoslynCodeLens.Benchmarks -c Release
peek_il tool.MIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"marcelroozekrans-roslyn-codelens-mcp": {
"command": "npx",
"args": []
}
}
}