Roslyn Mcp

io.github.darylmcd由 GitHub 帳號 darylmcd 發布v5.0.1更新於 Nov 7, 2026

Local-first MCP server for semantic C# analysis & refactoring via Roslyn & MSBuildWorkspace.

已驗證STDIO僅桌面檔案與儲存開發者工具

概覽

AI 產生的概覽

本機 stdio MCP 伺服器,透過 Roslyn 讓助理對真實 .NET 方案與專案進行 C# 語意分析、導覽、診斷,以及先預覽後套用的重構。

可以做什麼
  • 載入並管理工作區與工作階段(.sln、.slnx、.csproj)
  • 以語意方式導覽程式碼:符號、參考與相關宣告
  • 執行診斷,以及建置與測試輔助功能
  • 使用短期預覽權杖預覽並套用多檔案重構
  • 實驗性功能涵蓋專案變更、樣板產生、協同流程與直接文字編輯
  • 透過伺服器資訊類資源檢視即時工具目錄、資源與提示詞
適用情境
適合助理需要在 C#/.NET 程式碼庫中作業時使用:了解方案結構、追蹤符號、檢查診斷,或進行應先試跑再套用的多檔案重構。非 .NET 程式碼庫則不需要。
執行需求
以 .NET 全域工具、dnx 或 Claude Code 外掛形式在本機透過 stdio 執行,需要 .NET 10 SDK。必須設定 ROSLYNMCP_SANCTIONED_ROOTS 環境變數,未設定邊界時預設拒絕所有路徑。透過 dnx 或外掛首次啟動需要存取 NuGet(除非套件已快取)。未宣告任何驗證機制。
安裝前請注意
載入方案或專案會執行 MSBuild 評估,因此只載入可信任的儲存庫,或在沙箱中執行。重構工具與實驗性變更工具會修改工作區檔案,請先使用預覽。檔案系統邊界由伺服器掌控,用戶端的 MCP Roots 只能縮小它,建議將 ROSLYNMCP_SANCTIONED_ROOTS 設為絕對路徑以固定範圍。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Roslyn Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Roslyn-Backed MCP Server

[CI] [MCP Registry]

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. Refactoring tools follow a preview → apply discipline: previews return short-lived tokens, so agents can dry-run multi-file edits before mutating the workspace. It ships as a .NET global tool, a Claude Code plugin, and a source-buildable stdio host.

Correct package ID: Darylmcd.RoslynMcp  ·  CLI: roslynmcp  ·  Plugin: roslyn-mcp@roslyn-mcp-marketplace

Quick Start

Prerequisite: the .NET 10 SDK.

Option A — Install As A Global Tool

bash
dotnet tool install -g Darylmcd.RoslynMcp

Update later with dotnet tool update -g Darylmcd.RoslynMcp.

Configure a filesystem boundary before first use. The global tool ships a binary, not a config, and an unset boundary is fail-closed: every path-taking tool rejects its input. Set ROSLYNMCP_SANCTIONED_ROOTS in your MCP client config (for example a project-scope .mcp.json):

json
{  "mcpServers": {    "roslyn": {      "type": "stdio",      "command": "roslynmcp",      "env": { "ROSLYNMCP_SANCTIONED_ROOTS": "." }    }  }}

. resolves against the server process's working directory, which your MCP client chooses; use an absolute path to pin the boundary. See Setup.

Option B — Zero-Install Via dnx (.NET 10)

dnx resolves the package from NuGet on demand, without installing a global shim: run dnx Darylmcd.RoslynMcp. Pin a version for reproducible setups with Darylmcd.RoslynMcp@<version>. Configure the same ROSLYNMCP_SANCTIONED_ROOTS boundary as above; copy-paste configs live in docs/mcp-json-examples/, and details are in Setup.

Option C — Claude Code Plugin

text
/plugin marketplace add darylmcd/Roslyn-Backed-MCP/plugin install roslyn-mcp@roslyn-mcp-marketplace

The plugin bundles 32 skills and safety hooks, then launches the exact release-matched Darylmcd.RoslynMcp package through dnx; it does not require a global roslynmcp shim. The first launch requires NuGet access unless the package is already cached. The plugin's bundled "." boundary resolves to the session's working directory, so start Claude Code inside the repo you want to analyze; see Setup for the other supported overrides.

Per-Client Config

The JSON shape is the same across MCP clients (VS Code uses a top-level "servers" key); only the config file path differs. See the compatibility matrix for per-client paths and a health-check prompt, and docs/mcp-json-examples/ for copy-ready snippets.

Live Surface

The current release exposes 171 tools (110 stable / 61 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_info for a human-readable summary
  • roslyn://server/catalog for the machine-readable contract
  • roslyn://server/resource-templates for 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. Set ROSLYNMCP_TOOL_TIERS=stable to register only the closed stable workflow (currently 91 callable tools) for clients that eagerly load tool definitions.

Configuration And Security

All operational settings are optional ROSLYNMCP_* environment variables with compiled-in defaults; the full reference is in docs/setup.md. The exception is ROSLYNMCP_SANCTIONED_ROOTS, which you must set (see above).

Loading a solution or project executes MSBuild evaluation: only load repositories you trust, or run the server in a sandbox. The filesystem boundary is server-owned; a client's MCP Roots can only narrow it. See docs/setup.md and SECURITY.md for the disclosure policy. Upgrading from 2.x? Read the migration notes first.

Docs

Support

來源:README.md,提交 634ef45

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:該軟體包類型無法在沙箱中執行。

版本歷史

4
  1. v5.0.0Oct 29, 2026
  2. v4.3.0Sep 29, 2026
  3. v4.2.1Sep 18, 2026
  4. v4.2.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分