MCP server for C# code analysis and manipulation using Roslyn compiler APIs. Provides tools for reading, searching, analyzing, and modifying C# source files with workspace-aware symbol resolution.
RoslynMcp provides two read-only analysis tools with detailed, domain-specific descriptions (roslyn_check_drift: 1,247 chars; roslyn_check_syntax: 1,089 chars). Both tools have complete input schemas with typed parameters and descriptions. However, output schemas are not documented in the visible code, the tool definitions show input parameters but no explicit return type documentation. The server includes a custom analyzer (ToolDescriptionAnalyzer) that enforces description completeness at compile time, demonstrating strong quality discipline. Parameter naming is clear and verb-driven (check_drift, check_syntax). No security issues detected (read-only operations, no secrets). Main gaps: output schemas undocumented, no error handling guidance in descriptions, and limited tool composition (only 2 tools for a narrow domain).
Workspace health probe — the tool to reach for when symbol results look wrong or stale, or when roslyn_get_diagnostics reports errors you do not believe. Checks three independent axes. (1) Source drift: files whose on-disk state changed without the workspace noticing — a FileSystemWatcher miss (network drives, event buffer overflow, excluded directories). A healthy workspace reports drifted: false; changes made within the last ~2 seconds may still be syncing and are not reported. (2) Reference health: workspace_healthy is false when a project loaded with zero metadata references, which happens when a contended MSBuild design-time build silently drops them. That state makes symbol results wrong-but-plausible and makes roslyn_get_diagnostics report phantom CS0246/CS0234 errors for code that builds fine — source can be perfectly in sync while this is broken. (3) Pending reload: reload_pending is true when a change could not be applied incrementally and the reload servicing it has not finished — the workspace is behind disk. This is the only axis that can account for a newly added file, because drifted_files is built from documents the workspace already has and a brand-new file is not one of them. Any of these is fixed by roslyn_respawn; drift alone can also be cleared by re-saving the files through roslyn editing tools. last_unhealthy_load is present when a dropped-reference load happened at any point, even if the workspace has since recovered.
Call this BEFORE roslyn_replace_in_code or roslyn_write_file to catch syntax (and optionally semantic) errors in a C# snippet without touching disk — saves a write round-trip on bad code. Returns valid (bool), error_count, warning_count, and items with line, column, code, and message. Line numbers correspond to positions in the original snippet (not the wrapped source). By default (wrapInClass: true), the snippet is wrapped in a dummy class so member declarations and method bodies are valid inputs without a surrounding class. Pass wrapInClass: false when the snippet is a complete class, namespace, or compilation unit, or when it contains using directives or namespace declarations (which are invalid inside a class body). By default (includeSemantics: false), only syntax is checked — fast, no workspace loaded. Set includeSemantics: true to use the full project compilation so the snippet is checked against project-defined types, global usings, and all referenced assemblies.
Output schemas not documented. Tool descriptions explain inputs but do not specify return fields, types, or structure. LLMs cannot plan downstream operations without knowing what fields to extract.
No error handling guidance. Descriptions do not explain what errors can occur, how to recover, or when to retry. E.g., roslyn_check_syntax does not document what happens if projectPath is invalid or if semantic analysis fails.
Limited tool composition. Only 2 tools in the server, both read-only analysis. No tools for code modification, file writing, or workspace management. Agents cannot complete end-to-end workflows (e.g., validate syntax, then write corrected code).
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 69 | 2026-07-28+ | v2 |
Parameter constraints not fully specified. roslyn_check_syntax has wrapInClass and includeSemantics boolean flags with defaults, but no guidance on when to use each combination or what semantic analysis costs (latency, resource usage).
projectPath parameter accepts both .csproj and .sln files but does not document the behavioral differences or which is preferred. LLMs may pass the wrong file type without guidance.