Get the FREE Ultimate OpenClaw Setup Guide →

roslyn

MCP server from egorpavlikhin/roslyn-mcp

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio egorpavlikhin-roslyn-mcp dotnet run --no-build --project E:/Source/roslyn-mcp/RoslynMCP/RoslynMCP/RoslynMCP.csproj

How to use

This Roslyn-based MCP server exposes C# code analysis capabilities via the MCP protocol. It leverages the Roslyn compiler platform to validate C# files, locate symbol usages across a project, and analyze code within the full project context, including support for Microsoft code analyzers. Two primary tools are exposed: ValidateFile for syntax, semantic, and analyzer checks, and FindUsages to locate all references to a symbol at a given position. To use it, configure an MCP client to connect via standard I/O (stdio) to the server (as shown in the example config), then issue commands like ValidateFile and FindUsages with the appropriate parameters. The server runs a .NET project; running dotnet run will start the MCP server process, which listens for MCP commands over stdio.

How to install

Prerequisites:

  • .NET SDK (compatible with Roslyn and the target project)
  • MSBuild tools (often included with the .NET SDK)
  • NuGet packages for Roslyn analyzers (typically restored automatically via the project)

Installation steps:

  1. Clone or download the repository containing the Roslyn MCP server.
  2. Ensure you have a valid RoslynMCP.csproj path as referenced in the README example.
  3. Restore NuGet packages: dotnet restore
  4. Build the project (optional but recommended): dotnet build
  5. Run the server (from the repository or with the configured project path): dotnet run --project RoslynMCP/RoslynMCP/RoslynMCP/RoslynMCP.csproj
  6. Connect an MCP client using the stdio protocol and issue commands like ValidateFile and FindUsages.

Additional notes

Notes and tips:

  • The server uses Microsoft.CodeAnalysis (Roslyn) to perform code analysis and analyzers; ensure your project includes any required analyzers via NuGet.
  • The example config uses an absolute path to RoslynMCP.csproj; adjust the path to your environment if needed.
  • If you encounter client-server communication issues, verify the MCP protocol version compatibility and that the server process is running and listening on stdio.
  • You can customize or extend the MCP server by integrating additional Roslyn capabilities (e.g., additional analyzers or code fixes) as needed.
  • Ensure your .NET project references the necessary Roslyn packages for full diagnostics and analyzer support.

Related MCP Servers

Sponsor this space

Reach thousands of developers