Roslyn-Backed MCP Server
Local-first MCP server for semantic C# analysis, navigation, validation, and refactoring using Roslyn on real .NET workspaces.
README
Roslyn-Backed MCP Server
Local-first MCP (Model Context Protocol) server for semantic C# analysis, navigation, validation, and refactoring on real .sln / .slnx / .csproj workspaces. It uses Roslyn and MSBuildWorkspace, runs over stdio, and does not require Visual Studio.
Correct package ID:
Darylmcd.RoslynMcp· CLI:roslynmcp· Plugin:roslyn-mcp@roslyn-mcp-marketplace
What It Does
- Loads real C# solutions and projects with session-scoped
workspaceIds. - Exposes semantic navigation, diagnostics, build/test helpers, and preview/apply refactoring workflows over MCP.
- Ships as a .NET global tool, a Claude Code plugin, and a source-buildable stdio host.
- Publishes the authoritative live surface through
server_infoandroslyn://server/catalog.
Why Roslyn-Backed MCP
- No Visual Studio dependency — runs anywhere the .NET SDK runs (Windows, macOS, Linux, containers, CI).
- Production ops discipline — repeatable CI mirror (
just ci), release verification scripts, and a documented two-layer update story for the global tool and the Claude Code plugin. - Safe install defaults — no
${user_config.*}placeholder substitution that breaks prompt-skipping install flows; the server starts with compiled-in defaults and accepts literal overrides via project-scope.mcp.json. - Authoritative live surface — every release publishes
server_info+roslyn://server/catalogso clients can discover the exact tool/resource/prompt set and support tier (stable vs experimental) without guessing. - Preview → apply discipline — refactoring tools issue preview tokens with TTLs and a verify step before mutating the workspace, so agents can dry-run multi-file edits.
- Three install paths — pick one: global tool (
dotnet tool install), zero-install viadnx(.NET 10), or the Claude Code plugin.
Quick Start
Prerequisites
- .NET 10 SDK — pinned to
10.0.100inglobal.json(rollForward: latestFeature)
Option A — Install As A Global Tool
dotnet tool install -g Darylmcd.RoslynMcp
- Package ID:
Darylmcd.RoslynMcp - CLI command:
roslynmcp - Updates:
dotnet tool update -g Darylmcd.RoslynMcp
Option B — Zero-Install Via dnx (.NET 10)
dnx is the .NET SDK's npx-equivalent: it resolves a tool package from NuGet on demand, without installing a global shim. Requires .NET 10 SDK Preview 6 or later (dnx ships with the SDK).
One-shot smoke test:
dnx Darylmcd.RoslynMcp --yes
The process should start and then appear to hang — that's expected; it's an MCP server waiting for protocol messages on stdin. The --yes flag is mandatory under MCP hosts because there is no TTY for the interactive install-consent prompt.
.mcp.json snippet:
{
"mcpServers": {
"roslyn": {
"type": "stdio",
"command": "dnx",
"args": [
"Darylmcd.RoslynMcp",
"--source",
"https://api.nuget.org/v3/index.json",
"--yes"
]
}
}
}
Trade-offs vs. the global tool:
- ✅ No PATH pollution; no manual install step.
- ✅ Each cold start resolves to the latest version unless pinned (no
dotnet tool updatestep). - ⚠️ Cold-start cost on first invocation while the package downloads.
- ⚠️ For reproducible setups, pin the version: add
"--version", "1.35.0"toargs.
A copy-paste config also lives at docs/mcp-json-examples/dnx.mcp.json.
Option C — Claude Code Plugin
/plugin marketplace add darylmcd/Roslyn-Backed-MCP
/plugin install roslyn-mcp@roslyn-mcp-marketplace
The plugin bundles the MCP server, 32 skills, and safety hooks. For packaging, reinstall, and local plugin-dev details, see docs/setup.md and docs/reinstall.md.
Build And Run From Source
dotnet build RoslynMcp.slnx --nologo
dotnet test RoslynMcp.slnx --nologo
dotnet run --project src/RoslynMcp.Host.Stdio
Per-Client Config
The JSON shape is the same across MCP clients — only the file path differs. Drop one of the docs/mcp-json-examples/ snippets into the right location for your client:
| Client | Config file | Notes |
|---|---|---|
| Claude Code | .mcp.json (repo root) |
Project-scope; pairs naturally with the Claude Code Plugin path above. |
| Cursor | .cursor/mcp.json (repo root) or ~/.cursor/mcp.json (global) |
Project-scope wins over global. |
| VS Code (MCP-aware) | .vscode/mcp.json (repo root) |
Workspace-scope; restart the MCP host after editing. |
| Claude Desktop | claude_desktop_config.json (per-OS app-data dir) |
Global only; no project-scope config. |
Minimal config (works with Option A — global tool):
{
"mcpServers": {
"roslyn": {
"type": "stdio",
"command": "roslynmcp"
}
}
}
For the Option B (dnx) form, use the snippet from the previous section or copy docs/mcp-json-examples/dnx.mcp.json.
For NDJSON framing, handshake order, and minimal Python/C# client examples, see docs/stdio-client-integration.md.
Health Check
After installing and wiring up .mcp.json, paste this single prompt into your MCP client to verify the server is reachable and report its surface:
Call
server_infoand read theroslyn://server/catalogresource. Report back:
- The server name and version.
- The total tool / resource / prompt counts and their stable-vs-experimental split.
- Whether any workspaces are currently loaded (and their IDs if so).
- Any warnings or degraded-state flags.
If both calls succeed and the version matches what you installed, the install is healthy.
MCP Registry
The server is published to the official MCP Registry under the name io.github.darylmcd/roslyn-mcp. MCP-Registry-aware clients — and the downstream catalogs that mirror the registry (the GitHub MCP Registry, the VS Code and Visual Studio MCP galleries, and aggregators) — can discover and install the server by name.
Manifest: .claude-plugin/server.json — name io.github.darylmcd/roslyn-mcp, NuGet package Darylmcd.RoslynMcp, runtime dnx. Every release tag republishes it automatically via the publish-nuget workflow using GitHub OIDC.
You can also install directly without a registry-aware client via the Global Tool or Claude Code Plugin paths above.
Configuration
The server starts with built-in defaults. To override ROSLYNMCP_* values for a repo, add a project-scope .mcp.json with literal env values.
| Variable | Default | Purpose |
|---|---|---|
ROSLYNMCP_MAX_WORKSPACES |
8 |
Concurrent workspace cap |
ROSLYNMCP_BUILD_TIMEOUT_SECONDS |
300 |
Build timeout |
ROSLYNMCP_TEST_TIMEOUT_SECONDS |
600 |
Test timeout |
ROSLYNMCP_PREVIEW_TTL_MINUTES |
5 |
Preview-token TTL |
ROSLYNMCP_REQUEST_TIMEOUT_SECONDS |
120 |
Per-request timeout |
Copy-ready examples live in docs/mcp-json-examples/README.md. The full runtime/config surface is documented in ai_docs/runtime.md.
Security
Loading a solution or project executes MSBuild evaluation. Treat workspaces as trusted code unless you run the server inside a sandbox, container, or VM.
- Only load repos you trust.
- Use isolation for untrusted workspaces.
- Path validation is defense in depth, not a substitute for trusting the loaded project graph.
See SECURITY.md for disclosure policy.
Live Surface
The current release exposes 173 tools (113 stable / 60 experimental), 14 resources (9 stable / 5 experimental), and 20 prompts (all experimental).
Use the running server for the authoritative live catalog and support tiers:
server_infofor a human-readable summaryroslyn://server/catalogfor the machine-readable contractroslyn://server/resource-templatesfor resource URI templates
Stable families include workspace/session management, semantic navigation, diagnostics, build/test helpers, and preview/apply refactoring flows. Experimental families include broader project mutation, scaffolding, orchestration, direct text-edit helpers, and prompts.
Repository Layout
src/RoslynMcp.Host.Stdio/— stdio host, tool/resource/prompt wiring, loggingsrc/RoslynMcp.Core/— DTOs, contracts, abstractions, preview-store typessrc/RoslynMcp.Roslyn/— Roslyn workspace, analysis, diagnostics, refactoring, execution servicestests/RoslynMcp.Tests/— integration and regression coverageskills/— bundled Claude Code skill definitionshooks/— Claude Code safety hooks
Docs
- docs/setup.md — packaging, Docker, tool install, plugin install, CI artifacts
- docs/compatibility.md — MCP client compatibility matrix (Claude Code, Cursor, VS Code, Claude Desktop)
- docs/stdio-client-integration.md — custom MCP client integration
- docs/product-contract.md — stable vs experimental surface contract
- docs/release-policy.md — release gates and compatibility rules
- AGENTS.md — bootstrap entry point for AI agents working in this repo
- ai_docs/README.md — canonical AI-doc routing index
Filing Surface-Test Findings
If you find a bug or behaviour gap while running /mcp-server-surface-test against your own C# repo, share it back via the Surface-test finding issue template. The shipped skill renders findings into a copy-paste body block by default; pass --auto-file and the skill calls gh issue create for you.
P0 / area: security findings are refused for public filing — see SECURITY.md for the private-disclosure path.
Support
- Bugs and feature requests: GitHub Issues
- Contribution guidelines: CONTRIBUTING.md
- Security disclosures: SECURITY.md
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。