Point openapi-sync at any remote or local OpenAPI specification. It pins the canonical SHA-256 hash, flags breaking contract changes in CI, and emits TypeScript types, six typed clients, runtime validators, and an 11-tool MCP server.
Compile OpenAPI constraints into Zod, Yup, or Joi schemas for DTOs, queries, and parameters alongside TypeScript interfaces—or target Python @dataclass types and typed endpoint helpers.
Lock canonical SHA-256 digests in .openapi-sync/lock.json and store deterministic snapshots. Gate pull requests with --frozen, build offline with --use-snapshot, and block breaking changes.
npx openapi-sync diff --fail-on-breaking
01.4MCP & AGENTS
11-Tool MCP Server & Agent-Safe CLI
Ship a standalone stdio MCP server (openapi-sync-mcp) plus non-blocking --json CLI commands with stable exit codes 0–3. Agents paginate endpoints and read exact types without blowing context windows.
Start with zero-config framework presets or serialize them cleanly with --preserve. Organize multi-API workspaces by tag folders, deduplicate URLs with sharedPaths, and load Bearer, Basic, or API Key auth from env.
No custom templates or AST boilerplate required. Configure once, lock the contract, and import typed hooks and validators.
01STEP 01
Configure your APIs
Declare your specification sources, framework preset, and optional version pin in openapi.sync.ts—or scaffold interactively with npx openapi-sync init.
Supports .ts, .js, and .json configs, plus process.env credentials for protected specs.
Run the compiler to generate TypeScript types, endpoint definitions, Zod validation schemas, and client hooks while recording a canonical SHA-256 lockfile.
Commit .openapi-sync/lock.json and .openapi-sync/snapshots/ so CI can enforce --frozen.
Import generated hooks, interfaces, and runtime validators directly into your application. Custom code inside protected markers survives every re-sync.
Method-level generics allow return-type overrides at any call site.
Run the interactive wizard locally or pass explicit flags for automated CI/agent provisioning.
terminal
bash
1
2
3
4
5
6
7
8
9
10
11
# Interactive setup wizard (TypeScript, JSON, or JS)
npx openapi-sync init
# Non-interactive setup for CI or AI agents (zero prompts)
npx openapi-sync init --no-interactive \
--api-name petstore \
--api-url https://petstore3.swagger.io/api/v3/openapi.json \
--output-folder ./src/api \--preset react-query-zod \
--config-format typescript \--json
06 / SHIP WITHOUT DRIFT
Keep your specs, types, and clients locked together.
Initialize a typed configuration in seconds, commit your snapshot lockfile, and let OpenAPI Sync guard every contract change across humans, CI pipelines, and MCP-enabled agents.