Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
marshally avatar

Refactoring MCP Server

  • 4 repo stars
  • Updated November 29, 2025
  • marshally/mcp-refactoring

Refactoring MCP Server is a MCP server that exposes Martin Fowler’s refactoring catalog with 71+ techniques to your agent over stdio.

About

Refactoring MCP Server wraps Martin Fowler’s refactoring catalog so Claude Code, Cursor, and similar agents can pull authoritative technique names, intent, and mechanics on demand. developers shipping SaaS, APIs, or CLIs often know code smells but forget the precise Fowler move or how to sequence safe steps. Installing this stdio MCP server adds a local reference layer your agent can call while you review PRs, untangle modules, or iterate on production code. It fits the ship and review moment on the journey—when you are reducing complexity before release—but also supports build-time backend work and operate-time incremental improvement. Expect catalog lookup and guidance, not autonomous edits; you still run tests and apply patches. For Skillselion developers comparing options, this is a focused developer-tools integration rather than a full code-review skill or linter replacement.

  • Exposes 71+ Martin Fowler refactorings as MCP tools for LLM lookup
  • Stdio transport via PyPI package mcp-refactoring (v0.1.2)
  • Structured catalog access instead of ad-hoc web summaries
  • Useful during backend refactors and test-preserving structural changes
  • Developer-reference MCP, not an automated rewrite engine

Refactoring MCP Server by the numbers

  • Data as of Jul 23, 2026 (Skillselion catalog sync)
terminal
claude mcp add mcp-refactoring -- uvx mcp-refactoring

Add your badge

Show developers this MCP server is listed on Skillselion. Paste this into your README.

Listed on Skillselion
repo stars4
Packagemcp-refactoring
TransportSTDIO
AuthNone
Last updatedNovember 29, 2025
Repositorymarshally/mcp-refactoring

What it does

Give your coding agent Fowler-style refactoring names, steps, and tradeoffs while you clean up legacy code without guessing catalog terminology.

Who is it for?

Best when you're doing incremental cleanups during PR review or post-launch iteration and want catalog-accurate refactoring language in the agent loop.

Skip if: Skip if you need automatic codemods, organization-wide style enforcement, or security/compliance scanning without manual implementation.

What you get

Your agent can cite specific Fowler refactorings and apply consistent terminology while you refactor with tests and review still in your hands.

  • Agent-callable access to 71+ catalogued refactoring techniques
  • Consistent Fowler terminology in refactor planning chat
  • Local stdio MCP integration without a hosted remote endpoint

By the numbers

  • 71+ refactorings in catalog
  • Server version 0.1.2
  • Transport: stdio via PyPI identifier mcp-refactoring
README.md

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.

list_refactorings(language="python", category="composing_methods")

preview_refactoring

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

preview_refactoring(
    refactoring="extract-method",
    target="src/order.py::Order::calculate#L10-L15",
    params={"name": "calculate_tax"}
)

apply_refactoring

Apply a refactoring to the codebase.

apply_refactoring(
    refactoring="rename-method",
    target="src/order.py::Order::calc",
    params={"new_name": "calculate_total"}
)

inspect_structure

Get structural information about code.

inspect_structure(path="src/order.py", depth="method")

analyze_code

Analyze code for smells and suggest refactorings.

analyze_code(path="src/order.py", smells=["long-method"])

Target Specification

Each language uses its native conventions:

Python

src/order.py::Order::calculate_total        # Method
src/order.py::Order::calculate_total#L10-L15  # Line range
src/order.py::Order                         # Class

Configuration

Create ~/.mcp-refactoring/config.toml:

[backends.python]
enabled = true
command = "molting"

[backends.ruby]
enabled = false
command = "molting-rb"

Environment variable overrides:

MCP_REFACTORING_PYTHON_COMMAND=/path/to/molting
MCP_REFACTORING_PYTHON_ENABLED=true

Refactoring Categories

Based on Martin Fowler's catalog:

  • Composing Methods: extract-method, inline-method, etc.
  • Moving Features: move-method, extract-class, etc.
  • Organizing Data: encapsulate-field, replace-type-code, etc.
  • Simplifying Conditionals: decompose-conditional, guard-clauses, etc.
  • Simplifying Method Calls: rename-method, add-parameter, etc.
  • Dealing with Generalization: pull-up-method, extract-interface, etc.

Development

# Clone the repository
git clone https://github.com/marshally/mcp-refactoring.git
cd mcp-refactoring

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Run linter
ruff check .

# Run type checker
mypy src/

License

MIT License - see LICENSE for details.

Recommended MCP Servers

How it compares

Fowler catalog reference over MCP—not a linter, formatter, or autonomous refactoring bot.

FAQ

Who is Refactoring MCP Server for?

Developers and small teams who refactor real codebases with AI assistants and want Martin Fowler’s catalog available as structured MCP tools.

When should I use Refactoring MCP Server?

Use it during code review, backend cleanup, or iterate cycles when you need the right refactoring name, motivation, and safe-step framing before editing.

How do I add Refactoring MCP Server to my agent?

Install the PyPI package mcp-refactoring (0.1.2), register it as a stdio MCP server in Claude Code or Cursor, then invoke its tools from the agent during refactor tasks.

Developer Toolsbackendtestingintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.