Zod Contract Mock Forge
БесплатноНе проверенAn MCP server that turns Zod schemas into mocks, violations, and contract tests, enabling AI agents to reason about API contracts without manually crafting payl
Описание
An MCP server that turns Zod schemas into mocks, violations, and contract tests, enabling AI agents to reason about API contracts without manually crafting payloads.
README
npm version npm downloads CI License: MIT
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.
The Problem
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.
Tools
Mock generation
| 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 |
Violation generation
| 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() |
Schema analysis
| 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 |
Contract testing
| 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 |
Setup
1. Install
npm install -g zod-contract-mock-forge-mcp
2. Add to your editor
Cursor / VS Code (.cursor/mcp.json or .vscode/mcp.json)
{
"mcpServers": {
"zod-forge": {
"command": "zod-contract-mock-forge-mcp"
}
}
}
Claude Code
claude mcp add zod-forge zod-contract-mock-forge-mcp
Example usage
My schema file is src/schemas/user.ts, exported as UserSchema.
My OpenAPI spec is docs/openapi.yaml.
1. introspect_schema — what are the constraints on this schema?
2. generate_mock_variants — give me 10 diverse valid payloads (seed: 42) for CI reproducibility
3. generate_exhaustive_union_violations — test every branch of the role discriminated union
4. detect_schema_drift — has the Zod schema diverged from the OpenAPI docs?
5. evaluate_schema_evolution — does my schema change break any existing mock data?
Example output
generate_mock_variants — 3 diverse valid mocks, seeded for CI:
{
"schema_id": "schema_a1b2c3d4",
"count": 3,
"all_valid": true,
"variants": [
{ "name": "Colleen Rowe", "age": 37 },
{ "name": "Pat Reynolds", "age": 24 },
{ "name": "Veronica Konopelski", "age": 45 }
]
}
detect_schema_drift — field missing in OpenAPI, extra field in Zod:
{
"drift_count": 2,
"drifts": [
{
"field_path": "role",
"drift_type": "missing_in_openapi",
"zod_value": "string",
"openapi_value": null
},
{
"field_path": "email",
"drift_type": "missing_in_zod",
"zod_value": null,
"openapi_value": "string"
}
]
}
evaluate_schema_evolution — new required field breaks existing mocks:
{
"breaking_change": true,
"sample_count": 20,
"invalid_mock_count": 20,
"failure_reasons": [
{
"field_path": "status",
"zod_code": "invalid_type",
"expected": "string",
"received": "undefined",
"affected_mock_count": 20
}
]
}
Scripts
npm run build # compile TypeScript → dist/
npm run lint # ESLint
npm run format # Prettier --write
npm run format:check # Prettier check (used in CI)
npm test # Vitest
License
MIT
Установка Zod Contract Mock Forge
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/vola-trebla/zod-contract-mock-forge-mcpFAQ
Zod Contract Mock Forge MCP бесплатный?
Да, Zod Contract Mock Forge MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Zod Contract Mock Forge?
Нет, Zod Contract Mock Forge работает без API-ключей и переменных окружения.
Zod Contract Mock Forge — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Zod Contract Mock Forge в Claude Desktop, Claude Code или Cursor?
Открой Zod Contract Mock Forge на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
автор: lastmile-aiSpring AI MCP Client
Provides auto-configuration for MCP client functionality in Spring Boot applications.
mcp.natoma.ai
A Hosted MCP Platform to discover, install, manage and deploy MCP servers by [Natoma Labs](https://www.natoma.ai)
MCPHub
Website to list high quality MCP servers and reviews by real users. Also provide online chatbot for popular LLM models with MCP server support.
MCP Servers Rating and User Reviews
Website to rate MCP servers, write authentic user reviews, and [search engine for agent & mcp](http://www.deepnlp.org/search/agent)
mkinf
An Open Source registry of hosted MCP Servers to accelerate AI agent workflows.
Compare Zod Contract Mock Forge with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
