# Roslyn CodeLens

This MCP server gives agents Roslyn-based insight into .NET code, from symbol relationships to diagnostics and fixes. Use it to navigate a codebase, inspect tests, or review API changes.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 68
- Author: MarcelRoozekrans
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/MarcelRoozekrans/roslyn-codelens-mcp
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/roslyn-codelens

## What it does

Roslyn CodeLens lets an agent inspect .NET code with semantic context. It can locate interface implementations, method callers, and symbol references, then show type hierarchies, DI registrations, and compiler or analyzer diagnostics with available fixes. It can also trace exceptions through methods or map a .NET stack trace to source locations.

For test work, the server finds tests that exercise a symbol, summarizes test methods, and identifies public methods and properties that tests do not reach. It can draft a test-class skeleton for xUnit, NUnit, or MSTest. The result is text, not a finished test; constructor dependencies appear as TodoNotes.

API review tools list the public surface and compare it with a baseline JSON file or DLL. The server can be added to Claude Code with `npx`. Its semantic analysis is aimed at .NET code, so it is not a general-purpose code intelligence server for unrelated languages.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add roslyn-codelens -- npx -y roslyn-codelens-mcp
```

### Codex

**Platform CLI**
```bash
codex mcp add roslyn-codelens -- npx -y roslyn-codelens-mcp
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "roslyn-codelens": {
            "command": "npx",
            "args": [
                "-y",
                "roslyn-codelens-mcp"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "roslyn-codelens": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "roslyn-codelens-mcp"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add roslyn-codelens npx -y roslyn-codelens-mcp
```

## When to use it
- locate implementations of an interface or base class
- trace calls to a method across the project
- find public members that tests do not reach
- compare the public API against a baseline
- inspect compiler diagnostics and available fixes

## Example prompts
- Find every implementation of `IOrderService` and show where each one is defined.
- Check which tests exercise `CalculateTotal` and identify public methods that tests do not reach.
- Compare the current public API with the baseline DLL and report breaking changes.

## Similar
- [Serena MCP: the IDE for your agent](https://affpapa.org/en/nevibecode/mcp/serena-mcp-the-ide-for-your-agent.md) — MCP server · ★ 30677
- [Compiler Explorer](https://affpapa.org/en/nevibecode/mcp/compiler-explorer.md) — MCP server · ★ 19148
- [Claude Code Explorer MCP](https://affpapa.org/en/nevibecode/mcp/claude-code-explorer-mcp.md) — MCP server · ★ 6235
- [Tolgee](https://affpapa.org/en/nevibecode/mcp/tolgee.md) — MCP server · ★ 4139
- [jshookmcp](https://affpapa.org/en/nevibecode/mcp/jshookmcp.md) — MCP server · ★ 2061
- [pyscn](https://affpapa.org/en/nevibecode/mcp/pyscn.md) — MCP server · ★ 1096

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
