JSON Contracts MCP Server

JSON contract registry and validator for structured LLM and agent outputs.

Local serverstdioTypeScript

What is the JSON Contracts MCP server?

JSON contract registry and validator for structured LLM and agent outputs. That is what the json contracts mcp server brings to an AI assistant: the same capability, reachable through the Model Context Protocol rather than a separate app or dashboard.

The short version

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 tools it exposes

The server publishes 8 tools. What each one is for:

  • list_contracts — The list_contracts tool exposed by this server
  • read_contract — Returns the selected contract's description, rules, operations, schema, examples, contractHash, and schemaHash
  • get_json_contract — The agent/model uses this contract to produce JSON. The MCP server does not produce it
  • get_edit_contract — The agent/model uses this edit contract to return the complete updated JSON object. The MCP server first validates currentJson against the selected
  • validate_json — valid is never true unless Ajv validates the JSON against the contract schema
  • get_repair_contract — The agent/model uses this repair contract to produce corrected JSON. The MCP server does not repair by calling a model. When validation errors are
  • status — Use this to debug host configuration, loaded contracts, and the exact contract/schema hashes in use
  • reload_contracts — The reload_contracts tool exposed by this server

Getting it running

Installation goes through your MCP client rather than a global install: point it at json-contracts on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

What it needs from you

Configuration is passed through the environment: JSON_CONTRACTS_DIR, API_AUTH_TOKEN. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

How it compares

Plenty of AI and media services servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. JSON Contracts's toolset — list_contracts, read_contract, get_json_contract and 5 more — is a fair guide to whether it matches your workflow. It is maintained by json-contracts; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
list_contractsThe list_contracts tool exposed by this server.
read_contractReturns the selected contract's description, rules, operations, schema, examples, contractHash, and schemaHash.
get_json_contractThe agent/model uses this contract to produce JSON. The MCP server does not produce it.
get_edit_contractThe agent/model uses this edit contract to return the complete updated JSON object. The MCP server first validates currentJson against the selected contract, and the agent should validate the edited object with validate_
validate_jsonvalid is never true unless Ajv validates the JSON against the contract schema.
get_repair_contractThe agent/model uses this repair contract to produce corrected JSON. The MCP server does not repair by calling a model. When validation errors are available, instructions also includes deterministic field-specific repair
statusUse this to debug host configuration, loaded contracts, and the exact contract/schema hashes in use.
reload_contractsThe reload_contracts tool exposed by this server.

How to install the JSON Contracts MCP server

## MCP config

```json
{
  "mcpServers": {
    "json-contracts": {
      "command": "npx",
      "args": ["-y", "json-contracts@latest"],
      "env": {
        "JSON_CONTRACTS_DIR": "./json-contracts"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
JSON_CONTRACTS_DIRFilesystem location the server is allowed to use.Optional
API_AUTH_TOKENCredential the server authenticates with.Yes

Example prompts to try

  • Use JSON Contracts to list contracts.
  • Use JSON Contracts to read contract.
  • Use JSON Contracts to get json contract.

Frequently asked questions

It connects JSON Contracts to MCP-compatible AI assistants such as Claude and Cursor, exposing 8 tools (list_contracts, read_contract, get_json_contract, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with JSON Contracts directly.