The full migration specification is maintained at github.com/FlowMCP/flowmcp-spec. This page provides a practical walkthrough.
Schema Categories
Existing schemas fall into three categories based on migration effort:| Category | % of Schemas | Migration Effort | Description |
|---|---|---|---|
| Pure declarative | ~60% | Automatic | No handlers, no imports. Only URL construction and parameters. |
| With handlers | ~30% | Semi-automatic | Has preRequest/postRequest handlers but no imports. |
| With imports | ~10% | Manual review | Imports shared data that must become shared list references. |
Migration Steps
Wrap existing fields in main block
The biggest structural change — fields move into a After (v2.0.0):Key changes:
main export, and handlers become a separate factory function.Before (v1.2.0):- Two separate named exports:
main(static) andhandlers(factory function) flowMCP: '1.2.0'becomesversion: '2.0.0'handlersis now a factory function receiving{ sharedLists, libraries }- New field
requiredLibrariesdeclares needed npm packages - Zero import statements
Update version field
| Before | After |
|---|---|
flowMCP: '1.2.0' | version: '2.0.0' |
version field moves inside main and follows semver starting with 2..Convert imports to shared list references
Before (v1.2.0):After (v2.0.0):Key changes:
- Remove
importstatement entirely (zero imports policy) - Add
sharedListsreference inmain - Access list data via
sharedLists.evmChains(injected by factory function)
Add output schemas (optional but recommended)
New in v2.0.0 — declare expected response shapes:Optional in v2.0.0, will become recommended in v2.1.0.
Run security scan
main, handler constraints met, shared list references valid.Automatic Migration Tool
A CLI command assists with migration:- Reads the v1.2.0 schema
- Wraps fields in
mainblock - Updates version field
- Detects imports and suggests shared list conversions
- Writes the v2.0.0 schema to
<name>.v2.mjs - Runs validation on the new file
Backward Compatibility
| Feature | v1.2.0 Schema | v2.0.0 Schema |
|---|---|---|
| Core v1.x runtime | Supported | Not supported |
| Core v2.0 runtime | Supported (legacy mode) | Supported |
| Core v3.0 runtime (future) | Deprecated | Supported |
- Detects v1.2.0 format (no
mainwrapper, hasflowMCPfield) - Internally wraps in
mainblock at load-time - Emits deprecation warning:
WARN: Schema uses v1.2.0 format. Run "flowmcp migrate <path>" to upgrade. - All features work except: shared list references, output schema, groups, async
Common Migration Issues
| Issue | Cause | Fix |
|---|---|---|
SEC001: Forbidden pattern "import" | Import statement still present | Convert to sharedLists reference |
VAL003: "flowMCP" is not a valid field | Old version field | Change to version inside main |
VAL007: Route count exceeds 8 | v1.2.0 allowed 10 routes | Split schema into two files |
VAL012: Handler references undefined route | Route name mismatch after refactor | Align handler keys with route keys |
Migration Checklist
Per schema:- Fields wrapped in
mainblock -
flowMCP: '1.2.0'changed toversion: '2.0.0'insidemain -
handlersat top level (sibling ofmain) - All
importstatements removed - Imported data converted to
sharedListsreferences - Handler code uses
sharedListsvia factory injection -
requiredLibrariesdeclared (can be empty[]) - Security scan passes (
flowmcp validate --security) - Full validation passes (
flowmcp validate) - All routes still functional (manual or automated test)