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