Skip to main content
MCP server CX Codex

Python Refactoring Assistant — Claude Code MCP server

Python Refactoring Assistant — an MCP server that analyzes Python code and supplies AI assistants with guided refactoring instructions and exact line numbers without touching your files.

no license updated 2026-10-29

Open on GitHub

What Python Refactoring Assistant does

The server connects to coding assistants via MCP to audit Python files while keeping changes under human control. It integrates analysis tools like radon, vulture, rope, and jedi to return structured JSON reports covering dead code, high complexity, and extraction targets with line numbers.

The distribution also provides a standalone python-refactor-cli binary. It runs security checks, package metrics, and test coverage queries directly inside the terminal without an MCP client.

Running this tool locally requires Python 3.13 or newer, or a prebuilt Docker container.

What it helps with

  • locate oversized functions and calculate cyclomatic complexity
  • generate method extraction instructions with exact line numbers
  • spot dead and unreferenced code across Python modules
  • audit test coverage thresholds before restructuring logic

Example prompts for the agent

  • Check src/app.py for long functions and give guidance on method extraction.
  • Run coverage analysis on src/ against tests located in tests/.

How to install Python Refactoring Assistant

Install

The MCP registry has no launch command for it: see the repository README

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about Python Refactoring Assistant

How to install Python Refactoring Assistant in Claude Code?

Add it via terminal using claude-code mcp add mcp-python-refactoring uvx --from git+https://github.com/slamer59/mcp-python-refactoring.git python-refactor server.

Does Python Refactoring Assistant modify source files on disk?

No, it acts as a mentor by providing structured diagnostic advice, leaving the actual file modifications up to you.

What environment is required to run the tool?

The package depends on Python 3.13 or newer, or can run inside Docker using the provided container setup.

Similar MCP servers

All MCP servers for Code review and refactoring →

Project sponsors

Companies that keep this analytics open