Get the FREE Ultimate OpenClaw Setup Guide →

RoslynMcpServer

MCP server from BeinerChes/RoslynMcpServer

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio beinerches-roslynmcpserver RoslynMcpServer.exe \
  --env CLAUDE_CODE_CLI="path/to/claude-code-cli" \
  --env DOTNET_PROVIDER_OVERRIDE_DEFAULT="1"

How to use

RoslynMcpServer is an MCP server that provides semantic C# code understanding using the Roslyn compiler. It exposes tools to read, analyze, and modify code within a per-solution context, enabling Claude Code to operate with type- and symbol-aware capabilities instead of plain text edits. Core capabilities include locating symbols, reading method bodies, applying targeted edits, and performing broad code analyses with diagnostics. If you enable the optional SharpTinyCoder plugin, the server can also generate and refine code using a local AI model trained on your repository, with corrections being fed back as training data for future improvements.

To use the server, deploy it per-solution and connect Claude Code to the solution via the generated .roslyn-mcp configuration. The most commonly used tools are GetMethodBody to retrieve a method's source by type and name, FindSymbol for semantic symbol search, UpdateMethod to modify a method, AddMember to inject new members into a class, and RenameSymbol to apply cross-solution refactors. For analysis tasks, GetDiagnostics runs the compiler to surface errors and warnings, and FindDeadCode helps identify unused methods. The complete tool set is documented under docs/tools/ in the repository.

How to install

Prerequisites:

  • .NET 10 SDK
  • Claude Code CLI
  • Windows (GPU-accelerated fine-tuning requires CUDA; CPU inference works everywhere)

Build and publish (two options):

Base install (Roslyn tools only, no AI code generation):

git clone https://github.com/BeinerChes/RoslynMcpServer
cd RoslynMcpServer
dotnet publish src/RoslynMcpServer/RoslynMcpServer.csproj -c Debug -o .roslyn-mcp

With SharpTinyCoder plugin (AI code generation + LoRA fine-tuning):

git clone https://github.com/BeinerChes/RoslynMcpServer
cd RoslynMcpServer
dotnet publish src/RoslynMcpServer.CodeGen/RoslynMcpServer.CodeGen.csproj -c Debug -o .roslyn-mcp

Notes:

  • You must use dotnet publish, not dotnet build. Native CUDA DLLs for SharpTinyCoder are only copied during publish.
  • The base install is ~313MB; the full install with AI plugin is ~4.9GB due to CUDA libraries and model files.

Deploy to your solution:

# 1. Copy the published server into your solution's root
xcopy /E /I .roslyn-mcp  D:\path\to\YourSolution\.roslyn-mcp

# 2. From your solution directory, run init
cd D:\path\to\YourSolution
.roslyn-mcp\RoslynMcpServer.exe --init

The --init step creates the .mcp.json pointing to the server, a CLAUDE.md template, updates .gitignore, and can enable hooks and skills interactively.

To start the server in a running solution, simply execute the server binary (for Windows):

cd D:\path\to\YourSolution
.roslyn-mcp\RoslynMcpServer.exe --init

Additional notes

Tips and common issues:

  • The server is per-solution; keep each solution in its own .roslyn-mcp directory to ensure isolation of knowledge bases and model data.
  • SharpTinyCoder is optional. If not installed, AI-assisted generation and finetuning features will be unavailable, but Roslyn-based analysis and editing will work as normal.
  • Hooks enforce Roslyn-based operations. If a tool call is blocked, verify that your command or tool usage adheres to Roslyn tools (e.g., avoid text-based edits on .cs files).
  • Environment variables can customize paths to CLAUDE tools or model data; ensure paths exist and are accessible by the server process.
  • The server exposes 24 tools across 6 categories; consult docs/tools for a complete reference. Common tasks include GetMethodBody, FindSymbol, UpdateMethod, AddMember, RenameSymbol, GetDiagnostics, and FindDeadCode.

Related MCP Servers

Sponsor this space

Reach thousands of developers