New advertisers: 50% off your first month with code FIRSTMONTHSee slots
lahma avatar

Claude Roslyn Lsp

lahma/claude-roslyn-lsp

Semantic C# access for agents: rename, references, code actions, fix-all, formatting, and diagnostics via Roslyn.

GitHub stars
1
tools
10
transport
STDIO
env vars
22
last updated
Nov 19, 2026
View on GitHub

What it does

  • Reads with resolveSymbol, findReferences, getTypeMembers, and getDiagnostics, addressing symbols by name instead of line number
  • Writes with renameSymbol, applyCodeAction, fixDiagnostics, and formatCode, each taking a preview option before changing files
  • Requires a local .NET 10 runtime, with the adapter downloading and supervising Roslyn itself on first use; the first solution load can take 20 to 46 seconds
  • Designed for C# work in Claude Code and other editors where grep-based search misses semantic renames, overrides, and cross-project references

Tools

10 tools

Public tool metadata for what this MCP can expose to an agent.

getWorkspaceStatusWhich solution is open, how far it has loaded, load errors, the projects and their target frameworks, the Roslyn build in use, and the language server's process id and working set.

Which solution is open, how far it has loaded, load errors, the projects and their target frameworks, the Roslyn build in use, and the language server's process id and working set.

No parameter schema in public metadata yet.

resolveSymbolFinds where a symbol is declared, semantically, with its hover signature and a 1-based position you can hand straight to an LSP tool.

Finds where a symbol is declared, semantically, with its hover signature and a 1-based position you can hand straight to an LSP tool.

No parameter schema in public metadata yet.

getTypeMembersLists a type's members and their signatures without reading the file, including for a type that comes from a NuGet package rather than the checkout.

Lists a type's members and their signatures without reading the file, including for a type that comes from a NuGet package rather than the checkout.

No parameter schema in public metadata yet.

findReferencesEvery semantic reference across the solution, the source line beside each one, a per-file summary, de-duplicated across target frameworks, paged.

Every semantic reference across the solution, the source line beside each one, a per-file summary, de-duplicated across target frameworks, paged.

No parameter schema in public metadata yet.

getDiagnosticsCompiler errors and warnings, and on request IDE and CA analyzer diagnostics, for a file, a project or the whole solution.

Compiler errors and warnings, and on request IDE and CA analyzer diagnostics, for a file, a project or the whole solution.

No parameter schema in public metadata yet.

getCodeActionsThe quick fixes and refactorings Roslyn offers at a position: the lightbulb list, each with a short stable id, the diagnostic ids it addresses, and the scopes its fix-all accepts.

The quick fixes and refactorings Roslyn offers at a position: the lightbulb list, each with a short stable id, the diagnostic ids it addresses, and the scopes its fix-all accepts.

No parameter schema in public metadata yet.

applyCodeActionApplies one of the code actions offered at a position, optionally across the document, the project or the whole solution.

Applies one of the code actions offered at a position, optionally across the document, the project or the whole solution.

No parameter schema in public metadata yet.

renameSymbolA solution-wide semantic rename: overrides, interface implementations, other projects. Not a search and replace, and not a file rename.

A solution-wide semantic rename: overrides, interface implementations, other projects. Not a search and replace, and not a file rename.

No parameter schema in public metadata yet.

fixDiagnosticsRoslyn's own fix-all for one diagnostic id across a file, a project or the solution.

Roslyn's own fix-all for one diagnostic id across a file, a project or the solution.

No parameter schema in public metadata yet.

formatCodeFormats with Roslyn, honouring .editorconfig, optionally organising usings.

Formats with Roslyn, honouring .editorconfig, optionally organising usings.

No parameter schema in public metadata yet.

Configuration

CLAUDE_ROSLYN_LSP_SOLUTION

Path to the .slnx, .sln or .csproj to load. Optional: the adapter discovers one from the working directory, honouring .vscode/settings.json's dotnet.defaultSolution. Set it in a monorepo, where discovery picks a solution that is often not the one being worked in. A path that does

CLAUDE_ROSLYN_LSP_ROSLYN_PATH

Directory holding an already-installed Microsoft.CodeAnalysis.LanguageServer.dll, used instead of downloading one. Optional; set it to run air-gapped or against a locally built server. Its version is not checked. Alias: CLAUDE_ROSLYN_LSP_SERVER_PATH.

CLAUDE_ROSLYN_LSP_ROSLYN_VERSION

Overrides the pinned roslyn-language-server version the adapter downloads from nuget.org. Optional; the pin is the only version this release is tested against, an override has no hash to verify against, and doctor reports it as unverified. Alias: CLAUDE_ROSLYN_LSP_SERVER_VERSION.

CLAUDE_ROSLYN_LSP_ROSLYN_ARGS

Extra arguments for the Roslyn child process, split on whitespace with no quoting. Development only: it exists so the smoke test can point the launcher at this binary's own scripted backend.

CLAUDE_ROSLYN_LSP_CACHE_DIR

Where downloaded Roslyn servers are extracted. Optional; defaults to a directory under the adapter's home. Moves the payloads only - logs and staged downloads stay under the home.

CLAUDE_ROSLYN_LSP_HOME

