JSON contract registry and validator for structured LLM and agent outputs.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
💡 Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
JSON Contracts is a local MCP contract server for natural-language-to-JSON workflows. It gives agents Git-controlled JSON contracts, rules, examples, and JSON Schema validation tools so any model can reliably convert natural-language requests into schema-valid JSON.
The MCP server does not call an LLM provider. The MCP server does not need API keys. The MCP server does not use BAML, LangChain, Markdown, or a DSL. The MCP server does not use MCP sampling. The MCP server does not generate JSON by itself.
The optional Studio is a separate package/repo for live demos and local contract testing. The MCP stdio server itself does not call LLM providers.
Your user provides natural language.
Your agent chooses the model.
Your agent performs the natural-language-to-JSON conversion.
json-contracts provides the contract and validates the result.
Not this:
This:
Like TypeScript:
With json-contracts:
The MCP server never performs natural-language-to-JSON conversion itself. It only provides contracts, validation, and repair guidance.
Install globally:
Or run without installing:
The npm package is json-contracts; the installed CLI binary is still json-contracts.
Create a starter contract folder and validate it:
Then add the MCP config below to your agent host. Point JSON_CONTRACTS_DIR at the json-contracts folder that init created.
Validate contracts in CI without starting MCP:
By default, the server starts as a local stdio MCP server and loads contracts from:
Adding a new behavior only requires adding a new .json file to the contracts folder. No MCP config change is required.
Most MCP hosts use the same stdio shape. Adapt paths for your machine and point JSON_CONTRACTS_DIR at your app-owned contracts folder.
If npx startup is too slow or your host requires explicit executables, install globally and use:
Use json-contracts as a local contract/validation tool beside the model your app already uses.
If your agent host supports MCP, add the server config above and point JSON_CONTRACTS_DIR at the contracts folder your app owns.
If your app has its own agent runtime, connect to the same MCP stdio server and call the tools directly. The important part is the flow, not the host.
Create files such as:
Each file contains:
schema for the final JSON shaperules for app-specific mapping behaviorexamples for model guidanceoperations for create/edit behaviorcontextDo not hide runtime variables in the user prompt. Pass them as context:
json-contracts passes context through unchanged. Contracts decide how to use it through rules/examples. The final JSON still must match the schema.
Use this as the system/developer instruction for your agent:
At request time, your app should do:
The MCP server does not call the model and does not mutate output. Your app/agent remains in control of model choice, provider keys, context, and business defaults.
Each contract is one .json file in json-contracts/.
The contract name is derived from the filename:
There is no manifest file and no manually maintained resources file. Git handles versioning.
Rules:
schema is required and must be valid JSON Schema. Omit $schema for the default 2020-12 validator, or set $schema to draft-07 or 2020-12 explicitly.description is optional but recommended.rules is optional and defaults to [].examples is optional and defaults to []. Example output values must validate against schema.operations is optional and defaults to enabled create and edit operations. Operation metadata belongs at the top level, not inside the JSON Schema.name is optional, but the filename is the source of truth.version field is rejected; use Git for versioning.The default json-contracts/ folder includes examples from different app categories where teams commonly rebuild the same AI glue code:
| Contract | Industry/app pattern | Converts natural language into |
|---|---|---|
support-ticket | SaaS support | Triage-ready support tickets. |
create-filter | Internal tools/API builders | API filter objects. |
chart-generation | BI/analytics tools | Dashboard chart generation specs. |
patient-intake | Healthcare intake | Triage and appointment-routing objects. |
ecommerce-return | Ecommerce support | Return, refund, exchange, and warranty requests. |
real-estate-lead | Real estate CRM | Buyer, renter, seller, and lease lead profiles. |
legal-client-intake | Legal tech intake | Matter routing and conflict-check data. |
expense-report | Finance/expense apps | Reimbursement and expense line items. |
No reviews yet — be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/json-contracts)<a href="https://allmcps.com/mcp/json-contracts"><img src="https://allmcps.com/api/badge/json-contracts?style=directory" alt="JSON Contracts on AllMCPs" /></a>