DH

dave-hillier/refactor-mcp

Analytics & monitoring

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

94 stars 22 forks 品質 71 トレンド 23MPL-2.0

dave-hillier/refactor-mcp は [https://github.com/dave-hillier/refactor-mcp.] からインポートされた MCP サーバーの候補です

概要

dave-hillier/refactor-mcp は [https://github.com/dave-hillier/refactor-mcp.] からインポートされた MCP サーバーの候補です

概要(AI 翻訳)

RefactorMCP は、C# 用の Roslyn ベースのリファクタリングツールを 3 回以上公開します。 point: コマンドラインインターフェイス、ソリューションを保持するレジデントデーモン 読み込み、モデルコンテキストプロトコルサーバー。

同じツールのディスパッチャとセッションを通して3つのディスパッチがすべてなので、ツール 同じように振る舞いますが、呼び出されます。

インストール

RefactorMCP は .NET ツールとして NuGet に公開されています。 .NET SDK(9.0または9.0)が必要です。 後で)MSBuildを通して解決が荷を積まれているので機械、。

パスにrefactor-mcpを入れます。 MCP クライアントにサービスを提供するため、登録 引数[mcp で、例えば:

以下の例は dotnet run --project RefactorMCP.ConsoleApp --; with the tool installed, ]:refactor-mcp は、その 場所。

使用法

ツールのパラメータ(--method-names)の後にオプションが名付けられます。 [[methodNames]]), 行末 [Path] が削除される ([[--file]), および パラメータの順番に残っているものは、 パラメータの順序で位置づけられます。 [--no-daemon]] はコールを実行します 代わりに呼び出しプロセス。 デーモンは10分後に止まります [stop; [[serve --idle-timeout]]]]に要求されたとき ([30s], 1h]], [0]) は、期限が切れないようにします.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

RefactorMCP

RefactorMCP exposes Roslyn-based refactoring tools for C# over three entry points: a command line interface, a resident daemon that keeps a solution loaded, and a Model Context Protocol server.

All three dispatch through the same tool dispatcher and session, so a tool behaves the same however it is called.

Install

RefactorMCP is published to NuGet as a .NET tool. It needs a .NET SDK (9.0 or later) on the machine, since solutions are loaded through MSBuild.

dotnet tool install --global RefactorMCP

This puts refactor-mcp on the path. To serve it to an MCP client, register the command refactor-mcp with the argument mcp, for example:

{
  "mcpServers": {
    "refactor-mcp": { "command": "refactor-mcp", "args": ["mcp"] }
  }
}

The examples below run from source with dotnet run --project RefactorMCP.ConsoleApp --; with the tool installed, refactor-mcp takes its place.

Usage

# Run a refactoring. Tool commands go to the daemon for that solution, which is
# started on demand, so only the first call pays the MSBuild load.
dotnet run --project RefactorMCP.ConsoleApp -- extract-method \
    --solution ./RefactorMCP.sln --file ./src/Foo.cs \
    --selection-range 10:5-20:6 --method-name ComputeTotal

# The same call with JSON parameters, for scripting.
dotnet run --project RefactorMCP.ConsoleApp -- --json extract-method \
    '{"solutionPath":"./RefactorMCP.sln","filePath":"./src/Foo.cs","selectionRange":"10:5-20:6","methodName":"ComputeTotal"}'

# Discover the tools, and what each one takes.
dotnet run --project RefactorMCP.ConsoleApp -- list-tools --verbose
dotnet run --project RefactorMCP.ConsoleApp -- extract-method --help

# Keep a solution loaded and serve calls from it.
dotnet run --project RefactorMCP.ConsoleApp -- serve --solution ./RefactorMCP.sln
dotnet run --project RefactorMCP.ConsoleApp -- status
dotnet run --project RefactorMCP.ConsoleApp -- stop --all

# Serve the tools over MCP on stdio.
dotnet run --project RefactorMCP.ConsoleApp -- mcp

Options are named after the tool’s parameters (--method-names for methodNames), a trailing Path may be dropped (--file for filePath), and anything left over is positional in parameter order. --no-daemon runs a call in the calling process instead. The daemon stops after ten minutes without a request, or when asked to with stop; serve --idle-timeout changes that (30s, 1h, or 0 to never expire).

A daemon follows the files it has loaded, so edits made in an editor are picked up rather than refactored on top of stale text: an edited file is replaced in place, and a change to a project file reloads the solution before the next call.

Once built, the executable can be called directly (RefactorMCP.ConsoleApp/bin/Debug/net9.0/RefactorMCP.ConsoleApp), which skips the build check dotnet run performs.

For usage examples see EXAMPLES.md.

Tools

GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "refactor-mcp": { "command": "refactor-mcp", "args": ["mcp"] } } }