The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Zod Contract Mock Forge MCP listing page.
An MCP server that turns Zod schemas into mocks, violations, and contract tests — so your AI agent can reason about API contracts without manually crafting payloads.
Zod schemas are runtime code. An AI agent cannot execute them, introspect their constraints, or generate valid/invalid payloads without this layer. The agent also cannot detect when the schema and the OpenAPI docs silently diverged, or whether a schema change breaks existing test fixtures.
| Tool | Arguments | What it returns |
|---|---|---|
generate_valid_mock | schema_code, count? | Valid mock data matching the schema |
generate_mock_variants | schema_code, count?, seed? | N structurally valid but value-diverse mocks — for property-based testing |
| Tool | Arguments | What it returns |
|---|---|---|
generate_boundary_violations | schema_code | Invalid payloads for each constraint: missing fields, type mismatches, min/max, email/uuid/url |
generate_exhaustive_union_violations | schema_code | Per-variant violations for every branch of a z.union() or z.discriminatedUnion() |
| Tool | Arguments | What it returns |
|---|---|---|
introspect_schema | schema_code | JSON Schema representation — for LLM understanding of the contract |
read_schema_from_file | file_path, export_name? | Extracts the Zod schema expression from a TypeScript/JS file |
detect_schema_drift | zod_file_path, schema_export_name, openapi_file_path, openapi_schema_name? | Diffs Zod vs OpenAPI — reports missing_in_openapi, missing_in_zod, type_conflict, required_mismatch |
evaluate_schema_evolution | schema_file_path, schema_export_name, old_schema_content? | Generates mocks from old schema, validates against new — detects breaking changes before tests run |
| Tool | Arguments | What it returns |
|---|---|---|
scaffold_api_contract_test | framework, base_url, endpoint, method, schema_code, test_name? | Contract test boilerplate for Playwright, Jest, Vitest, or MSW |
suggest_contract_fix | schema_code, payload | Validates a JSON payload and explains each violation with a fix suggestion |
.cursor/mcp.json or .vscode/mcp.json)generate_mock_variants — 3 diverse valid mocks, seeded for CI:
detect_schema_drift — field missing in OpenAPI, extra field in Zod:
evaluate_schema_evolution — new required field breaks existing mocks:
MIT