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 分

    请在仓库或注册中心条目中声明许可证。