- Home
- MCP servers
- Refactoring
Refactoring
- python
2
GitHub Stars
python
Language
5 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": {
"marshally-mcp-refactoring": {
"command": "uvx",
"args": [
"mcp-refactoring"
],
"env": {
"MCP_REFACTORING_PYTHON_COMMAND": "/usr/local/bin/molting",
"MCP_REFACTORING_PYTHON_ENABLED": "true"
}
}
}
}You run an MCP server that exposes Martin Fowler's refactoring catalog to LLMs through a pluggable, language-agnostic architecture. This server gives you a structured set of refactorings, safe preview modes, and language backends so you can analyze, preview, and apply refactorings across your codebase from your preferred MCP client.
How to use
You interact with the refactoring MCP server through your MCP client by selecting a language backend, listing available refactorings, previewing changes, and applying them to your codebase. Start by listing refactorings for your target language, then preview a specific change before applying it. You can also inspect code structure and run code analyses to identify refactor opportunities.
Typical workflow you can follow includes: 1) Discover available refactorings for your language, 2) Preview the impact of a chosen refactoring on a target file, 3) Apply the refactoring to update the code, 4) Inspect the resulting structure to confirm the change, 5) Run code analysis to surface additional improvement ideas.
How to install
Prerequisites: you need Python 3.10+ installed on your system.
Install the MCP server using one of the supported installation options.
# Using uvx (recommended)
uvx mcp-refactoring
# Using pip
pip install mcp-refactoring
# Using pipx
pipx install mcp-refactoring
Configuration and usage notes
To run locally with a standard MCP client, you can start a local MCP server instance that communicates via stdio. The recommended runtime is uvx, invoking the refactoring server as a local process.
Python backend is a common choice for the server side. You may configure the Python backend to use the molting CLI for the actual language processing.
If you work with Claude Desktop or a similar MCP client, you can configure the local stdio server with the following settings.
Notes on language backends and configuration
The server supports multiple language backends. A Python backend like molting-cli is used to perform the actual refactoring tasks for Python code.
Configuration examples and environment variable overrides help you tailor the server to your environment, including enabling Python backends and selecting command paths.
Available tools
list_refactorings
List available refactorings with their parameter contracts for a given language and category.
preview_refactoring
Preview the changes that a refactoring would make to the target code without applying them.
apply_refactoring
Apply a selected refactoring to the codebase, modifying the source files.
inspect_structure
Get structural information about code, such as classes, methods, and their relationships.
analyze_code
Analyze code for smells and suggest relevant refactorings.