Command Palette

Search for a command to run...

UnylyUnyly
Browse all

Roslyn C# Analyzer

FreeNot checked

Provides C# code analysis capabilities by leveraging the Microsoft Roslyn compiler platform to validate syntax, find references, and run recommended code analyz

GitHubEmbed

About

Provides C# code analysis capabilities by leveraging the Microsoft Roslyn compiler platform to validate syntax, find references, and run recommended code analyzers within .NET projects.

README

Overview

A Model Context Protocol (MCP) server that provides C# code analysis capabilities using the Roslyn compiler platform. This tool helps validate C# files, find symbol references, and perform static code analysis within the context of a .NET project.

Features

  • Code Validation: Analyze C# files for syntax errors, semantic issues, and compiler warnings
  • Symbol Reference Finding: Locate all usages of a symbol across a project
  • Project Context Analysis: Validate files within their project context
  • Code Analyzer Support: Run Microsoft recommended code analyzers

Tools

  • ValidateFile: Validates a C# file using Roslyn and runs code analyzers
  • FindUsages: Finds all references to a symbol at a specified position

Example config

{
    "servers": {
        "RoslynMCP": {
            "type": "stdio",
            "command": "dotnet",
            "args": [
                "run",
                "--no-build",
                "--project",
                "E:/Source/roslyn-mcp/RoslynMCP/RoslynMCP/RoslynMCP.csproj"
            ]
        }
    }
}

Example prompt

When done implementing changes, run these validation steps as human will not accept work unless these are done:
- Always use Roslyn validation tool on C# (.cs) files

Getting Started

  1. Build the project
  2. Run the application with:
    dotnet run
    
  3. The server will start and listen for MCP commands via standard I/O

Requirements

  • .NET SDK
  • MSBuild tools
  • NuGet packages for Roslyn analyzers (automatically loaded if available)

Example Usage

Validate a C# file:

ValidateFile --filePath="/path/to/your/file.cs" --runAnalyzers=true

Find all usages of a symbol:

FindUsages --filePath="/path/to/your/file.cs" --line=10 --column=15

Technical Details

  • Uses Microsoft.CodeAnalysis libraries for code analysis
  • Integrates with MSBuild to load full project context
  • Supports standard diagnostic analyzers
  • Includes detailed output with syntax, semantic, and analyzer diagnostics

from github.com/egorpavlikhin/roslyn-mcp

Installing Roslyn C# Analyzer

This server has no published package — it is built from source. Open the repository and follow its README.

▸ github.com/egorpavlikhin/roslyn-mcp

FAQ

Is Roslyn C# Analyzer MCP free?

Yes, Roslyn C# Analyzer MCP is free — one-click install via Unyly at no cost.

Does Roslyn C# Analyzer need an API key?

No, Roslyn C# Analyzer runs without API keys or environment variables.

Is Roslyn C# Analyzer hosted or self-hosted?

Self-hosted: the server runs locally on your machine via the install command above.

How do I install Roslyn C# Analyzer in Claude Desktop, Claude Code or Cursor?

Open Roslyn C# Analyzer on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.

Related MCPs

Compare Roslyn C# Analyzer with

Not sure what to pick?

Find your stack in 60 seconds

Author?

Embed badge for your README

Browse similar

All development MCPs