Resharper Cli Mcp

io.github.andypgray由 GitHub 帳號 andypgray 發布v1.8.0更新於 Oct 31, 2026

ReSharper CLI inspection/cleanup via MCP. Unofficial: not affiliated with or endorsed by JetBrains.

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

概覽

AI 產生的概覽

為編碼助理執行 JetBrains ReSharper 命令列工具:檢查 .NET 解決方案的問題,並對指定檔案執行 ReSharper 程式碼清理。

可以做什麼
  • 對整個解決方案執行 ReSharper 檢查,依檔案分組回傳問題,可用 glob 與嚴重性篩選,並可輸出 markdown 報告檔
  • 對指定檔案執行 ReSharper 清理設定檔,並回報哪些檔案在磁碟上被變更
  • 重設或回收解決方案的 ReSharper 快取
  • 以 MCP 資源形式提供安裝與設定指南,並提供引導助理推導程式碼風格指南的提示詞
適用情境
適合在 .NET 解決方案中由助理修改 C# 或 Razor 程式碼時使用,讓助理遵循與 IDE 相同的 ReSharper 嚴重性與程式碼風格,或在任務結束時執行可重複的清理,而不必自行呼叫 jb 並解析報告檔。
執行需求
僅本機程序(stdio)。需安裝 .NET 10 SDK 與 JetBrains ReSharper 命令列工具(皆為 .NET 全域工具),以及本伺服器套件。工作目錄中需能找到 .sln 或 .slnx,或透過 JB_SOLUTION_PATH 指定。選用環境變數:JB_CACHE_HOME、JB_SETTINGS_PATH、JB_EXTENSIONS、JB_EXTENSION_SOURCE、RESHARPER_MCP_TIMEOUT_SECS、RESHARPER_MCP_PREWARM、RESHARPER_MCP_CLEANUP_FILTER、RESHARPER_MCP_LOG_LEVEL。
安裝前請注意
resharper_cleanup 會改寫磁碟上的原始碼檔案,執行前請先檢視或提交;預設的 Full Cleanup 設定檔可能對舊有程式碼造成大量變動。resharper_reset_cache 會刪除快取。首次執行需建立 ReSharper 快取,可能耗時數分鐘,單次執行受 RESHARPER_MCP_TIMEOUT_SECS 限制。診斷記錄與檢查報告留在本機,但可能包含絕對路徑以及解決方案中的規則訊息。非官方專案,與 JetBrains 無關聯。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

resharper-cli-mcp

[CI] [works with jb] [OpenSSF Scorecard] [NuGet] [NuGet downloads]

resharper-cli-mcp is an MCP server that runs JetBrains' ReSharper command-line tools for a coding agent. Its resharper_inspect tool runs jb inspectcode and returns the issues, and resharper_cleanup runs jb cleanupcode over the files the agent names. jb reads the solution's .DotSettings and .editorconfig as ReSharper does in the IDE, so the agent is held to the same severities and code style. The server is unofficial, not affiliated with or endorsed by JetBrains, and it runs a jb you install yourself.

Why not call jb directly?

An agent can run jb from a shell. It then gets a report file that can list thousands of issues, a cleanup profile it must name on every call, and a cold cache in each new checkout. The server handles each of these:

  • Issues come back as markdown grouped by file, re-rendered at lower detail until they fit the client's output budget.
  • jb cleanupcode runs Built-in: Full Cleanup unless it is given --profile, whatever the solution's settings say. The server passes the profile the solution names under SilentCleanupProfile, and reports which files cleanup changed.
  • The cache is warmed when a client connects, unless RESHARPER_MCP_PREWARM=off. A new worktree or clone is seeded from another checkout's warm cache.
  • Runs are queued, because otherwise a second concurrent jb on one solution builds a cold cache of its own.
  • A run reports progress every ten seconds, with the elapsed time and the cap.

Run times

An inspect analyses the whole solution, because resolving symbols needs the full solution model, so files narrows what is reported, not what is analysed. A cleanup loads only the projects its files belong to and every project those reference, through a solution filter the server writes, and on a warm cache it takes longer the more files it is given. RESHARPER_MCP_CLEANUP_FILTER=off makes it load the whole solution. The first run against a solution builds ReSharper's caches and typically takes minutes, then later runs against the same cache are several times faster.

