@ahmedshaikh/schema-validate-mcp
v0.1.0
Published
Validate JSON or YAML against a JSON Schema as an MCP server — structured error paths (which field failed and why), draft-07 and 2020-12, with format checks. No shelling out to ajv-cli or python jsonschema.
Maintainers
Readme
schema-validate
Validate JSON or YAML against a JSON Schema and get back the exact field path
of every failure — instead of shelling out to ajv-cli / python -m jsonschema
and parsing their text. Built on ajv (draft-07 & 2020-12).
validate({ schema, data: { users: [{ email: 5 }] } })
→ { valid: false, error_count: 1,
errors: [ { path: "/users/0/email", message: "must be string", keyword: "type" } ] }Tools
validate(schema, data, data_format?)—schema/dataas objects or strings. Returns{ valid, error_count, errors: [{ path, message, keyword, allowed?, missing? }] }. Setdata_format: "yaml"whendatais a YAML string.validate_file(schema_path, data_path)— validate one file against another (format auto-detected by extension).check_schema(schema)— is the schema itself valid (compiles against the meta-schema)?
Error paths use JSON Pointer (/users/0/email). allErrors is on, so you get
every failure at once. format keywords (email, date-time, uri, …) are enabled.
Setup
npm install
npm testclaude mcp add schema-validate -- node /abs/path/schema-validate/dist/server.js
# CLI: agent-validate schema.json config.yamlHonest limits
- JSON Schema only (draft-07 by default; 2019-09/2020-12 auto-selected from the
schema's
$schema). Not other schema languages (Joi, Zod, protobuf). strict: false— unknown keywords are ignored rather than erroring, so odd schemas still run.- YAML is parsed to plain JS then validated; YAML-specific tags aren't schema-checked.
