# Roslyn MCP

> Roslyn MCP is an MCP server for developer tools. Semantic C# analysis, navigation and preview-then-apply refactoring over Roslyn. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Platforms:** CLI, Windows, macOS, Linux
- **Repository:** https://github.com/darylmcd/roslyn-backed-mcp
- **MCP Registry name:** io.github.darylmcd/roslyn-mcp
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-15

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

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

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

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

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

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

## Tools

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

## 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.

## Alternatives

- [RoselineMCP](https://ai-powered.com/mcp/roselinemcp): RoselineMCP is an open-source MCP server for developer tools.
- [Roslyn Workbench MCP](https://ai-powered.com/mcp/roslyn-workbench-mcp): Roslyn Workbench MCP is an open-source MCP server for developer tools.
- [KitWright Unity MCP](https://ai-powered.com/mcp/kitwright-unity-mcp): KitWright Unity MCP is an open-source MCP server for developer tools.
- [Agent Lsp](https://ai-powered.com/mcp/agent-lsp): Agent Lsp is an open-source MCP server for developer tools.
- [AIContextBuilder](https://ai-powered.com/mcp/aicontextbuilder): AIContextBuilder is a freemium MCP server for developer tools.
- [Codelens MCP](https://ai-powered.com/mcp/codelens-mcp): Codelens MCP is an open-source MCP server for developer tools.
- [Sonarqube MCP](https://ai-powered.com/mcp/sonarqube-mcp-2): Sonarqube MCP is an open-source MCP server for developer tools.
- [mcpls](https://ai-powered.com/mcp/mcpls): mcpls is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/roslyn-mcp
