RefactorMCP logo

RefactorMCP

Community
dave-hillier

Automated refactoring tools for C# code transformation using Roslyn.

Publisherdave-hillier
Repositoryrefactor-mcp
LanguageC#
Forks
22
Stars
93
Available tools
0
Transport typestdio
Categories
LicenseMPL-2.0
Links
  • Connect tools to AI workflows

    RefactorMCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    93 stars and 22 forks from the linked repository.

RefactorMCP

RefactorMCP is a Model Context Protocol server that exposes Roslyn-based refactoring tools for C#.

Usage

Run the console application directly or host it as an MCP server:

bash
dotnet run --project RefactorMCP.ConsoleApp

For usage examples see EXAMPLES.md.

Available Refactorings

  • Extract Method – create a new method from selected code and replace the original with a call (expression-bodied methods are not supported).
  • Introduce Field/Parameter/Variable – turn expressions into new members; fails if a field already exists.
  • Convert to Static – make instance methods static using parameters or an instance argument.
  • Move Static Method – relocate a static method and keep a wrapper in the original class.
  • Move Instance Method – move one or more instance methods to another class and delegate from the source. If a moved method no longer accesses instance members, it is made static automatically. Provide a methodNames list along with optional constructor-injections and parameter-injections to control dependencies.
  • Move Multiple Methods (instance) – move several methods and keep them as instance members of the target class. The source instance is injected via the constructor when required.
  • Move Multiple Methods (static) – move multiple methods and convert them to static, adding a this parameter.
  • Make Static Then Move – convert an instance method to static and relocate it to another class in one step.
  • Move Type to Separate File – move a top-level type into its own file named after the type.
  • Make Field Readonly – move initialization into constructors and mark the field readonly.
  • Transform Setter to Init – convert property setters to init-only and initialize in constructors.
  • Constructor Injection – convert method parameters to constructor-injected fields or properties.
  • Safe Delete – remove fields or variables only after dependency checks.
  • Extract Class – create a new class from selected members and compose it with the original.
  • Inline Method – replace calls with the method body and delete the original.
  • Extract Decorator – create a decorator class that delegates to an existing method.
  • Create Adapter – generate an adapter class wrapping an existing method.
  • Add Observer – introduce an event and raise it from a method.
  • Use Interface – change a method parameter type to one of its implemented interfaces.
  • List Tools – display all available refactoring tools as kebab-case names.

Metrics and summaries are also available via the metrics:// and summary:// resource schemes.

Contributing

  • Run dotnet test to ensure all tests pass.
  • Format the code with dotnet format before opening a pull request.

License

Licensed under the Mozilla Public License 2.0.

Use RefactorMCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once RefactorMCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add RefactorMCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the RefactorMCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "refactor-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the RefactorMCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the RefactorMCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use RefactorMCP to help me with this task?
RefactorMCP
Sure. I read it.
Here is what I found using RefactorMCP.

Frequently asked questions

What is the RefactorMCP MCP server used for?

RefactorMCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use RefactorMCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use RefactorMCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use RefactorMCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With RefactorMCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect RefactorMCP MCP to TypingMind?

RefactorMCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does RefactorMCP MCP provide in TypingMind?

RefactorMCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use RefactorMCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If RefactorMCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