Refactor

Provides MCP-powered refactoring tools for codebases via a stdio-based MCP server and CLI.
  • typescript

6

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "myuon-refactor-mcp": {
      "command": "npx",
      "args": [
        "@myuon/refactor-mcp@latest"
      ]
    }
  }
}

This MCP server provides powerful refactoring tools you can use from supported MCP clients or directly from the command line. It enables quick, regex-based searches and context-aware replacements across your codebase, helping you refactor safely and efficiently within an MCP workflow.

How to use

You operate the Refactor MCP Server through an MCP-compatible client or in CLI mode. In MCP client mode, you connect to the server so you can search for patterns across your project and apply regex-based replacements with optional context filtering. In CLI mode, you run commands directly to search for patterns or perform refactors on demand. The tools focus on two core capabilities: searching for code patterns and refactoring code with controlled replacements.

Main capabilities you can leverage:

  • Code search to locate matching patterns with optional context and file scoping.
  • Code refactor to replace patterns using capture groups, with optional context and file globbing. You can perform previews to review changes before applying them and you can tailor searches with file patterns to limit scope.

How to install

Prerequisites: you need Node.js and npm available on your system.

Install globally for MCP integration or run via npx for immediate usage.

Install globally for MCP integration by running the following command:

npm install -g @myuon/refactor-mcp

Alternatively, use npx to run the latest MCP server directly without a global install:

npx @myuon/refactor-mcp@latest

If you prefer CLI-only usage, you can invoke the CLI via npx in CLI mode as shown in the usage examples:

npx @myuon/refactor-mcp@latest cli search -p "function.*\(" -f "src/**/*.js"

Additional sections

Configuration and usage details are available for both MCP server mode and CLI mode. The MCP server operates via stdio transport and is designed to integrate with MCP-compatible environments. You can add the server to Claude Code or other MCP clients using the provided integration steps.

CLI usage supports two primary commands: search for locating patterns and refactor for applying replacements. When using capture groups in replacements on the command line, escape the dollar signs (e.g., \$1) to avoid shell interpolation.

Example usage from CLI mode includes:

  • Searching for patterns across your files
  • Refactoring with dry-run previews to see changes before applying
  • Narrowing the search or refactor to specific file patterns
  • Context-aware refactoring to limit replacements to import statements or other contexts

You can integrate with Claude Code by adding the MCP server under the refactor-mcp name, using either an npx-based invocation or a local installation to fit your workflow.

Available tools

code_refactor

Performs regex-based search and replace across files with optional context filtering and capture-group replacements.

code_search

Searches for regex patterns across files and returns precise file locations and line numbers, with optional context and file scoping.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational