# weavatrix-refactor [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/Weavatrix/weavatrix-refactor  
**GitHub Stars:** 1  
**npm Downloads (last month):** 1610  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/weavatrix-refactor

## Description
Transactional refactoring extension with 11 evidence-backed tools, previews, and rollback.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "weavatrix-refactor": {
    "command": "npx",
    "args": ["-y","weavatrix-refactor"],
    "env": {
      "WEAVATRIX_ALLOW_SOURCE_EDITS": ""
    }
  }
}
```

**Requires environment variables:** `WEAVATRIX_ALLOW_SOURCE_EDITS` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What the weavatrix-refactor MCP server does

The weavatrix-refactor MCP server adds controlled source editing to the Weavatrix ecosystem, whose Core component remains read-only. It works against a repository supplied at launch and uses the Rust Weavatrix graph internally to gather evidence for refactoring operations.

Its main workflow is preview first, then apply. A request can return an edit plan, file content hashes, the number of edits proven by the backend, and any references that require human review. An apply request must repeat the operation with the short-lived confirmation token associated with that exact plan.

## How it works

The server exposes 11 Refactor methods. A bare symbol name that matches multiple declarations is rejected with candidate symbol identifiers rather than resolved arbitrarily. Once a specific symbol is selected, the server calculates the proposed changes and reports whether the result is complete or partial.

Every planned file carries a content hash. If the working tree changes before application, the old preview is considered stale and is not used. Applying source edits also requires the `WEAVATRIX_ALLOW_SOURCE_EDITS=1` gate and the plan's single-use token. Multi-file changes are journaled so a crashed transaction can be recovered, although unrelated processes may briefly observe an intermediate filesystem state.

The weavatrix-refactor MCP server does not expose Weavatrix Core's read-only methods. Install Core separately when repository intelligence beyond these refactoring methods is needed.

## Setup and configuration

Run the native server through npm with an absolute repository path:

```bash
npx -y weavatrix-refactor mcp /absolute/path/to/repository
```

Cargo installation is also supported:

```bash
cargo install weavatrix-refactor --locked
weavatrix-refactor mcp /absolute/path/to/repository
```

For MCP configuration, provide the executable command and repository path. `${workspaceFolder}` can be used with Cursor. Leave `WEAVATRIX_ALLOW_SOURCE_EDITS` unset for preview-only operation; confirmed applies and rollbacks require it to be set to `1`.

The default `refactor` profile exposes all 11 methods. The `rename` profile exposes only `rename_symbol` and `rollback_last_apply`, which can reduce the tool catalog for rename-focused agents. The removed `full` profile is not supported.

A bundled plugin is available for Cursor, Codex, Claude Code, and Grok Build. Its installation uses each client's marketplace process and starts the extension-only profile.

## Tools and capabilities

The supported methods fall into four groups:

- `rename_symbol` and `rename_related_symbols`: produce plans and support confirmed application.
- `change_signature`, `edit_symbol`, `bulk_replace`, `organize_imports`, and `move_file`: produce byte-exact edits or review plans; returned edit-plan envelopes can be passed to `apply_edit_plan`.
- `move_symbol` and `delete_readiness`: provide advisory impact, architecture, cycle, or deletion information without automatically writing source.
- `apply_edit_plan` and `rollback_last_apply`: verify or apply edit-plan envelopes and restore the latest transaction when drift checks pass.

The rename workflow can preserve unrelated longer identifiers, strings, comments, and shadowed symbols when the backend cannot prove they are targets. Such cases are reported rather than silently changed.

## Limitations and notes

A `PARTIAL` result means the server proved the edits in its plan but did not prove that no other semantic references exist. Its lexical or graph-based backend is intentionally more conservative than a language server and does not claim complete compiler semantics.

Rollback refuses to overwrite files that changed after the transaction. The server also does not silently retarget another repository during a session: the launch root is the repository it can edit. The write gate, confirmation token, exact plan, and hash checks remain in force even when the narrower rename profile is used.

_Full upstream README: https://allmcps.com/mcp/weavatrix-refactor/readme_

