JSON Contracts
What it does
JSON contract registry and validator for structured LLM and agent outputs.
- Connects パソコンで動く
- Account or key No key needed
- Category 開発者ツール
一緒に使える
この種の作業を AI に教える Skill。これと一緒に使えます
graphify
Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local deterministic AST parsing, every edge explained, no vector store.
archify
Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
この順位の理由
一覧は利用スコア(100 点満点)で並びます。内訳は次のとおり
| 人気 | 4/80 | GitHub スターか週間ダウンロード数。大きい方を 60、小さい方を 20 で数えます |
|---|---|---|
| 新しさ | 3/12 | 30 日以内のリリースかコード更新で満点 |
| 応答中 | 0/8 | 前回の確認でクラウドのエンドポイントが応答 |
| 利用スコア | 7/100 |
品質: 基本チェック 1/3 項目に合格(表示のみ、並び順には不使用) · 勢い: データなし (「急上昇」タブでのみ使用)
インストール
使っているAIアプリを選んで、設定をコピーしてください。
チェック 1/3 合格 · あなたのパソコンで動きます · ✓ コマンド確認済み 2026年11月14日
まず:どの AI を使っていますか?
使っているアプリを選ぶと、下に手順が表示されます。
Claude につなげますが、先に準備が必要です
先にパソコンへ Node.js を入れてください(1 回だけ) · パソコン版 Claude アプリ(Windows または Mac)のみ。Web やスマホでは使えません
AI にインストールしてもらう
このメッセージを Claude のチャットに貼り付けます。AI がパソコンを確認し、変更するファイルを伝え、毎回あなたの了承を待ちます。
このパソコンの Claude に MCP server JSON Contracts を入れてください。順番に:1) node -v で Node.js があるか確認。なければ https://nodejs.org/en/download から入れるよう私に伝え、自分では入れない。2) この設定だけを使う(PopNx MCP の確認済み):{ "mcpServers": { "json-contracts": { "command": "npx", "args": [ "-y", "json-contracts" ] } } } 3) 変更するファイルのフルパスか実行するコマンドを伝えて、私の了承を待つ。4) キーは不要。5) 了承した内容を実行し、JSON Contracts のツールが本当に表示されるか確認する。このメッセージにあなたのキーは含まれません。キーが必要な場合は、AI がファイルやアプリの入力欄にご自身で貼るよう案内します。
Node.js を入れる(まだなければ)
もう入っていますか?先に確認 · ターミナルを開き、このコマンドを入力して Enter
node -v- バージョン番号(例 v26.13.1)が出る = 入っています。この手順は飛ばせます
- "command not found"(Windows では "is not recognized")が出る = まだ入っていないか、入れた直後でターミナルを開き直す必要があります
ターミナルの開き方
Mac:⌘ + Space を押し、Terminal と入力して Enter
Windows:スタートメニューを開き、Windows PowerShell と入力して「開く」
まだ入っていない場合: 公式ダウンロードページで LTS 版と、クリックで進むインストーラーを選びます:Mac は .pkg、Windows は .msi。ダブルクリックして最後まで進めるだけで、curl コマンドは不要です
入れ終わったらターミナルを閉じて開き直し、同じコマンドをもう一度実行します。バージョン番号が出れば完了です:
node -v一度入れれば、Node.js を使うすべてのツールで使えます
パソコン版 Claude アプリの設定ファイルを開く
SettingsDeveloperEdit Config
この設定を貼り付けて保存
{ "mcpServers": { "json-contracts": { "command": "npx", "args": [ "-y", "json-contracts" ] } } }Claude を終了してもう一度開く
試してみる
JSON Contracts を使って、私に何ができるか教えて、1 つやってみせて✓ Claude が JSON Contracts を使っていると言うか、回答に JSON Contracts のツール名が出れば接続成功です
追加の設定 1 項目(入力しなくても使えます)
上のコマンドはこれらがなくても動きます。変えたいときだけ作者の説明に沿って追加してください。
JSON_CONTRACTS_DIRFolder containing JSON contract files. Defaults to ./json-contracts.
説明は英語の原文のままです。
メニュー名は 2026年11月11日 に Anthropic のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります
ChatGPT はまだ JSON Contracts につなげません
JSON Contracts はパソコンに入れて使うものですが、ChatGPT は Web 上で動くサーバーにしかつなげません
代わりにできること
A · JSON Contracts につなげるアプリを使う
- 先にパソコンへ Node.js を入れてください(1 回だけ) · パソコン版 Claude アプリ(Windows または Mac)のみ。Web やスマホでは使えません
- 先にパソコンへ Node.js を入れてください(1 回だけ)
- 先にパソコンへ Node.js を入れてください(1 回だけ)
- 先にパソコンへ Node.js を入れてください(1 回だけ)
B · 開発者ツール の中で ChatGPT につなげる別のサーバー
同じカテゴリでよく使われているものから、キーなしでアドレスだけでつなげるものを選びました
- Sentry✓ ChatGPT
- Compiler Explorer✓ ChatGPT
- GitDiagram✓ ChatGPT
Claude Code につなげますが、先に準備が必要です
先にパソコンへ Node.js を入れてください(1 回だけ)
AI にインストールしてもらう
このメッセージを Claude Code のチャットに貼り付けます。AI がパソコンを確認し、変更するファイルを伝え、毎回あなたの了承を待ちます。
このパソコンの Claude Code に MCP server JSON Contracts を入れてください。順番に:1) node -v で Node.js があるか確認。なければ https://nodejs.org/en/download から入れるよう私に伝え、自分では入れない。2) この設定だけを使う(PopNx MCP の確認済み):claude mcp add --scope user json-contracts -- npx -y json-contracts 3) 変更するファイルのフルパスか実行するコマンドを伝えて、私の了承を待つ。4) キーは不要。5) 了承した内容を実行し、JSON Contracts のツールが本当に表示されるか確認する。このメッセージにあなたのキーは含まれません。キーが必要な場合は、AI がファイルやアプリの入力欄にご自身で貼るよう案内します。
Node.js を入れる(まだなければ)
もう入っていますか?先に確認 · ターミナルを開き、このコマンドを入力して Enter
node -v- バージョン番号(例 v26.13.1)が出る = 入っています。この手順は飛ばせます
- "command not found"(Windows では "is not recognized")が出る = まだ入っていないか、入れた直後でターミナルを開き直す必要があります
ターミナルの開き方
Mac:⌘ + Space を押し、Terminal と入力して Enter
Windows:スタートメニューを開き、Windows PowerShell と入力して「開く」
まだ入っていない場合: 公式ダウンロードページで LTS 版と、クリックで進むインストーラーを選びます:Mac は .pkg、Windows は .msi。ダブルクリックして最後まで進めるだけで、curl コマンドは不要です
入れ終わったらターミナルを閉じて開き直し、同じコマンドをもう一度実行します。バージョン番号が出れば完了です:
node -v一度入れれば、Node.js を使うすべてのツールで使えます
ターミナルを開く
Mac:Command+スペースで Terminal と入力 · Windows:PowerShell を開く
このコマンドを貼り付けて Enter
claude mcp add --scope user json-contracts -- npx -y json-contractsClaude Code で /mcp と入力
JSON Contracts が一覧にあり、接続済みと表示されれば OK です
試してみる
JSON Contracts を使って、私に何ができるか教えて、1 つやってみせて✓ Claude Code が JSON Contracts を使っていると言うか、回答に JSON Contracts のツール名が出れば接続成功です
追加の設定 1 項目(入力しなくても使えます)
上のコマンドはこれらがなくても動きます。変えたいときだけ作者の説明に沿って追加してください。
JSON_CONTRACTS_DIRFolder containing JSON contract files. Defaults to ./json-contracts.
説明は英語の原文のままです。
メニュー名は 2026年11月11日 に Anthropic のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります
Cursor につなげますが、先に準備が必要です
先にパソコンへ Node.js を入れてください(1 回だけ)
AI にインストールしてもらう
このメッセージを Cursor のチャットに貼り付けます。AI がパソコンを確認し、変更するファイルを伝え、毎回あなたの了承を待ちます。
このパソコンの Cursor に MCP server JSON Contracts を入れてください。順番に:1) node -v で Node.js があるか確認。なければ https://nodejs.org/en/download から入れるよう私に伝え、自分では入れない。2) この設定だけを使う(PopNx MCP の確認済み):{ "mcpServers": { "json-contracts": { "command": "npx", "args": [ "-y", "json-contracts" ] } } } 3) 変更するファイルのフルパスか実行するコマンドを伝えて、私の了承を待つ。4) キーは不要。5) 了承した内容を実行し、JSON Contracts のツールが本当に表示されるか確認する。このメッセージにあなたのキーは含まれません。キーが必要な場合は、AI がファイルやアプリの入力欄にご自身で貼るよう案内します。
Node.js を入れる(まだなければ)
もう入っていますか?先に確認 · ターミナルを開き、このコマンドを入力して Enter
node -v- バージョン番号(例 v26.13.1)が出る = 入っています。この手順は飛ばせます
- "command not found"(Windows では "is not recognized")が出る = まだ入っていないか、入れた直後でターミナルを開き直す必要があります
ターミナルの開き方
Mac:⌘ + Space を押し、Terminal と入力して Enter
Windows:スタートメニューを開き、Windows PowerShell と入力して「開く」
まだ入っていない場合: 公式ダウンロードページで LTS 版と、クリックで進むインストーラーを選びます:Mac は .pkg、Windows は .msi。ダブルクリックして最後まで進めるだけで、curl コマンドは不要です
入れ終わったらターミナルを閉じて開き直し、同じコマンドをもう一度実行します。バージョン番号が出れば完了です:
node -v一度入れれば、Node.js を使うすべてのツールで使えます
Cursor の AI チャットを Agent モードで開く
試してみる
JSON Contracts を使って、私に何ができるか教えて、1 つやってみせて✓ Cursor が JSON Contracts を使っていると言うか、回答に JSON Contracts のツール名が出れば接続成功です
追加の設定 1 項目(入力しなくても使えます)
上のコマンドはこれらがなくても動きます。変えたいときだけ作者の説明に沿って追加してください。
JSON_CONTRACTS_DIRFolder containing JSON contract files. Defaults to ./json-contracts.
説明は英語の原文のままです。
メニュー名は 2026年11月11日 に Cursor のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります
VS Code につなげますが、先に準備が必要です
先にパソコンへ Node.js を入れてください(1 回だけ)
AI にインストールしてもらう
このメッセージを VS Code のチャットに貼り付けます。AI がパソコンを確認し、変更するファイルを伝え、毎回あなたの了承を待ちます。
このパソコンの VS Code に MCP server JSON Contracts を入れてください。順番に:1) node -v で Node.js があるか確認。なければ https://nodejs.org/en/download から入れるよう私に伝え、自分では入れない。2) この設定だけを使う(PopNx MCP の確認済み):{ "servers": { "json-contracts": { "type": "stdio", "command": "npx", "args": [ "-y", "json-contracts" ] } } } 3) 変更するファイルのフルパスか実行するコマンドを伝えて、私の了承を待つ。4) キーは不要。5) 了承した内容を実行し、JSON Contracts のツールが本当に表示されるか確認する。このメッセージにあなたのキーは含まれません。キーが必要な場合は、AI がファイルやアプリの入力欄にご自身で貼るよう案内します。
Node.js を入れる(まだなければ)
もう入っていますか?先に確認 · ターミナルを開き、このコマンドを入力して Enter
node -v- バージョン番号(例 v26.13.1)が出る = 入っています。この手順は飛ばせます
- "command not found"(Windows では "is not recognized")が出る = まだ入っていないか、入れた直後でターミナルを開き直す必要があります
ターミナルの開き方
Mac:⌘ + Space を押し、Terminal と入力して Enter
Windows:スタートメニューを開き、Windows PowerShell と入力して「開く」
まだ入っていない場合: 公式ダウンロードページで LTS 版と、クリックで進むインストーラーを選びます:Mac は .pkg、Windows は .msi。ダブルクリックして最後まで進めるだけで、curl コマンドは不要です
入れ終わったらターミナルを閉じて開き直し、同じコマンドをもう一度実行します。バージョン番号が出れば完了です:
node -v一度入れれば、Node.js を使うすべてのツールで使えます
VS Code の AI チャットを Agent モードで開く
試してみる
JSON Contracts を使って、私に何ができるか教えて、1 つやってみせて✓ VS Code が JSON Contracts を使っていると言うか、回答に JSON Contracts のツール名が出れば接続成功です
追加の設定 1 項目(入力しなくても使えます)
上のコマンドはこれらがなくても動きます。変えたいときだけ作者の説明に沿って追加してください。
JSON_CONTRACTS_DIRFolder containing JSON contract files. Defaults to ./json-contracts.
説明は英語の原文のままです。
メニュー名は 2026年11月11日 に VS Code のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります
Windsurf、Zed、Gemini CLI など MCP を使える他のアプリは追加方法がそれぞれ違います。アプリ一覧で確認してください
JSON 設定は下の「開発者向け」にあります
開発者向け:ターミナルのコマンドと JSON 設定
パソコンにインストール
Claude Code
claude mcp add --scope user json-contracts -- npx -y json-contractsClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"json-contracts": {
"command": "npx",
"args": [
"-y",
"json-contracts"
]
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"json-contracts": {
"command": "npx",
"args": [
"-y",
"json-contracts"
]
}
}
}VS Code (mcp.json)
{
"servers": {
"json-contracts": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"json-contracts"
]
}
}
}自分で入力する値
JSON_CONTRACTS_DIRenvFolder containing JSON contract files. Defaults to ./json-contracts.
説明は英語の原文のままです。
この設定は、作者のレジストリ登録情報から作成しています。READMEと違う場合は、READMEに従ってください。
ひと目でわかる
- 週あたりのダウンロードi
- 53/週
- 接続方法
- パソコンで動く
- 最新バージョンi
- 0.1.2
- レジストリ公開日i
- 2026年5月5日
- コードの最終更新i
- 2026年5月6日
- 作者
- json-contracts
- パッケージ
npm: json-contracts- ウェブサイト
- github.com
- レジストリでの状態
- 有効
使えるアプリ
このサーバーのつなぎ方と、各アプリの公式ドキュメントに基づきます。2026年11月10日に確認。
パソコン上で動かせるアプリ
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
できること
パソコンで動くサーバーです。インストールすると、ツール一覧がAIアプリに表示されます。
基本チェックi
誰でも見られる情報をチェックしており、コードは読んでいません。当てはまらない項目は数に入れていません。 · 2026年11月16日にチェック
- ✓ 合格
作者とリポジトリが一致
レジストリ名は、リポジトリを所有するGitHubアカウント json-contracts で確認済みです
- ! 注意
今もメンテナンスされている
コードの最終更新:6 か月前(6か月以上前)
- ! 注意
ライセンスがある
GitHubがライセンスの種類を判別できませんでした。ファイルを開いて確認してください
- – 対象外
エンドポイントが応答する
これはパソコンで動くため、インターネット上のエンドポイントはありません
- – 対象外
OAuthでサインイン
パソコンで動き、代わりにローカルの設定を使います
- … 未チェック
ツールの説明に隠れた指示がない
パソコンで動くサーバーです。ツール一覧を読み取れるのは、インターネット上のエンドポイントがある場合だけです
公開済みの脆弱性(OSV.dev)
まだ確認していません
作者の方へ:再確認の依頼・情報の誤りの報告
話し合い
質問、コツの共有、使えないことの報告ができます。「役に立った」の多い順です。
ユーザーレビュー
まだレビューはありません
開発者ツールのほかのサーバーとの比較i
- このカテゴリのほかの5938件のうち69%よりスターが多い
- このカテゴリのほかの5938件のうち10%より最近レジストリに公開
- 基本チェックの結果が、このカテゴリのほかの5938件のうち7%と同じかそれ以上
レジストリでこのカテゴリにある有効なすべてのサーバーと比較しています。スターは、公開者がリポジトリの所有者である場合だけ数えます。
よくある質問
JSON Contractsは安全ですか?
当てはまる基本チェック3項目のうち1項目に合格しました。コードは読んでいません。キーやトークンを追加する前に、サーバーがどんなアクセスを求めているかを確認し、必要な権限だけを持つキーを使ってください。
どんなキーやコードが必要ですか?
レジストリには必須のキーは載っていません。ただし、最初に使うときにサインインを求めるサーバーもあります。
パソコンで動きますか、それともクラウドですか?
あなたのパソコンで動きます。必要なときにAIアプリが起動し、データは作者のサーバーを通りません(サーバー自体がオンラインサービスを呼び出す場合を除きます)。
今もメンテナンスされていますか?
GitHubリポジトリの最終更新は6 か月前、最新バージョン(0.1.2)がレジストリに届いたのは6 か月前です。
どのアプリで使えますか?
Claude Desktop、Claude Code、Cursor、VS CodeなどのMCP対応アプリで使えます。パソコンにNode.jsも必要です。
代わりに使えるものは?
同じカテゴリには:GitDiagram, Appllama, Cloudflare MCP, Omnara, Repowise
似た働きのほかの候補
同じカテゴリでほかの作者のもの。コマンドは確認済み。公式を先に、次にスター順。
カードの見方:↓ 週あたりのダウンロードi★ GitHubスターi3つの柱:レビュー · チェック · 利用状況i更新=最新バージョンをレジストリに公開した日i
GitDiagram
Architecture diagrams, explanations and Mermaid source for public GitHub repositories.
Appllama
Study screens, flows and paywalls from top-earning iOS apps, then build from what wins.
Omnara
Deploy durable AI agents with Omnara, an open-source managed-agent platform.
Repowise
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
| これ JSON Contracts | GitDiagram | Appllama | Cloudflare MCP | Omnara | Repowise | |
|---|---|---|---|---|---|---|
| 動く場所 | パソコンにインストールが必要 | クラウドで動き、インストール不要 | クラウドで動き、インストール不要 | クラウドで動き、インストール不要 | クラウドで動き、インストール不要 | クラウドでもパソコンにインストールでも使える |
| キーが必要 | いいえ | いいえ | いいえ | いいえ | いいえ | いいえ |
| Claude で + から追加 | いいえ | いいえ | いいえ | はい | いいえ | いいえ |
| 基本チェック | 1/3 | 4/4 | 4/4 | 4/4 | 4/4 | 5/5 |
| ライセンス | NOASSERTION | MIT | MIT | Apache-2.0 | Apache-2.0 | AGPL-3.0 |
| 料金 | 登録情報に費用の記載なし | 登録情報に費用の記載なし | 登録情報に費用の記載なし | 登録情報に費用の記載なし | 登録情報に費用の記載なし | 登録情報に費用の記載なし |
作者のREADME
READMEを開く
作者のリポジトリから書かれたとおりにコピーしたものです。PopNx MCPは内容を確認・推奨していません。HTML、画像、スクリプトは取り除いています。リンクはこのサイトの外へ移動します。
JSON Contracts MCP Server
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.
Correct mental model
Not this:
json-contracts = generator
This:
json-contracts = schema contract registry + validator
Like TypeScript:
developer writes code
TypeScript validates it
With json-contracts:
agent writes JSON
json-contracts validates it
Architecture
User
↓ Agent using whatever model the user picked ↓ json-contracts MCP server
- lists available JSON contracts
- returns schemas, rules, examples, and instructions
- validates agent-produced JSON
- returns repair contracts when validation fails ↓
Agent generates or repairs JSON itself ↓ App consumes valid JSON
The MCP server never performs natural-language-to-JSON conversion itself. It only provides contracts, validation, and repair guidance.
Install
Install globally:
npm install -g json-contracts
json-contracts --help
Or run without installing:
npx -y json-contracts@latest
The npm package is json-contracts; the installed CLI binary is still json-contracts.
30-second setup
Create a starter contract folder and validate it:
mkdir my-json-contracts
cd my-json-contracts npx -y json-contracts@latest init npx -y json-contracts@latest validate
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:
npx -y json-contracts@latest validate --contracts ./json-contracts
npx -y json-contracts@latest lint --strict --contracts ./json-contracts
By default, the server starts as a local stdio MCP server and loads contracts from:
./json-contracts
MCP config
{
"mcpServers": { "json-contracts": { "command": "npx", "args": ["-y", "json-contracts@latest"], "env": { "JSON_CONTRACTS_DIR": "./json-contracts" } } } }
Adding a new behavior only requires adding a new .json file to the contracts folder. No MCP config change is required.
MCP host config snippets
Most MCP hosts use the same stdio shape. Adapt paths for your machine and point JSON_CONTRACTS_DIR at your app-owned contracts folder.
Claude Desktop
{
"mcpServers": { "json-contracts": { "command": "npx", "args": ["-y", "json-contracts@latest"], "env": { "JSON_CONTRACTS_DIR": "/absolute/path/to/json-contracts" } } } }
Cursor / Windsurf / VS Code MCP-compatible hosts
{
"mcpServers": { "json-contracts": { "command": "npx", "args": ["-y", "json-contracts@latest"], "env": { "JSON_CONTRACTS_DIR": "./json-contracts" } } } }
Continue or generic stdio MCP clients
{
"name": "json-contracts", "command": "npx", "args": ["-y", "json-contracts@latest"], "env": { "JSON_CONTRACTS_DIR": "./json-contracts" } }
If npx startup is too slow or your host requires explicit executables, install globally and use:
{
"command": "json-contracts", "args": [] }
Adopt in your agent/app
Use json-contracts as a local contract/validation tool beside the model your app already uses.
1. Add the MCP server
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.
2. Write one contract per JSON behavior
Create files such as:
json-contracts/support-ticket.json
json-contracts/real-estate-lead.json json-contracts/chart-generation.json
Each file contains:
schemafor the final JSON shaperulesfor app-specific mapping behaviorexamplesfor model guidance- optional
operationsfor create/edit behavior
3. Pass app/system variables as context
Do not hide runtime variables in the user prompt. Pass them as context:
{
"contract": "real-estate-lead", "input": "I'm pre-approved for a 4 bedroom house in Durham NC up to 900k.", "context": { "current_datetime": "2026-05-03T00:00:00Z", "email": "JohnnyAppleseed@gmail.com", "source": "website-lead-form" } }
json-contracts passes context through unchanged. Contracts decide how to use it through rules/examples. The final JSON still must match the schema.
4. Give your agent this tool policy
Use this as the system/developer instruction for your agent:
When converting natural language into app JSON, use json-contracts.
Create flow:
- Call get_json_contract with contract, input, and context.
- Generate JSON using the returned schema, rules, examples, input, and context.
- Call validate_json.
- If invalid, call get_repair_contract, repair the JSON, and validate again.
- Return only validated JSON to the app.
Edit flow:
- Call get_edit_contract with contract, currentJson, input, and context.
- Return the complete updated object, not a patch.
- Call validate_json.
- Repair and validate again if needed.
Never skip validation. Never add fields that are not allowed by the schema. Do not copy context fields into output unless the schema allows them and the contract rules say to use them.
5. Runtime loop in your app
At request time, your app should do:
user input + app context
-> get_json_contract or get_edit_contract -> your chosen model generates JSON -> validate_json -> if invalid: get_repair_contract -> model repairs -> validate_json -> app consumes valid JSON
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.
Contract files
Each contract is one .json file in json-contracts/.
The contract name is derived from the filename:
json-contracts/support-ticket.json -> support-ticket
There is no manifest file and no manually maintained resources file. Git handles versioning.
Contract shape
{
"description": "Convert natural language into a support ticket object.", "rules": [ "If the user says urgent, severity must be critical.", "Summary must be under 80 characters.", "Category must be authentication, billing, bug, feature_request, or other." ], "operations": { "create": { "enabled": true }, "edit": { "enabled": true, "return": "full_object", "rules": [ "Start from currentJson.", "Apply only the user's requested change.", "Preserve all unspecified fields exactly.", "Return the complete updated JSON object." ] } }, "schema": { "type": "object", "additionalProperties": false, "properties": { "summary": { "type": "string", "maxLength": 80 }, "severity": { "type": "string", "enum": ["low", "medium", "high", "critical"] }, "category": { "type": "string", "enum": ["authentication", "billing", "bug", "feature_request", "other"] } }, "required": ["summary", "severity", "category"] }, "examples": [ { "input": "Urgent, users cannot log in after SSO update.", "output": { "summary": "Users cannot log in after SSO update", "severity": "critical", "category": "authentication" } } ] }
Rules:
schemais required and must be valid JSON Schema. Omit$schemafor the default 2020-12 validator, or set$schemato draft-07 or 2020-12 explicitly.descriptionis optional but recommended.rulesis optional and defaults to[].examplesis optional and defaults to[]. Exampleoutputvalues must validate againstschema.operationsis optional and defaults to enabledcreateandeditoperations. Operation metadata belongs at the top level, not inside the JSON Schema.nameis optional, but the filename is the source of truth.- A
versionfield is rejected; use Git for versioning. - Contract files are plain JSON.
Included example contracts
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. |
Each one uses the same MCP tools: read the contract, let the model create or edit JSON, validate it, and repair if needed. New apps should not need a new bespoke prompt framework just to get reliable JSON.
MCP resources
Every loaded contract is exposed dynamically as:
json-contract://{contractName}
Examples:
json-contract://support-ticket
json-contract://create-filter json-contract://chart-generation
resources/list returns all loaded contracts. resources/read returns the normalized full contract JSON.
Stable MCP tools
list_contracts
Input:
{}
Output:
{
"contracts": [ { "name": "support-ticket", "description": "Convert natural language into a support ticket object.", "contractHash": "sha256:...", "schemaHash": "sha256:..." } ] }
read_contract
Input:
{
"contract": "support-ticket" }
Returns the selected contract's description, rules, operations, schema, examples, contractHash, and schemaHash.
Hashes are deterministic SHA-256 values over the normalized contract/schema payload. They are for logging, cache keys, and audit trails; contract files still use Git for versioning.
get_json_contract
Input:
{
"contract": "support-ticket", "input": "Urgent, users cannot log in after SSO update.", "context": {} }
Output:
{
"contract": "support-ticket", "contractHash": "sha256:...", "schemaHash": "sha256:...", "operation": "create", "instructions": [ "Convert the input into JSON.", "Return JSON only.", "Do not return markdown.", "Do not include commentary.", "Do not include extra keys.", "Match the schema exactly.", "Use enum values exactly.", "Follow all rules.", "Use examples as guidance." ], "description": "Convert natural language into a support ticket object.", "rules": [ "If the user says urgent, severity must be critical.", "Summary must be under 80 characters.", "Category must