
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.
概览
让助手用 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。
安装
在 SourceWeft 中
- 打开 控制台中的 JSON Schema Tools,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
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
Install
Claude Code:
Add -s user to make it available in every project. Any client that reads .mcp.json (Claude Code, Claude Desktop, Cursor):
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
$reftargets are not fetched. - Local files: None.
- Telemetry: none.
Notes
- Ajv runs with
strict: falseso real-world schemas with unknown keywords still validate. - Draft-04 and draft-06 schemas are rejected; update
$schemaor remove it. - Schemas and documents can be passed as JSON values or as JSON strings; both are capped at 2 MB.
Build and test
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- v0.1.1最新Oct 5, 2026


