Roslyn

v1.0.0Coding Agentsstable

Model Context Protocol server for Roslyn-powered C# refactoring operations

ai-toolscode-analysiscsharpdeveloper-toolsdotnet
Share:
10
Stars
0
Downloads
0
Weekly
0/5

What is Roslyn?

Roslyn is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model context protocol server for roslyn-powered c# refactoring operations

Model Context Protocol server for Roslyn-powered C# refactoring operations

This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Model Context Protocol server for Roslyn-powered C# refactor

Use Cases

Perform C# code refactoring using Roslyn compiler infrastructure.
Analyze and transform .NET code through AI assistants.
JoshuaRamirez

Maintainer

LicenseMIT
Languagec#
Versionv1.0.0
UpdatedMay 15, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx roslynmcpserver

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Roslyn

RoslynMcpServer exposes the full power of the Roslyn .NET compiler infrastructure through 41 MCP tools, enabling AI assistants to perform precise C# refactoring operations on real solution files. Tools cover renaming symbols, extracting methods and interfaces, converting to async patterns, analyzing control and data flow, finding references, and computing code metrics — all with live compiler analysis.

Prerequisites

  • .NET 8 SDK or later installed (dotnet CLI available in PATH)
  • A .NET solution file (.sln) or C# project that Roslyn can load
  • Claude Desktop or Claude Code as the MCP client
  • Windows, macOS, or Linux (all supported)
1

Install the RoslynMcp.Server global tool

Install the roslyn-mcp server as a .NET global tool. This makes the roslyn-mcp command available system-wide.

dotnet tool install -g RoslynMcp.Server
2

Verify the installation

Confirm the tool installed correctly and is on your PATH by checking the version.

roslyn-mcp --version
3

Add a project-level MCP config

Create a .mcp.json file in your project or solution root directory. Claude Code reads this automatically when you open the project.

{
  "mcpServers": {
    "roslyn-refactor": {
      "type": "stdio",
      "command": "roslyn-mcp",
      "args": []
    }
  }
}
4

Configure Claude Desktop (optional)

For Claude Desktop, add the server to claude_desktop_config.json. The config file location depends on your OS.

{
  "mcpServers": {
    "roslyn-refactor": {
      "command": "roslyn-mcp",
      "args": []
    }
  }
}
5

Restart and verify

Restart Claude and ask it to run the roslyn diagnose tool against your solution file path to confirm it can open the project.

Roslyn Examples

Client configuration

Project-level .mcp.json configuration for Claude Code, placing roslyn-mcp as a stdio server requiring no environment variables.

{
  "mcpServers": {
    "roslyn-refactor": {
      "type": "stdio",
      "command": "roslyn-mcp",
      "args": []
    }
  }
}

Prompts to try

Example prompts for refactoring, renaming, analysis, and code generation using the Roslyn tools.

- "Rename the class UserService to AccountService in C:/projects/MyApp/MyApp.sln"
- "Extract the validation logic in the Register method into a new private method called ValidateRegistrationInput"
- "Convert the GetUserAsync method to use async/await properly in C:/projects/MyApp/MyApp.sln"
- "Find all references to the IOrderRepository interface across the solution"
- "Get code metrics for the OrderProcessingService class and identify methods with high complexity"

Troubleshooting Roslyn

roslyn-mcp command not found after install

Ensure the .NET global tools directory is in your PATH. Run: dotnet tool list -g to confirm installation, then add ~/.dotnet/tools (macOS/Linux) or %USERPROFILE%\.dotnet\tools (Windows) to your PATH environment variable.

Solution file fails to load or open errors

Pass the full absolute path to the .sln file rather than a relative path. Ensure the solution targets a compatible .NET version and that all NuGet packages are restored (dotnet restore) before using the MCP tools.

Refactoring tool returns no results or empty diagnostics

Run the diagnose tool first with verbose output to confirm Roslyn can parse your solution. Ensure you are referencing the correct fully qualified type or symbol name including the namespace.

Frequently Asked Questions about Roslyn

What is Roslyn?

Roslyn is a Model Context Protocol (MCP) server that model context protocol server for roslyn-powered c# refactoring operations It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Roslyn?

Follow the installation instructions on the Roslyn GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Roslyn?

Roslyn works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Roslyn free to use?

Yes, Roslyn is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Coding Agents MCP Servers

Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "roslynmcpserver": { "command": "npx", "args": ["-y", "roslynmcpserver"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Roslyn?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides