roslyn
MCP server from egorpavlikhin/roslyn-mcp
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:
- Clone or download the repository containing the Roslyn MCP server.
- Ensure you have a valid RoslynMCP.csproj path as referenced in the README example.
- Restore NuGet packages: dotnet restore
- Build the project (optional but recommended): dotnet build
- Run the server (from the repository or with the configured project path): dotnet run --project RoslynMCP/RoslynMCP/RoslynMCP/RoslynMCP.csproj
- 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
mcp-graphql
Model Context Protocol server for GraphQL
rohlik
MCP server that lets you shop groceries across the Rohlik Group platforms (Rohlik.cz, Knuspr.de, Gurkerl.at, Kifli.hu, Sezamo.ro)
runjs
The only MCP server you need: let your LLM generate and safely execute JavaScript -- including fetch API calls, JSONPath ETL, built-in resiliencey, and secrets management
gtm
An MCP server for Google Tag Manager. Connect it to your LLM, authenticate once, and start managing GTM through natural language.
packt-netops-ai-workshop
🔧 Build Intelligent Networks with AI
unity -template
Simple template project for controlling Unity via MCP