Revise MCP
Provides tools to revise and refactor code via MCP, including moving code, indenting/dedenting, outlining file structure, and optional symbol renaming.
README
Revise MCP
<img src="https://github.com/davidfstr/revise-mcp/blob/main/README/logo-big-notext.svg?raw=true" alt="Revise MCP logo" align="right" width="200" />
Tools to revise and refactor code via MCP (Model Context Protocol).
Installation
- Install Python 3.14+
- Install pipx:
python3 -m pip install pipx - Install Revise MCP:
pipx install revise-mcp
which revise
# /Users/YOUR_USERNAME/.local/bin/revise
Usage
VS Code MCP Configuration
Add to your VS Code MCP settings:
{
"servers": {
"revise": {
"type": "stdio",
"command": "/Users/YOUR_USERNAME/.local/bin/revise",
"args": []
},
}
}
Claude Code MCP Configuration
Run once to register Revise MCP for all your projects:
claude mcp add --scope user revise -- /Users/YOUR_USERNAME/.local/bin/revise
Tools
move_string_in_file
Moves a contiguous range of lines from one location to another within a file
(or between files). Uses substring matching with a ⬥ marker to identify
cut boundaries and paste location — no line counting or coordinate math required.
Does not alter indentation of the moved text. Use indent_dedent afterward
if the moved text needs re-indentation at its new location.
Parameters:
cutFilePath— Absolute path to the file containing the text to movecutStartAt— Substring fragment identifying the line where the cut begins. The⬥marks a position on the target line; the cut starts at the beginning of that linecutEndAt— Substring fragment identifying the line after the cut ends. The cut ends before this line (exclusive)pasteAt— Substring fragment marking the insertion point, with⬥adjacent to a\nor file boundary. Matched against the pre-cut file statepasteFilePath(optional) — Absolute path to the paste destination file. Defaults tocutFilePath(same-file move)
Example — move a class before another definition:
{
"cutFilePath": "/path/to/file.py",
"cutStartAt": "class MyClass:",
"cutEndAt": "class NextClass:",
"pasteAt": "\n⬥def top_level_function():"
}
indent_dedent
Indents or unindents a contiguous range of lines by a specified number of
levels. Uses substring matching with a ⬥ marker to identify the range
boundaries — no line counting required.
Empty lines within the range are left unchanged. Indent size is auto-detected from the file if not specified.
Parameters:
filePath— Absolute path to the file to editindentStartAt— Substring fragment identifying the first line to indent/unindent. The⬥marks a position on the target line; the entire line is includedindentEndAt— Substring fragment identifying the last line to indent/unindent (inclusive)indentDelta— Number of indent levels to add (positive) or remove (negative)indentSize(optional) — Spaces per indent level (e.g.,4), or"\t"for tabs. Auto-detected if omitted
Example — indent a block, then wrap it:
{
"filePath": "/path/to/file.py",
"indentStartAt": "# Create home URL\n⬥",
"indentEndAt": "(home_ti,) = root_ti.Children⬥\n",
"indentDelta": 1
}
Then use replace_string_in_file to insert if condition: before the indented block.
outline_file
Returns a high-level outline of a file, similar to VS Code's folded view. Useful for quickly understanding the structure of a large file before reading it in full.
Includes only structurally significant lines, currently optimized for the Python language only:
class,def, andasync defdefinitions (at any indentation level)if __name__ == '__main__':guards- Section separator comments (
# === ...or# --- ...), plus the immediately following section-name comment if present
Output is one line per entry in the form LINE_NUMBER:LINE_CONTENT (1-indexed).
Parameters:
filePath— Absolute path to the file to outline
Example:
{
"filePath": "/path/to/file.py"
}
rename_symbol (optional)
Renames a symbol (function, variable, class, etc.) and all its references across the workspace using VS Code's LSP-backed rename. Uses text-based matching to locate the symbol — no coordinate counting required.
Note: This tool is optional and has additional setup requirements. See Optional:
rename_symbolSetup below.It is most useful for AI coding harnesses that do not provide their own symbolic rename tool (e.g. Claude Code). VS Code users already have a native rename tool and may skip this.
Parameters:
filePath— Absolute path to the file containing the symbol to renameoldString— Line fragment containing the original symbol name. Must be unique within the file (or within the specified line). Example:'def mocked_show_modal('newString— Line fragment with all occurrences of the symbol renamed. Example:'def mocked_show_modal_renamed('line(optional) — 1-indexed line number to limit the search foroldString. Use whenoldStringappears on multiple lines
Example:
{
"filePath": "/path/to/file.py",
"oldString": "def helper_function(",
"newString": "def _helper_function("
}
This renames helper_function to _helper_function everywhere it is referenced.
Optional: rename_symbol Setup
The rename_symbol tool delegates the actual rename operation to VS Code via
the VSC as MCP
extension. This means:
- VS Code must be running with the project open.
- The "VSC as MCP" extension must be installed in VS Code. It exposes a
local MCP server (by default at
http://localhost:4000/mcp) that Revise MCP calls internally.
Steps
- Install the VSC as MCP extension in VS Code.
- Open VS Code with the project you want to rename symbols in.
- Ensure Revise MCP is configured in your AI coding harness (see Installation and Usage).
No additional configuration of Revise MCP itself is required — rename_symbol
will automatically connect to the VSC as MCP server on localhost:4000.
Contributing
See doc/DESIGN.md for a high-level introduction to the server design and the principles guiding tool development.
To publish a new release to PyPI, see doc/RELEASING.md.
Local Development Setup
Requires Python 3.14+ and Poetry.
# Checkout code
git checkout https://github.com/davidfstr/revise-mcp.git
cd revise-mcp
# Create/update the virtual environment at .venv/
poetry install
# Run the server locally
poetry run python -m revise
# Run tests
poetry run pytest tests/
Testing with MCP Inspector
# Start in HTTP mode for testing with MCP Inspector
poetry run python -m revise --transport streamable-http
# In another terminal, start the inspector
npx -y @modelcontextprotocol/inspector
VS Code MCP Configuration (Development)
To run the MCP server from your development checkout rather than an installed binary, point VS Code at the Poetry-managed venv:
{
"servers": {
"revise": {
"type": "stdio",
"cwd": "/path/to/revise-mcp",
"command": "poetry",
"args": ["run", "python", "-m", "revise"]
},
}
}
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。