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 分