The adapter's per-user state directory: downloads, logs and lock files. Optional; unset, it falls back to CLAUDE_PLUGIN_DATA and then to the platform cache location (%LOCALAPPDATA%, ~/Library/Caches, $XDG_CACHE_HOME or ~/.cache). Around 140 MB extracted per Roslyn version per pla

CLAUDE_ROSLYN_LSP_OFFLINE

Set to 1 to refuse to download a Roslyn server. A missing cache entry becomes an immediate, explained failure instead of a 70 MB fetch. Accepts 1/true/yes/on and 0/false/no/off; default 0.

CLAUDE_ROSLYN_LSP_TRANSPORT

How the adapter talks to the Roslyn child process: pipe (default) or stdio. The named pipe is preferred because Roslyn writes a startup banner to its own stdout, which under stdio shares a stream with the protocol.

CLAUDE_ROSLYN_LSP_READY_TIMEOUT_SECONDS

How long a call waits for the workspace to finish loading before it is answered anyway, 1-3600, default 120. Tools report status "loading" rather than hanging while they wait.

CLAUDE_ROSLYN_LSP_DIAGNOSTICS

The pull-to-push diagnostics bridge, on by default. Applies to the lsp verb only: an MCP client asks for diagnostics with getDiagnostics instead. Accepts 1/true/yes/on and 0/false/no/off.

CLAUDE_ROSLYN_LSP_DIAGNOSTIC_MIN_SEVERITY

The severity floor applied before diagnostics are pushed to an LSP client: error, warning (default), information or hint. The MCP getDiagnostics tool takes its own minSeverity argument instead.

CLAUDE_ROSLYN_LSP_WORKSPACE_DIAGNOSTICS

Opt-in workspace-wide diagnostics for files that are not open, for the lsp verb. Off unless set, because it needs a full-solution compiler scope, which is what makes a large solution slow.

CLAUDE_ROSLYN_LSP_FILE_WATCHER

The file-watch bridge, on by default. Without it a file created by a shell command or by git never joins its project and every later answer is silently stale. Accepts 1/true/yes/on and 0/false/no/off.

CLAUDE_ROSLYN_LSP_SHARE

Whether the lsp and mcp servers share one Roslyn per solution, on by default. Off makes each of them launch a Roslyn of its own, which loads the solution twice and pays for it twice in memory. getWorkspaceStatus reports engine: owned or attached, so which of the two happened is n

CLAUDE_ROSLYN_LSP_GC

Which garbage collector the Roslyn child runs with: workstation (the default) or server. Workstation peaks at about 577 MB on a 239-project solution where server peaks at about 2 GB, and costs about 8 seconds of load time. An explicit DOTNET_gcServer in the environment wins over

CLAUDE_ROSLYN_LSP_GC_CONSERVE

The DOTNET_GCConserveMemory level, 0-9, the Roslyn child runs with: it caps how far the child's heap may grow past its live data, so less free space stays committed after a compacting collection. Default 7; 0 sets nothing. An explicit DOTNET_GCConserveMemory in the environment wi

CLAUDE_ROSLYN_LSP_IDLE_RECYCLE_MINUTES

How long the session has to be idle before a Roslyn child that has grown past its threshold is stopped to give its memory back; the next call relaunches it and waits for the reload. Default 20; 0 switches the recycle off.

CLAUDE_ROSLYN_LSP_RECYCLE_GROWTH_FACTOR

How far past its post-load baseline the Roslyn child has to have grown before an idle recycle is worth a reload: the threshold is the larger of baseline times this factor and baseline plus 512 MB. A decimal, 1.2-20, default 2.

CLAUDE_ROSLYN_LSP_IDLE_SHUTDOWN_MINUTES

Stop the Roslyn child after this many idle minutes whatever its size; the next call relaunches it. Default 0, which is off, because every relaunch costs a full solution load.

CLAUDE_ROSLYN_LSP_LOG_LEVEL

Trace, Debug, Information, Warning, Error, Critical or None (default Information). Logs go to stderr only - stdout is the JSON-RPC channel.

CLAUDE_ROSLYN_LSP_ROSLYN_LOG_LEVEL

The level handed to the Roslyn child process, default Warning. Its Information level is about twenty lines of narration per start, all of it on this adapter's stderr.

CLAUDE_ROSLYN_LSP_OPTIONS

A JSON object merged into the answers the adapter gives Roslyn's workspace/configuration requests, for the sections the defaults get wrong for your repository. A syntax error is a logged warning, never a startup failure.

Readme

claude-roslyn-lsp

Microsoft's Roslyn language server, mediated so that a coding agent can actually use it — as an LSP server for the agents that speak LSP, and as an MCP server for the refactorings LSP clients have no button for. It contains no compiler. Roslyn runs in a child process this binary downloads, launches and supervises, which is the whole design: reimplementing C# analysis is not something one person maintains, and Microsoft now publishes the real engine as a public MIT dotnet tool. The only part nobody had done is the mediation.


View the full README on GitHub

Details

Repository
github.com/lahma/claude-roslyn-lsp
Category
Developer Tools
Package
claude-roslyn-lsp
Transport
STDIO
Registry
MCP registry, active

More from lahma

All 3

Similar to Claude Roslyn Lsp

More Developer Tools