
Refactoring MCP Server
io.github.marshally由 GitHub 账号 marshally 发布v0.1.2更新于 Oct 24, 2026
MCP server exposing Martin Fowler's refactoring catalog to LLMs with 71+ refactorings
概览
一个本地 MCP 服务器,向助手提供 Martin Fowler 重构目录,可列出、预览、应用和分析代码重构。
- 可以做什么
- 按语言和类别列出可用重构及其参数约定,基于 Martin Fowler 的 71 项以上重构目录,涵盖组合方法、搬移特性、组织数据、简化条件、简化方法调用和处理泛化。以试运行方式预览某次重构会带来的改动。对指定目标(文件、类、方法或行范围)应用重构。查看代码在文件、类或方法层面的结构信息。分析代码中的坏味道并建议重构。
- 适用场景
- 适合在助手需要清理或重构 Python 代码时使用,让它依据有名称、有目录的重构集合工作,并在实际改动前先预览。最适合已经使用受支持语言后端的开发者。
- 运行要求
- 作为本地进程运行,通常用 uvx 启动,或通过 pip、pipx 安装。需要 Python 3.10+ 以及语言后端(例如 Python 的 molting-cli)。可选配置位于配置文件,或通过 MCP_REFACTORING_PYTHON_COMMAND、MCP_REFACTORING_PYTHON_ENABLED 等环境变量设置。未声明身份验证。
安装
在 SourceWeft 中
- 打开 控制台中的 Refactoring MCP Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
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
Requirements
- Python 3.10+
- A language backend (e.g.,
molting-clifor Python)
Install the Python backend:
Claude Desktop Configuration
Add to your Claude Desktop config:
Available Tools
list_refactorings
List available refactorings with their parameter contracts.
preview_refactoring
Preview what changes a refactoring would make (dry-run).
apply_refactoring
Apply a refactoring to the codebase.
inspect_structure
Get structural information about code.
analyze_code
Analyze code for smells and suggest refactorings.
Target Specification
Each language uses its native conventions:
Python
Configuration
Create ~/.mcp-refactoring/config.toml:
Environment variable overrides:
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
License
MIT License - see LICENSE for details.
来源:README.md,提交 30d981a
工具
0版本历史
1- v0.1.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分