Skip to content
MCP server

Roslyn MCP

Semantic C# analysis, navigation and preview-then-apply refactoring over Roslyn

Runs locally
Install

Roslyn MCP is an MCP server for developer tools. It runs locally on your machine and is started by your AI client.

Platforms
CLI, Windows, macOS
Runs
Locally
Version
5.1.1
Listing updated

Similar MCP servers

Install

Run in a terminal

claude mcp add roslyn-mcp -- dnx Darylmcd.RoslynMcp --yes

Add to claude_desktop_config.json

{
  "mcpServers": {
    "roslyn-mcp": {
      "command": "dnx",
      "args": [
        "Darylmcd.RoslynMcp",
        "--yes"
      ]
    }
  }
}
Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "roslyn-mcp": {
      "command": "dnx",
      "args": [
        "Darylmcd.RoslynMcp",
        "--yes"
      ]
    }
  }
}
Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to .vscode/mcp.json

{
  "servers": {
    "roslyn-mcp": {
      "type": "stdio",
      "command": "dnx",
      "args": [
        "Darylmcd.RoslynMcp",
        "--yes"
      ]
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "roslyn-mcp": {
      "command": "dnx",
      "args": [
        "Darylmcd.RoslynMcp",
        "--yes"
      ]
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "roslyn-mcp": {
      "command": "dnx",
      "args": [
        "Darylmcd.RoslynMcp",
        "--yes"
      ]
    }
  }
}

Using several servers? Build one config file with the MCP config generator.

Configuration

  • ROSLYNMCP_SANCTIONED_ROOTSServer-owned filesystem boundary for path validation and solution discovery. Path-separator-delimited (';' on Windows, ':' on macOS/Linux). '.' scopes the server to its working directory. An empty value fails closed: every path-taking tool rejects its input.

About Roslyn MCP

This server works on real .sln, .slnx and .csproj workspaces through MSBuildWorkspace, so an agent gets compiler-level answers about a C# codebase without Visual Studio. Refactoring follows a preview, then apply flow: previews return short-lived tokens, letting an agent dry-run a multi-file edit before anything changes on disk.

The README reports 171 tools (110 stable, 61 experimental), 14 resources and 20 prompts in the current release. Stable families cover workspace and session management, semantic navigation, diagnostics, build and test helpers, and the refactoring flows. Setting ROSLYNMCP_TOOL_TIERS=stable registers only the stable workflow, which helps clients that load every tool definition up front.

A filesystem boundary must be configured before first use: ROSLYNMCP_SANCTIONED_ROOTS limits which paths the tools accept, and an empty value rejects every path. Loading a solution runs MSBuild evaluation, so the README advises opening only trusted repositories or running the server in a sandbox. It needs the .NET 10 SDK.

Tools this server provides (1)

Taken from the project documentation; the running server may differ.

server_info
Returns a human-readable summary of the running server and its tool catalogue.

What it does

Roslyn semantic analysis
Answers questions about symbols, references and diagnostics from the compiler rather than text search.
Preview then apply
Refactorings return short-lived tokens so edits can be reviewed before they touch files.
Filesystem boundary
A server-owned root list restricts every path-taking tool; clients can only narrow it.
Stable and experimental tiers
Registers only the stable tool set on request to reduce the tool definitions a client loads.
Three install routes
Run as a .NET global tool, zero-install through dnx, or as a Claude Code plugin with bundled skills and safety hooks.
Self-describing catalogue
server_info and a catalog resource list the live tools and their support tiers.

Good for

  • Rename or extract code across a solution with a dry run first
  • Find all usages of a symbol in a large C# repository
  • Surface compiler diagnostics and run builds and tests from an agent
  • Give Claude Code a safe, boundary-limited view of a .NET codebase

Roslyn MCP FAQ

What do I need to run Roslyn MCP?

The .NET 10 SDK. Install with dotnet tool install -g Darylmcd.RoslynMcp, or run it on demand with dnx.

Why does every tool reject my paths?

The sanctioned-roots boundary fails closed. Set ROSLYNMCP_SANCTIONED_ROOTS, for example to a dot to scope it to the working directory.

Is Roslyn MCP safe to open any repository?

The README warns that loading a solution executes MSBuild evaluation, so only trusted repositories should be loaded, or use a sandbox.

Does Roslyn MCP need Visual Studio?

No. It uses Roslyn and MSBuildWorkspace over stdio.

How do I add Roslyn MCP to Claude Code?

Run this command in your terminal: claude mcp add roslyn-mcp -- dnx Darylmcd.RoslynMcp --yes

What are the best alternatives to Roslyn MCP?

The closest alternatives to Roslyn MCP are RoselineMCP, Roslyn Workbench MCP, KitWright Unity MCP, Agent Lsp and AIContextBuilder.

Where this comes from

  • Description: written from the project's README.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers