Skip to main content
Glama
Revise MCP
by davidfstr

Revise MCP

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

Related MCP server: uni-kb

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 move

  • cutStartAt — 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 line

  • cutEndAt — 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 \n or file boundary. Matched against the pre-cut file state

  • pasteFilePath (optional) — Absolute path to the paste destination file. Defaults to cutFilePath (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 edit

  • indentStartAt — Substring fragment identifying the first line to indent/unindent. The ⬥ marks a position on the target line; the entire line is included

  • indentEndAt — 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, and async def definitions (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_symbol Setup 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 rename

  • oldString — 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 for oldString. Use when oldString appears 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:

  1. VS Code must be running with the project open.

  2. 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

  1. Install the VSC as MCP extension in VS Code.

  2. Open VS Code with the project you want to rename symbols in.

  3. 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"]
        },
    }
}

Available Tools

4 tools
indent_dedentA

Indents or unindents a range of lines in a file.

Specify the range using substring matching with a ⬥ marker. The ⬥ identifies which line is the boundary — the full line containing the ⬥ is included in the range.

Common pattern — indent a block, then wrap it: 1. indent_dedent(indentStartAt="# Create home URL\n⬥", ..., indentDelta=1) 2. replace_string_in_file to insert "if True:" before the indented block

⬥ in boundaries anywhere on a line marks the line to indent when the context contains multiple lines. No ⬥ is needed if the context is within a single line only.

Whitespace at the end of lines is ignored when matching substrings.

Empty lines within the range are left unchanged (no whitespace added). Non-empty lines (including whitespace-only lines) are indented/unindented.

Inputs: filePath (required), indentStartAt (required), indentEndAt (required), indentDelta (required), +1 more. Returns: result

move_string_in_fileA

Moves a continuous range of lines from one location to another within a file (or between files).

Specify cut boundaries and paste location using substring matching with an optional ⬥ marker.

Example 1: Move a definition before another definition: cutStartAt: "class MyClass:" (start at this line) cutEndAt: "class NextClass:" (end BEFORE this line) pasteAt: "\n⬥def target_function():" (paste adjacent to the \n)

Example 2: Move a paragraph after another paragraph: cutStartAt: "# Close the database" (start at this line) cutEndAt: "db.close()\n⬥" (end after the final paragraph line) pasteAt: "db.open()\n⬥" (paste after a different paragraph's last line)

⬥ in cut boundaries anywhere in a line marks the line to cut when the cut context contains multiple lines. No ⬥ is needed if cut context is within a single line only.

⬥ in a paste boundary must be adjacent to a \n or the start/end of the file. All lines will be pasted before/after the nearby \n or file boundary.

Whitespace at the end of lines is ignored when matching substrings.

After editing reports on blank lines around the cut and paste boundaries, simplifying clean up of nearby line spacing with small subsequent edits.

Does not alter indentation. Use indent_dedent to adjust indentation after moving if needed.

Inputs: cutFilePath (required), cutStartAt (required), cutEndAt (required), pasteAt (required), +1 more. Returns: result

outline_fileA

Returns a high-level outline of a file, similar to VS Code's folded view.

Shows only structurally significant lines:

  • class and def definitions (at any indentation level)

  • Section separator comments (# === ... or # --- ... prefix, at any indentation)

  • Section name comments that immediately follow a pure separator line

Output format: "LINE_NUMBER:LINE_CONTENT" (1-indexed), one per line. Useful for understanding the structure of a large file before reading it in full.

Inputs: filePath (required). Returns: result

rename_symbolA

Renames a symbol (function, variable, class, etc.) and all its references across the workspace.

Uses text-based matching to locate the symbol—no coordinate counting required.

Example: filePath: "/path/to/file.py" oldString: "def helper_function(" newString: "def _helper_function("

This will rename helper_function to _helper_function everywhere it's referenced.

Inputs: filePath (required), oldString (required), newString (required), line. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool addresses a distinct editing operation: indentation, moving lines, outlining, and renaming. No overlap or confusion among them.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with underscores (e.g., indent_dedent, move_string_in_file), making them predictable and readable.

    Tool Count5/5

    With 4 tools, the server is well-scoped for a focused code editing purpose, not too few or too many.

    Completeness2/5

    The server lacks basic text editing tools like replace, insert, or delete, which are essential for comprehensive file editing. The mention of 'replace_string_in_file' in descriptions suggests a gap.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      AST-targeted code editing MCP server with 28 surgical tools for structural edits across 11 languages. Built on tree-sitter, replaces brittle search/replace with byte-correct edits keyed by symbol names.
      2
      28
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables parsing, indexing, and querying source code as structured knowledge, providing code exploration, spec generation, and migration tools via 20 MCP tools.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      MCP wrapper for Metals (Scala language server) that adds file editing and refactoring tools such as rename-symbol, add-import, and remove-unused-imports.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides code intelligence by indexing source code into SQLite and offering MCP tools for symbol search, flow tracing, and context retrieval to assist with code navigation and understanding.
      -