Each run is capped at RESHARPER_MCP_TIMEOUT_SECS, defaulting to 10 minutes. If your client's own tool-call timeout is shorter than a cold run, raise that too.

Quickstart

The server needs the .NET 10 SDK and JetBrains' ReSharper Command Line Tools, which are free and need no ReSharper license. Both install as .NET global tools:

bash
dotnet tool install -g JetBrains.ReSharper.GlobalToolsdotnet tool install -g Zphil.ReSharperCli

Register the command resharper-cli-mcp, which takes no arguments, with your MCP client. For Claude Code, add it to .mcp.json:

json
{  "mcpServers": {    "resharper": {      "command": "resharper-cli-mcp"    }  }}

The server uses the one .sln or .slnx in its working directory. When there are none or several, set JB_SOLUTION_PATH in the config's env block.

Other clients differ only in where the entry goes and the key around it:

ClientWhere the entry goesTop-level key
Visual Studio 2022 17.14+ and 2026.mcp.json beside the solutionservers, with "type": "stdio"
VS Code.vscode/mcp.jsonservers, with "type": "stdio"
Cursor.cursor/mcp.json, or ~/.cursor/mcp.json for every projectmcpServers
Rider AI AssistantSettings | Tools | AI Assistant | MCPmcpServers
Junie.junie/mcp/mcp.json, or ~/.junie/mcp/mcp.json for every projectmcpServers
Clinecline_mcp_settings.json, under Configure MCP ServersmcpServers

Inside Rider, the IDE's own analysis already gives its agents the inspection results, and resharper_inspect would run a second analysis of the solution alongside it. There the server's sole use is resharper_cleanup, because Rider's MCP tools can reformat a file but cannot run a cleanup profile.

For Codex CLI, run codex mcp add resharper -- resharper-cli-mcp. llms-install.md has the full entry for each client as a checklist, so you can point an agent at it to do the install.

VS Code, Visual Studio, Cursor and LM Studio can add the server in one click once both tools are installed:

[Install in VS Code] [Install in Visual Studio] [Add to Cursor] [Add to LM Studio]

Install as a Claude Code plugin

This repository is also a Claude Code plugin marketplace with one plugin:

/plugin marketplace add andypgray/resharper-cli-mcp/plugin install resharper-cli-mcp@resharper-cli-mcp

The plugin starts the server with dotnet dnx, pinned to one release, and claude plugin update resharper-cli-mcp@resharper-cli-mcp moves the pin to the latest. You still install the .NET 10 SDK and jb, and ReSharper's caches live in the plugin's data directory.

Install as a Claude Desktop extension

Download resharper-cli-mcp-<version>.mcpb from the latest release, double-click it, and set Solution file to the .sln or .slnx to analyse. Claude Desktop starts the server outside your repository, so it has no working directory to find a solution in. The bundle carries only the server, so install the .NET 10 runtime and the ReSharper Command Line Tools first. Run cap moves the 10-minute limit on one run.

Tools

ToolMutates filesWhat it does
resharper_inspectnoRuns jb inspectcode and returns the issues, grouped by file.
resharper_cleanupyesRuns jb cleanupcode on the given files and reports which ones changed on disk.
resharper_reset_cacheno (deletes caches)Drops the solution's ReSharper cache so the next run starts cold, or reclaims the cache a deleted checkout left behind.

resharper_inspect takes files globs, solution-relative or absolute, and a severity of Suggestion, Warning (the default) or Error. At severity=Suggestion a response reads:

text
Found 2 issue(s) across 1 file(s):
### /repo/src/HomeController.cs- **Line 8** [WARNING] `RedundantUsingDirective`: Using directive is not required by the code and can be safely removed.- **Line 24** [SUGGESTION] `FieldCanBeMadeReadOnly.Local`: Field can be made readonly.

report=Markdown writes every issue with its own message to a file under the system temp directory. The response names the file, and the server deletes it after seven days. detail caps how detailed the response may be, down to a one-line Minimal, so detail=Minimal report=Markdown surveys a legacy solution in one call.

resharper_cleanup changes style, never behaviour: formatting, using directives, var style, modifier order, redundant qualifiers and parentheses, braces. Without a profile argument it uses the profile named under SilentCleanupProfile in the solution's settings, then Built-in: Full Cleanup. Where Full Cleanup would churn legacy code, name a narrower profile there. Every call then uses it, including calls from an agent that does not know it exists.

