marshally avatar

Refactoring MCP Server

marshally/mcp-refactoring

Connects Claude to Martin Fowler's catalog of 71+ refactorings through a language-agnostic architecture. You get five tools: list available refactorings by category, preview changes before applying them, execute refactorings on your codebase, inspect code structure at class or method level, and analyze for code smells. Targets are specified with native conventions like `src/order.py::Order::calculate_total#L10-L15`. Currently supports Python through the molting-cli backend with Ruby, Java, and Go planned. Useful when you want programmatic refactoring suggestions and execution instead of manual restructuring, or when working through technical debt systematically. Output uses TOON format for token efficiency.

GitHub stars
3
tools
5
transport
STDIO
last updated
Nov 29, 2025

Tools

5 tools

Public tool metadata for what this MCP can expose to an agent.

list_refactoringsList available refactorings with their parameter contracts.

List available refactorings with their parameter contracts.

No parameter schema in public metadata yet.

preview_refactoringPreview what changes a refactoring would make (dry-run).

Preview what changes a refactoring would make (dry-run).

No parameter schema in public metadata yet.

apply_refactoringApply a refactoring to the codebase.

Apply a refactoring to the codebase.

No parameter schema in public metadata yet.

inspect_structureGet structural information about code.

Get structural information about code.

No parameter schema in public metadata yet.

analyze_codeAnalyze code for smells and suggest refactorings.

Analyze code for smells and suggest refactorings.

No parameter schema in public metadata yet.

Sponsors

Readme

mcp-refactoring

An MCP (Model Context Protocol) server that exposes Martin Fowler's refactoring catalog to LLMs through a pluggable, language-agnostic architecture.

Features

  • 71+ Refactorings: Full implementation of Martin Fowler's refactoring catalog
  • Pluggable Architecture: Support for multiple languages (Python first, Ruby/Java/Go planned)
  • Safe by Default: Preview mode shows changes before applying
  • LLM-Optimized: TOON output format for token efficiency

Installation

# Using uvx (recommended)
uvx mcp-refactoring

# Using pip
pip install mcp-refactoring

# Using pipx
pipx install mcp-refactoring

Requirements

  • Python 3.10+
  • A language backend (e.g., molting-cli for Python)

Install the Python backend:

pip install molting-cli

Claude Desktop Configuration

Add to your Claude Desktop config:

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

Available Tools

list_refactorings

List available refactorings with their parameter contracts.


View the full README on GitHub

Details

Repository
github.com/marshally/mcp-refactoring
Package
mcp-refactoring
Transport
STDIO
Registry
MCP registry, active