PHPackages                             dpt/mcp-rector-warm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dpt/mcp-rector-warm

ActiveProject[Utility &amp; Helpers](/categories/utility)

dpt/mcp-rector-warm
===================

Warm-process MCP server for Rector. Keeps the Rector container bootstrapped across calls — ~9x faster per-file analysis vs cold CLI invocation. Compatible with any MCP client (Claude Desktop, Cline, Continue, Zed, custom).

v0.2.1(2w ago)1785↑308.9%proprietaryPHPPHP &gt;=8.2CI passing

Since May 22Pushed 1w ago1 watchersCompare

[ Source](https://github.com/Digital-Process-Tools/mcp-rector-warm)[ Packagist](https://packagist.org/packages/dpt/mcp-rector-warm)[ Docs](https://github.com/Digital-Process-Tools/mcp-rector-warm)[ RSS](/packages/dpt-mcp-rector-warm/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (11)Used By (0)

 [![mcp-rector-warm — cold start dies. 9× faster per edit.](banner.png)](banner.png)

mcp-rector-warm
===============

[](#mcp-rector-warm)

> **Stop paying [Rector](https://getrector.com/)'s cold-start tax on every edit.**A warm-process [MCP](https://modelcontextprotocol.io/) server that keeps the [Rector](https://github.com/rectorphp/rector) container hot. ~9× faster per call. Works with every MCP client.

[![Tests](https://github.com/Digital-Process-Tools/mcp-rector-warm/actions/workflows/tests.yml/badge.svg)](https://github.com/Digital-Process-Tools/mcp-rector-warm/actions/workflows/tests.yml)[![Packagist](https://camo.githubusercontent.com/9e9c6172db3137ecc7cf5f966eca6f1237d4c11ded4511c86761357d63da9dcc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6470742f6d63702d726563746f722d7761726d2e737667)](https://packagist.org/packages/dpt/mcp-rector-warm)[![PHP](https://camo.githubusercontent.com/344e820b219cee3234648531306104364bd684892ad13c5dc79e66eb82a15b90/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322532422d626c7565)](https://www.php.net/)[![License](https://camo.githubusercontent.com/b070db700d7549b4414d6c41907c169824e89a1e3e949816af5828685facd257/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d436f6d6d756e6974792d627269676874677265656e)](LICENSE)

[Why](#why) • [Install](#install) • [Use it](#use-it) • [Benchmark](#benchmark) • [Compatibility](#compatibility) • [How it works](#how-it-works) • [FAQ](#faq)

---

Why
---

[](#why)

[Rector](https://getrector.com/) is one of the most useful tools in modern PHP — automated refactoring, type fixes, version upgrades. It is also one of the slowest to **start**.

Every `rector process foo.php` pays the same toll: autoloader bootstrap, [DI container](https://github.com/rectorphp/rector/blob/main/src/DependencyInjection) build, ruleset compile. **~3-5 seconds before a single rule fires.** For agents and validators that run Rector after every edit, that cold-start cost dominates wall time.

`mcp-rector-warm` runs Rector inside a long-lived PHP process. **First call pays the boot once. Every subsequent call reuses the live container.**

Install
-------

[](#install)

```
composer global require dpt/mcp-rector-warm
```

Makes `mcp-rector-warm` available on `$PATH`.

Requires PHP 8.2+. Pulls Rector ^2.4 as a real Composer dep (no phar gymnastics).

Use it
------

[](#use-it)

### Claude Desktop

[](#claude-desktop)

Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):

```
{
  "mcpServers": {
    "rector": {
      "command": "mcp-rector-warm",
      "args": [
        "--working-dir=/path/to/your/project",
        "--config=/path/to/your/project/rector.php"
      ]
    }
  }
}
```

Restart Claude. Ask: *"Run Rector on src/Foo.php"*.

### Cline / Continue / Cursor / Zed / any MCP client

[](#cline--continue--cursor--zed--any-mcp-client)

Same `command` + `args` shape. The server speaks plain MCP over stdio — no client-specific glue.

### Standalone

[](#standalone)

```
mcp-rector-warm --working-dir=/path/to/project --config=/path/to/project/rector.php
```

Reads MCP JSON-RPC on stdin, writes responses on stdout.

Benchmark
---------

[](#benchmark)

Measured on a real DVSI codebase (Rector config with 677 paths, ~50KB target file):

SetupPer-call wallNotesCold rector CLI~4500msautoloader + container + ruleset each time**mcp-rector-warm (warm)****~500ms**container reused, opcache hotDaemon cold boot~3000mspaid **once** at server start**~9× faster per call.** For a tool running Rector after 100 edits: **7.5 min → 50s.**

Numbers vary with project size and rule set. The win is the cold-start amortization, not magic.

Compatibility
-------------

[](#compatibility)

ClientStatusClaude Desktop✅ stdio MCPCline (VS Code)✅ stdio MCPContinue (VS Code / JetBrains)✅ stdio MCPCursor✅ stdio MCPZed✅ stdio MCPCustom (Python/Node/Go MCP clients)✅ standard protocolAny client that speaks MCP stdio works. No custom protocol.

Tools exposed
-------------

[](#tools-exposed)

### `rector_process`

[](#rector_process)

Run Rector on a path.

ArgumentTypeDefaultDescription`path`stringrequiredAbsolute path to file or directory under the working dir`dryRun`bool`true`Preview changes only. `false` writes them.Returns:

```
{
  "exit_code": 0,
  "output": "...",
  "warm_boot": true
}
```

`warm_boot: true` ⇒ container reused. `false` ⇒ first call (cold boot just finished).

How it works
------------

[](#how-it-works)

Three decisions worth knowing:

1. **One daemon per project, not per call.** Config + working dir pin at server startup. This keeps `$_SERVER['argv']` clean for `RectorConfigsResolver` and lets the container cache across every call.
2. **Parallel mode forcibly disabled (`--debug` flag).** Rector's worker fork model expects `$_SERVER['argv'][0]` to be the rector CLI binary. From an MCP server it isn't, so workers can't respawn. Single-thread analysis only — that's fine for the per-file edit loop this is designed for.
3. **Runtime-prefixed namespace handled.** Rector's bundled Symfony is namespaced `RectorPrefix\\Symfony\\Component\\Console\\...` to avoid dependency conflicts. The runner detects the prefix at boot and resolves Application/Input/Output class names dynamically. Survives Rector version bumps.

FAQ
---

[](#faq)

**Does this replace `vendor/bin/rector`?** No. Use it from MCP clients (Claude Desktop, agents). For one-off CLI calls the regular binary is still simpler.

**Does it support `rector --fix`?** Yes — pass `dryRun: false` to apply changes.

**Why not a phar?** Rector ships as a real Composer library. Phar packaging would just add a runtime cost without a benefit here.

**Memory?** The daemon sets `memory_limit = -1` like Rector's own CLI. Idle daemon ≈ 80MB resident.

**Does it survive Rector version updates?** Probably. The prefix-detection scheme is forward-compatible with new `RectorPrefix` values. Pin a Rector version in your own `composer.json` if you need determinism.

Credits
-------

[](#credits)

- **[Rector](https://github.com/rectorphp/rector)** by [Tomas Votruba](https://github.com/TomasVotruba) and contributors — the engine doing all the real work. If you ship PHP, [sponsor him](https://github.com/sponsors/TomasVotruba).
- **[Model Context Protocol](https://modelcontextprotocol.io/)** by Anthropic — the protocol that makes this kind of tool integration possible.
- **[mcp/sdk](https://github.com/modelcontextprotocol/php-sdk)** — official PHP SDK, used here for stdio transport + tool discovery.

Related
-------

[](#related)

- **[Rector docs](https://getrector.com/documentation)** — config, rules, sets.
- **[Rector on Packagist](https://packagist.org/packages/rector/rector)** — the upstream package.
- **[claude-supertool](https://github.com/Digital-Process-Tools/claude-supertool)** — DPT's batched-ops Claude Code companion; integrates this server as a validator.

License
-------

[](#license)

Community License — see [LICENSE](LICENSE). Built by [Digital Process Tools](https://github.com/Digital-Process-Tools).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance97

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

9

Last Release

18d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f66a351c6f0ebbc539c3ef7b59a2aa0a1921f04406119001c1978cff06975721?d=identicon)[fdaviddpt](/maintainers/fdaviddpt)

---

Top Contributors

[![fdaviddpt](https://avatars.githubusercontent.com/u/150798857?v=4)](https://github.com/fdaviddpt "fdaviddpt (1 commits)")

---

Tags

ai-toolsclaudeclaude-codedeveloper-toolsmcpmodel-context-protocolphprectorrefactoringstatic-analysisphpstatic analysisrefactoringmcpclauderectorModel Context Protocolai-tools

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dpt-mcp-rector-warm/health.svg)

```
[![Health](https://phpackages.com/badges/dpt-mcp-rector-warm/health.svg)](https://phpackages.com/packages/dpt-mcp-rector-warm)
```

###  Alternatives

[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2603.0M381](/packages/ssch-typo3-rector)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k44](/packages/friendsoftypo3-content-blocks)[symfony/ai-mate

AI development assistant MCP server for Symfony projects

22104.4k21](/packages/symfony-ai-mate)[mrpunyapal/rector-pest

Rector upgrade rules for Pest - refactoring and best practices for Pest testing framework

6455.5k49](/packages/mrpunyapal-rector-pest)[stimmt/craft-mcp

MCP (Model Context Protocol) server for Craft CMS

251.3k](/packages/stimmt-craft-mcp)[wordpress/php-mcp-schema

PHP DTOs for the Model Context Protocol (MCP) specification

1245.4k1](/packages/wordpress-php-mcp-schema)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
