MCPRoslyn 0.1.0
{ "inputs": [ { "type": "promptString", "id": "mcproslyn_solution", "description": "Optional: pin a specific .sln/.slnx/.csproj to load instead of auto-discovery.", "password": false } ], "servers": { "MCPRoslyn": { "type": "stdio", "command": "dnx", "args": ["MCPRoslyn@0.1.0", "--yes"], "env": { "MCPROSLYN_SOLUTION": "${input:mcproslyn_solution}" } } } }
.vscode/mcp.json settings file.
dotnet tool install --global MCPRoslyn --version 0.1.0
dotnet new tool-manifest
dotnet tool install --local MCPRoslyn --version 0.1.0
#tool dotnet:?package=MCPRoslyn&version=0.1.0
nuke :add-package MCPRoslyn --version 0.1.0
MCPRoslyn
Read-only, Roslyn-powered MCP server that gives AI coding agents compiler-grade answers about C# / VB.NET solutions.
Text search can't tell you who implements an interface, which of 300 Process matches is your overload, or what's inside a NuGet assembly. Roslyn — the actual C#/VB compiler — can. MCPRoslyn puts that power behind 16 token-efficient MCP tools, strictly read-only by construction: it never writes to any analyzed file.
Highlights
- Semantic exactness:
find_referencesunderstands overloads, extension methods, aliases and partials — and never matches comments or strings. - Sees inside assemblies:
decompileshows real source for NuGet/BCL APIs (metadata-as-source via ICSharpCode.Decompiler) — no more hallucinated library APIs. - Impact analysis:
analyze_impactapplies an edit in memory, recompiles all dependent projects and reports exactly which new errors the change would introduce. Disk is never touched. - Fast diagnostics: a warm workspace re-checks code in a fraction of
dotnet buildtime. - Legacy-friendly: loads modern SDK-style projects and old .NET Framework (non-SDK)
.csproj— via the Roslyn out-of-process build hosts. - Never silently stale: a file watcher applies your edits to the in-memory solution before every query.
- Agent-first ergonomics: symbols addressed by fuzzy fully-qualified names (never line/column), counts-first paginated output, errors that name the recovery action.
Tools
| Tool | Answers |
|---|---|
search_symbols |
"Where is anything named …?" (substring + camel-hump, kind filters) |
get_symbol |
"What is X?" — signature, docs, attributes, members, overloads, locations |
find_references |
"Who uses X?" — with read/write flags for fields/properties |
find_implementations |
"Who implements/overrides/derives from X?" |
get_type_hierarchy |
Base chain + interfaces up, derived types down |
call_hierarchy |
Callers or callees, transitive to depth 3 |
get_file_outline |
Structure of a file in ~1% of its tokens |
get_usage_examples |
Real call-site examples for an API |
get_diagnostics |
Compiler (and optional analyzer) errors/warnings — file/project/solution |
get_project_graph |
Projects, references, TFMs, NuGet packages |
decompile |
Source of NuGet/BCL symbols |
find_unused |
Zero-reference symbols (with honest caveats) |
analyze_impact |
"What breaks if I change this?" — speculative in-memory edit or blast radius |
load_solution / workspace_status / ping |
Lifecycle & health |
Requirements
- .NET 10 SDK (the server runs on it, and its build host loads SDK-style projects with it)
- For legacy .NET Framework projects: Visual Studio 2022+ or Build Tools installed (Windows) — Roslyn's
net472build host uses their MSBuild - Solutions should be restored (
dotnet restore) before loading — MCPRoslyn never modifies your source or runs restore itself
Install
📖 Full step-by-step guide (every harness, exact commands, configuration): docs/INSTALL.md.
Three ways to get the server, each giving a command + args you drop into any MCP host:
| How | command | args |
|---|---|---|
From NuGet via dnx (once published; nothing to install) |
dnx |
MCPRoslyn --yes |
Global .NET tool — dotnet tool install --global MCPRoslyn |
mcp-roslyn |
(none) |
From source — dotnet build -c Release src/McpRoslyn |
dotnet |
<abs>/src/McpRoslyn/bin/Release/net10.0/McpRoslyn.dll |
Quick start for Claude Code (see the guide for VS Code / Visual Studio / GitHub Copilot Coding Agent / Codex):
# from source today; swap in `dnx MCPRoslyn --yes` once the package is on NuGet
git clone https://github.com/andrewiethoff/MCPRoslyn && cd MCPRoslyn
dotnet build -c Release src/McpRoslyn
claude mcp add --scope user roslyn -- dotnet "$PWD/src/McpRoslyn/bin/Release/net10.0/McpRoslyn.dll"
On startup the server auto-discovers the solution at/above the working directory (Claude Code's project dir; other hosts' current folder) and loads it in the background — no configuration needed in the common case. To pin one explicitly set MCPROSLYN_SOLUTION=<path>, switch at runtime with the load_solution tool, or disable auto-load with MCPROSLYN_AUTOLOAD=0. Details in docs/INSTALL.md.
What it deliberately does NOT do
- No editing, no refactoring, no shell — read-only by construction; your agent's own tools do the writing. (One documented exception to code execution:
get_diagnosticswithinclude_analyzers=trueruns the project's third-party Roslyn analyzer assemblies in-process. It is off by default and stays opt-in; MCPRoslyn itself still never writes to your files.) - No file reading/grep duplicates — your agent already has better ones; MCPRoslyn only adds what grep can't do.
- No embeddings/semantic search — evidence for code is mixed; exact symbol search + your agent's grep covers most of it.
- Reflection/DI-container/dynamic dispatch resolution — impossible statically; tools state this caveat instead of guessing.
- F# / C++ — not Roslyn languages. C# and VB.NET only.
Architecture notes
MSBuildWorkspacewith out-of-process build hosts (Roslyn 5.6):dotneton PATH loads SDK-style projects, an installed VS/Build Tools MSBuild loads legacy.csproj.Microsoft.Build.Locatoris not used.- The workspace is an immutable snapshot; a
FileSystemWatcherfeeds edits throughSolution.WithDocumentTextlazily before each query — one file re-parse, downstream-only recompilation. Watch roots cover every loaded document's directory, so linked/shared files declared outside a project folder stay in sync. - Multi-targeted projects appear once per TFM;
find_*/searchresults are deduplicated by physical declaration identity (so distinct projects that share a fully-qualified name are not collapsed), andget_diagnostics/analyze_impactcompile every target framework so a TFM-specific break is not missed. - Reference-assembly decompilation transparently falls back to the runtime implementation assembly (
System.Private.CoreLibetc.) so BCL bodies are real, notthrow nullstubs.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 149 | 7/7/2026 |