For a codebase with no style settings yet, start from ReSharper's Detect Code Style Settings, or in Rider Auto-Detect Code Style Rules. The derive_style_guide prompt walks an agent through the same job without an IDE.

Configuration

Set these in the client config's env block. All are optional. The JB_ variables are passed on to jb, and the RESHARPER_MCP_ ones govern the server itself.

VariableDefaultPurpose
JB_SOLUTION_PATHdiscoveredSolution to use when the working directory has none or several; the solutionPath tool argument overrides it for one call.
JB_SETTINGS_PATHnoneA .DotSettings file outside the solution's own, mounted as a Custom layer above the solution's and every project's settings.
JB_CACHE_HOME~/.jb-cacheReSharper cache directory.
JB_EXTENSIONSnoneSemicolon-separated ReSharper plugin IDs to load.
JB_EXTENSION_SOURCEjb's ownCustom NuGet source for those plugins.
RESHARPER_MCP_TIMEOUT_SECS600Cap in seconds on one jb run, and on the wait for one already in flight, clamped to 60–86,400.
RESHARPER_MCP_PREWARMonoff disables the cache pre-warm when a client connects.
RESHARPER_MCP_CLEANUP_FILTERonoff makes every cleanup load the whole solution rather than a solution filter of the files' projects.
RESHARPER_MCP_LOG_LEVELWarningLevel for the rolling file log: Verbose, Debug, Information, Warning, Error or Fatal. The Microsoft names Trace and Critical also work, and any value it does not recognise falls back to Warning.
MAX_MCP_OUTPUT_TOKENS25,000 charactersClient output budget that responses are reduced to fit, at 2.5 characters per token.

The solution comes from the solutionPath argument, then JB_SOLUTION_PATH, then the one .sln or .slnx in the working directory, with no walk up to a parent. The first two also accept a solution filter (.slnf), whose settings are read from the solution it names. Logs roll daily under %LOCALAPPDATA%\Zphil.ReSharperCli\logs on Windows, and the platform equivalent elsewhere.

Two guides go deeper, and the server serves both as MCP resources for an agent to read. The setup guide (resharper://guides/setup) covers discovery, the cache, run times and output limits. The configuration guide (resharper://guides/configuration) covers settings layers, cleanup profiles, and keeping a deliberate style from being reverted.

Cleanup reminder hook

The single end-of-task cleanup is easy for an agent to forget. This Claude Code PostToolUse hook adds a one-line reminder to the agent's context after each .cs or .razor edit. It never edits code or calls the tool, so the agent still decides when to clean up. Add it to .claude/settings.json; the command needs a POSIX shell, which on Windows is Git Bash:

json
{  "hooks": {    "PostToolUse": [      {        "matcher": "Edit|Write",        "hooks": [          {            "type": "command",            "command": "grep -qiE '\"file_path\"[[:space:]]*:[[:space:]]*\"[^\"]*\\.(cs|razor)\"' && printf '%s' '{\"hookSpecificOutput\":{\"hookEventName\":\"PostToolUse\",\"additionalContext\":\"When this task is done, batch every edited .cs/.razor file into one resharper_cleanup call.\"}}' || true"          }        ]      }    ]  }}

Privacy Policy

resharper-cli-mcp collects nothing. It has no telemetry, analytics, accounts or remote logging, and it makes no network calls of its own. Each tool call runs the jb on your machine, and the results go back over stdio to the MCP client that started the server.

Everything the server writes stays on that machine: its diagnostic log, the inspection reports a call asks for, and bookkeeping files beside ReSharper's caches. The log and the reports can contain absolute paths and the rule IDs and messages read from your solution. PRIVACY.md is the full policy, with where each file lives and how long it is kept.

Contributing

Contributions are welcome. Bug reports reproduced on a public solution, MCP client-compatibility fixes, and improvements to discovery or output formatting land best. CONTRIBUTING.md covers the development setup and the test architecture, and SECURITY.md covers reporting a security issue privately.

License

MIT; see LICENSE.

JetBrains and ReSharper are trademarks of JetBrains s.r.o. This project is an independent wrapper of their ReSharper Command Line Tools, which ship under JetBrains' own license.

來源:README.md,提交 fa47c67

工具

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

版本歷史

4
  1. v1.8.0最新Oct 31, 2026
  2. v1.7.2Oct 21, 2026
  3. v1.7.1Oct 6, 2026
  4. v1.7.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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