Jsonaut

io.github.shoggi211由 GitHub 帳號 shoggi211 發布v0.1.0更新於 Oct 25, 2026

Repair malformed JSON from LLM/agent output; optional JSON Schema coercion. Free + x402 paid.

已驗證Streamable HTTP可網頁執行開發者工具資料與分析

概覽

AI 產生的概覽

一個遠端 MCP 伺服器,用於修復、驗證和擷取 LLM 或代理輸出中的畸形 JSON,可選 JSON Schema 強制轉換與付費 LLM 備援。

可以做什麼
修復損壞的 JSON(尾隨逗號、單引號、截斷、markdown 程式碼圍欄、註解、Python 字面量),並可依 JSON Schema 驗證或強制轉換,同時列出所做修改。依 JSON Schema 驗證 JSON 字串,回傳有效性和違規清單。從散文、聊天訊息、日誌或郵件中擷取內嵌 JSON,再進行修復和驗證。從範例 JSON 值推斷 JSON Schema(draft 2020-12),可將同形狀樣本陣列合併為一個 schema。
適用情境
適合助理處理來自 LLM 工具呼叫、其他代理或不穩定上游的 JSON,需要解析、依 schema 檢查或產生可重複使用 schema 的情境。免費的確定性層已涵蓋大多數修復和驗證需求。
執行需求
遠端 Streamable HTTP 端點;無需帳戶或 API 金鑰。付費 LLM 備援需透過 X-PAYMENT 標頭以 Base 上的 USDC 進行 x402 付款。免費層依 IP 限流(預設每天 100 次呼叫)。
安裝前請注意
付費 LLM 備援會產生實際費用(預設每次呼叫 0.01 美元,僅成功時收費),並需要 x402 付款標頭。輸入內容(包括用於擷取的文字)會傳送到遠端服務,付費層還會傳送給 LLM 供應商。高併發下免費層限流為近似值。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Jsonaut,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.shoggi211%2Fjsonaut/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "jsonaut": {
      "type": "http",
      "url": "https://jsonaut.jsonaut-shaurya.workers.dev/mcp"
    }
  }
}

README

Jsonaut

