About Stateless Migrator
Stateless Migrator is a CLI for maintainers of TypeScript and JavaScript MCP servers checking compatibility with MCP-Spec 2026-07-28 RC. It scans for violations, previews and applies a limited safe AST rewrite, and verifies code against the spec.
Key features
- 01Scan code for spec violations
- 02Preview planned changes as diffs
- 03Apply the supported AST rewrite
- 04Verify code against the spec
- 05Generate coverage reports
Use cases
- 01Audit an MCP server before a spec upgrade
- 02Review planned changes before applying them
- 03Update matching error-code properties
- 04Check whether migration issues remain
MCP support
This CLI scans and migrates MCP server codebases for compatibility with MCP-Spec 2026-07-28 RC. It does not describe an MCP server endpoint of its own.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEPart of the StudioMeyer MCP Stack — Built in Mallorca 🌴 · ⭐ if you use it
mcp-stateless-migrator
CLI tool that scans MCP-server codebases for incompatibilities with MCP-Spec 2026-07-28 RC (Stateless Core, mandatory headers, deprecated features, error-code shift, OAuth hardening, endpoint-shape changes) and applies safe AST-rewrites where mechanically possible.
Target users: maintainers of TypeScript/JavaScript MCP servers (the largest SDK userbase, @modelcontextprotocol/sdk).
Status: v0.1.2 — pre-final-RC. Detection rules are tagged with specRevision: 2026-07-28-rc-2026-05-21 and cite the canonical SEP files. v0.2.0 will re-validate against the Tier-1 SDK final release.
Install
npm install -g mcp-stateless-migrator
# or one-shot:
npx mcp-stateless-migrator scan ./src
Requires Node >= 20.
CLI
| # | Command | Args | Output | Read-only | Destructive |
|---|---|---|---|---|---|
| 1 | scan | <path> [--format json|text|md|html] | violations + severity | yes | no |
| 2 | diff | <path> [--output <file>] | unified diff of planned patches | yes | no |
| 3 | patch | <path> [--dry-run] [--no-backup] [--only <id...>] | rewrites files + writes backup folder | no | yes |
| 4 | verify | <path> [--spec <rev>] | exit 0 = clean | yes | no |
| 5 | report | <path> [--format json|md|html] | coverage report | yes | no |
| 6 | rules | [--verbose] | list all detection rules | yes | no |
Detection rules
| Rule | Severity | Auto-patch | Source |
|---|---|---|---|
r01-stateless-core | warn | no | SEP-2567 |
r02-mandatory-headers | info | no | SEP-2243 |
r03-tasks-extension | warn | no | SEP-2663 |
r04-apps-extension | info | no | SEP-1865 |
r05-deprecations | warn | no | SEP-2577 |
r06-error-code-shift | error | yes | SEP-2164 |
r07-oauth-hardening | warn | no | SEP-2468 |
r08-endpoint-shape | warn | no | SEP-2596 |
Only r06 rewrites code automatically — it swaps -32002 -> -32602 inside any property named code (identifier key, "code"/'code' string key, or class field), and leaves computed keys and same-value-but-different-name properties untouched. SEP-2164 is Draft status as of the RC, so re-validate before the final spec; every patch is backed up by default. Every other rule requires a human reviewing the planned change — server architecture varies too much for blind auto-patching.
Usage
# 1. See what the migrator finds
mcp-stateless-migrator scan ./src --format text
# 2. Preview the auto-patch as a unified diff
mcp-stateless-migrator diff ./src
# 3. Apply only the safe error-code shift, with backup
mcp-stateless-migrator patch ./src --only r06-error-code-shift
# 4. Confirm the codebase is clean
mcp-stateless-migrator verify ./src
# 5. Generate a Markdown report for the team
mcp-stateless-migrator report ./src --format md > migration-report.md
Exit codes:
0— clean (no violations OR patch applied successfully)1— violations remaining / diff non-empty2— invalid CLI arguments
Backup folder
patch creates <path>/.bak.<ISO-timestamp>/ containing the original file tree for every file it touched. Pass --no-backup to disable (not recommended). Restore via cp -r .bak.<timestamp>/. ..
Programmatic API
import { scanPath, patchPath, formatScan } from "mcp-stateless-migrator";
const report = await scanPath("./src");
console.log(formatScan(report, "json"));
await patchPath("./src", { dryRun: false, backup: true, only: ["r06-error-code-shift"] });
Custom patterns accept at most 128 strings. Each string is limited to 1024
UTF-16 code units and 16 unescaped opening grouping characters ((, {,
[). Inputs above these budgets raise a controlled error before matching.
Use patterns relative to the scan root. Ignore rules apply within that root;
an ignored name in an ancestor path does not exclude an explicitly selected
root.
Ecosystem
This tool complements:
mcp-spec-migrator— TypeScript CLI for the previous spec step (2025-06-18 -> 2025-11-25).mcp-protocol-conformance— Rust runtime conformance validator.
See ECOSYSTEM.md for the full positioning matrix.
License
MIT — Copyright © 2026 Matthias Meyer (StudioMeyer).
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.