# Weavatrix Refactor

> Weavatrix Refactor is an open-source MCP server for developer tools. Transactional refactoring for coding agents: previews, apply gate and rollback. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted
- **Website:** https://weavatrix.com
- **Repository:** https://github.com/weavatrix/weavatrix-refactor
- **MCP Registry name:** io.github.Weavatrix/weavatrix-refactor
- **Categories:** developer tools
- **Listing updated:** 2026-11-14

## About

Refactor is the write-capable member of the Weavatrix family, installed separately and composing the read-only Core. It adds evidence-backed plans, write-gated apply and drift-checked rollback. The registry counts 12 tools; the site describes 11 MCP methods.

By default it is preview-only. Previews are byte-exact and report every same-named occurrence the tool could not safely change. Applying or rolling back needs `WEAVATRIX_ALLOW_SOURCE_EDITS=1` and a single-use token bound to the exact preview, so a token from one child process does not work in another.

A `rename` profile exposes only `rename_symbol` and `rollback_last_apply`, which the site says cuts fixed MCP context from 9,331 to 485 measured tokens. The profile narrows context but does not grant write authority. The package is MIT licensed on npm.

## Features

- **Preview first:** Byte-exact previews before any write.
- **Write gate:** Edits need an environment flag and a plan-bound token.
- **Drift-checked rollback:** Undo the last apply.
- **Rename profile:** Expose only two tools for rename tasks.
- **Unsafe-match report:** Lists same-named occurrences it left alone.

## Good for

- Rename a symbol across a codebase with a reviewed preview
- Roll back an agent's last refactor
- Limit an agent to preview-only changes
- Keep tool context small for a single task

## Install

### Claude Code (Terminal)

```sh
claude mcp add weavatrix-refactor -- npx -y weavatrix-refactor
```

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "weavatrix-refactor": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "weavatrix-refactor"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

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

## Tools

- `rename_symbol`: Renames a symbol using an evidence-backed plan.
- `rollback_last_apply`: Rolls back the last applied refactor, checking for drift.

## FAQ

### Can it edit files by default?

No. It stays preview-only until WEAVATRIX_ALLOW_SOURCE_EDITS is set to 1.

### What does the rename profile do?

It exposes only rename_symbol and rollback_last_apply.

### Does the profile grant write access?

No, it only narrows what the agent sees.

### Is it MIT?

The site lists Refactor among MIT packages.

### Is Weavatrix Refactor free?

Yes. Weavatrix Refactor is open source, so you can use and self-host it for free.

### How do I add Weavatrix Refactor to Claude Code?

Run this command in your terminal: claude mcp add weavatrix-refactor -- npx -y weavatrix-refactor

### What are the best alternatives to Weavatrix Refactor?

The closest alternatives to Weavatrix Refactor are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/weavatrix-refactor-2
