JSON Schema Tools

io.github.basitalisandhuv0.1.1更新於 Oct 5, 2026

Validate JSON against a schema with Ajv, infer a schema from samples and diff two schemas.

已驗證STDIO僅桌面Developer ToolsData & Analytics

概覽

AI 產生的概覽

讓助理以 JSON Schema 驗證 JSON、從範例文件推斷 schema,並比較兩個 schema 的差異。

功能
提供三個工具。validate_json 使用 Ajv 依 07、2019-09 或 2020-12 草案驗證文件,回傳是否有效、所用草案、錯誤數量,以及最多 200 筆錯誤,包含 JSON Pointer 路徑、schema 路徑、關鍵字與訊息,並檢查 email、uri、date-time、uuid 等格式。infer_schema 從範例文件產生 2020-12 草案 schema,合併型別、標記必填鍵,並處理巢狀物件、陣列項目、字串格式與選用列舉。diff_schemas 比較兩個 schema,依對舊 schema 下有效文件的影響,將每項變更標為破壞性、相容或需複核。
適用情境
適合處理 JSON Schema 定義或 JSON 資料的情境:檢查資料是否符合約定、從真實樣本產生初始 schema,或評估 schema 變更是否會破壞現有文件。適用於 API 契約、設定檔與測試資料的編輯工作。
執行需求
以 npm 套件(npx)或 Docker 映像在本機透過 stdio 執行;未宣告帳號、API 金鑰或環境變數。使用 npm 方式需要 Node.js。schema 與文件以 JSON 值或字串傳入,上限 2 MB。
安裝前請注意
僅做唯讀分析:不抓取遠端 $ref 目標、不存取本機檔案、不傳送遙測。草案 04 與 06 的 schema 會被拒絕,需更新或移除 $schema。請固定套件版本,避免更新在不知情的情況下改變編輯器中執行的內容。

安裝

在 SourceWeft 中

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

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

json-schema-tools MCP server

Validates JSON against JSON Schema drafts 07, 2019-09 and 2020-12 with Ajv, infers a schema from sample documents, and diffs two schemas with a compatibility verdict per change.

Part of dev-mcp-servers. Stdio transport only; the server never opens a port.

Tools

ToolInputWhat it returns
validate_jsonschema, data, draft?valid, draft used, error count and up to 200 errors with JSON Pointer path, schema path, keyword, message and params. Formats (email, uri, date-time, uuid and more) are checked.
infer_schemasamples (array of documents or a JSON string), enum_threshold?, detect_formats?, title?A draft 2020-12 schema: types unioned across samples, required for keys present in every sample, nested objects, array items, string formats, optional enums.
diff_schemasbefore, afterEvery change with path, before and after values and an impact: breaking, compatible or review, from the point of view of documents valid under before.

Install

Claude Code:

bash
claude mcp add json-schema-tools -- npx -y @basitalisandhu/[email protected]

Add -s user to make it available in every project. Any client that reads .mcp.json (Claude Code, Claude Desktop, Cursor):

json
{  "mcpServers": {    "json-schema-tools": {      "command": "npx",      "args": ["-y", "@basitalisandhu/[email protected]"]    }  }}

Pin the version as shown so that an update to the package cannot change what runs in your editor without you noticing. From a checkout, use "command": "node", "args": ["<path>/packages/json-schema-tools/dist/index.js"] after npm install && npm run build at the repository root.

What it touches

  • Network: None. Remote $ref targets are not fetched.
  • Local files: None.
  • Telemetry: none.

Notes

  • Ajv runs with strict: false so real-world schemas with unknown keywords still validate.
  • Draft-04 and draft-06 schemas are rejected; update $schema or remove it.
  • Schemas and documents can be passed as JSON values or as JSON strings; both are capped at 2 MB.

Build and test

bash
npm install        # at the repository rootnpm run build -w @basitalisandhu/mcp-json-schema-toolsnpm test -w @basitalisandhu/mcp-json-schema-tools

Tests use node:test and the SDK's in-memory transport; they do not reach the network.

Licence

MIT. See LICENSE.

來源:packages/json-schema-tools/README.md,提交 58c8c95

工具

0
工具後設資料尚未被收錄。

版本歷史

1
  1. v0.1.1最新Oct 5, 2026