DH

dave-hillier/refactor-mcp

Analytics & monitoring

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

94 stars 22 forks 품질 71 트렌드 23MPL-2.0

dave-hillier/refactor-mcp는 MCP 서버 후보가 https://github.com/dave-hillier/refactor-mcp.에서 수입됩니다

개요

dave-hillier/refactor-mcp는 MCP 서버 후보가 https://github.com/dave-hillier/refactor-mcp.에서 수입됩니다

개요(AI 번역)

RefactorMCP는 Roslyn 기반 세 항목에 C #에 대한 재구성 도구를 노출 point: a command line interface, solution을 유지하는 주민 데몬 Loaded 및 Model Context 프로토콜 서버.

동일한 도구 파견자 및 세션을 통해 모든 세 파견, 그래서 도구 같은 행동하지만 그것은 호출된다.

설치

RefactorMCP는 NuGet에 .NET 도구로 게시됩니다. 그것은 .NET SDK (9.0 또는 나중에) 해결책이 MSBuild를 통해서 적재되기 때문에 기계에.

이 경로에 refactor-mcp을 넣어. MCP 클라이언트에 봉사하기 위해, 등록 명령어 refactor-mcp와 인수 mcp], 예를 들면:

아래 예제는 dotnet run --project로 소스에서 실행합니다. RefactorMCP.ConsoleApp --; with the tool installed, refactor-mcp는 이름 *

사용법

옵션은 도구의 매개 변수 (--method-names]] 후 명명 methodNames]), Path]]는 filePath]), 그리고 매개변수 순서에 있는 positional는 아무것도 남아 있습니다. --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"] } } }