JSON repair & validation built for AI agents as the customer. Send possibly-malformed JSON (LLM tool-call output, another agent's message, a flaky upstream), get back parsed, schema-valid JSON.

  • Free tier: deterministic repair — trailing commas, single quotes, truncation, markdown code fences, comments, Python literals — plus JSON Schema validation with type coercion (string→number, defaults, stripping hallucinated fields). Rate-limited per IP.
  • Paid tier: LLM-fallback repair for inputs the deterministic pass can't fix. $0.01/call, charged only on success, paid autonomously per-call via x402 (USDC on Base) — no accounts, no signup.

Business context, market research, and the full 3-day plan live in IDEA.md and PLAN.md.

Quickstart

bash
npm installnpm test          # 27 tests: repair battery, schema coercion, HTTP API, MCP protocolnpm run dev       # http://localhost:8787 — demo page + API + MCP endpoint

Try it:

bash
curl -s -X POST http://localhost:8787/v1/repair \  -H "content-type: application/json" \  -d "{\"input\": \"{'name': 'alice', 'count': '42',}\", \"schema\": {\"type\":\"object\",\"properties\":{\"count\":{\"type\":\"number\"}}}}"
json
{  "valid": true,  "repaired": { "name": "alice", "count": 42 },  "method": "deterministic-repair",  "changes": ["repaired JSON syntax (jsonrepair)", "$.count: coerced string \"42\" to number"]}

API

RouteWhat it does
POST /v1/repairRepair + optional schema validation/coercion. Body: {input, schema?, allow_llm_fallback?}
POST /v1/validateValidate only, no repair. Body: {input, schema}
POST /mcpMCP server (Streamable HTTP, stateless). Tools: repair_json, validate_json
GET /Interactive demo page
GET /llms.txtAgent-readable capability + pricing description
GET /openapi.yamlOpenAPI 3.1 spec

Response method values: direct (was already valid), deterministic-repair (free fix), llm-repair (paid fix), failed. changes[] lists every modification so callers can audit what was done to their data.

Using it from an agent (MCP)

bash
claude mcp add --transport http jsonaut https://YOUR-DEPLOYMENT/mcp

Or in any MCP client config:

json
{ "mcpServers": { "jsonaut": { "type": "http", "url": "https://YOUR-DEPLOYMENT/mcp" } } }

For the paid tier, clients pay via x402 and retry with the X-PAYMENT header (the payment receipt). No accounts or API keys — agents pay per call.

Payment flow (x402)

  1. Agent calls /v1/repair with allow_llm_fallback: true; deterministic repair fails.
  2. Server responds 402 with an x402 accepts array (USDC on Base, amount = PRICE_USD).
  3. Agent pays and retries with the X-PAYMENT header; server verifies via the facilitator, runs the LLM repair, and settles only if the repair succeeds.

Configuration

Env varPurposeRequired for
OPENROUTER_API_KEYEnables the paid LLM-fallback tier (via OpenRouter; free model by default)Paid tier
OPENROUTER_MODELOverride the model (default meta-llama/llama-3.3-70b-instruct:free)—
X402_PAY_TOWallet address on Base receiving USDCx402 rail
X402_NETWORKbase or base-sepolia (default base)x402 rail
FACILITATOR_URLx402 facilitator for verify/settlex402 rail
FREE_DAILY_LIMITFree calls per IP per day (default 100)—
PRICE_USDPaid-tier price (default 0.01)—
DEV_ALLOW_FREE_LLMtrue opens the paid tier for local dev only—

Local dev secrets go in a .dev.vars file (git-ignored) or your shell env.

Deployment (Cloudflare Workers)

bash
npx wrangler loginnpx wrangler kv namespace create KV      # then paste the id into wrangler.tomlnpx wrangler secret put OPENROUTER_API_KEYnpx wrangler deploy

The same codebase runs on Node for local dev (npm run dev) and on Workers in production — storage falls back to in-memory when no KV binding exists.

Project structure

src/core/      pipeline.ts (repair engine) · coerce.ts (schema coercion) · llm.ts (paid tier)src/http/      app.ts (routes) · payment.ts (x402 rail) · ratelimit.ts · demo.ts · billing.ts (parked, unused)src/mcp/       server.ts (stateless Streamable HTTP MCP server)src/worker.ts  Cloudflare Workers entrysrc/dev.ts     Node dev entrytest/          full battery: broken-JSON cases, coercion, HTTP, MCP protocol

Known limitations (MVP)

  • Schema coercion does not resolve $ref or oneOf/anyOf branches.
  • x402 verification requires an external facilitator (FACILITATOR_URL); there is no on-chain verification built in.
  • Free-tier rate limiting is approximate under high concurrency (KV read-modify-write).

來源:README.md,提交 654c2c6

工具

4

repair_json

Repair malformed JSON (trailing commas, single quotes, truncation, markdown fences, comments, python literals) and optionally validate/coerce it against a JSON Schema. Deterministic repair is free. If it fails and allow_llm_fallback is true, a paid LLM repair is attempted (requires x402 payment; charged only on success).

輸入參數input必填schemaallow_llm_fallback

validate_json

Validate a JSON string against a JSON Schema. Free. Returns validity and a list of violations.

輸入參數input必填schema必填

extract_json

Extract JSON embedded in arbitrary text — LLM prose, chat messages, logs, emails — then repair and validate it. Deterministic extraction is free. If no JSON can be located and allow_llm_fallback is true, a paid LLM extracts structured data from the text (requires x402 payment; charged only on success). Pass a JSON Schema to shape the output.

輸入參數input必填schemaallow_llm_fallback

infer_schema

Infer a JSON Schema (draft 2020-12) from an example JSON value. Free and deterministic. Set as_samples=true when the input is an array of example objects of the same shape to merge them into one schema. Turns sample agent/tool output into a reusable schema.

輸入參數input必填as_samples

版本歷史

1
  1. v0.1.0最新Sep 16, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。