Sdcvalidator Ts

io.github.SemanticDataCharterPublished by GitHub account SemanticDataCharterv4.0.0Updated Nov 1, 2026

Validate and recover SDC4 Governed Data Records in TypeScript, conforming to sdcvalidator.

VerifiedSTDIODesktop onlyDeveloper ToolsData & Analytics

Overview

AI-generated overview

Validates and recovers SDC4 Governed Data Records in XML against their XSD models, with two-tier error reporting and ExceptionalValue recovery.

What you can do
  • Validate an XML instance against an SDC4 XSD model and get a pass or fail verdict with error counts
  • Report every error with its path, tier (structural or semantic), failed constraint and ExceptionalValue code
  • Recover a record by tagging semantically invalid values with ISO 21090 ExceptionalValue codes, rejecting records with structural errors
  • Check whether an XSD schema follows SDC4 principles, allowing restriction but not extension
When to use it
Useful when an assistant works with SDC4 Governed Data Records and needs to check instances against their published models, explain validation errors, or produce recovered records with ExceptionalValue annotations.
Requirements
Runs locally over stdio via npx, so Node.js 20 or later is needed. Tools take schema_path and instance_path, plus an optional reference_path. Without reference_path, the reference model included by the schema is fetched once from its URL and cached; supplying a local copy lets it work offline.
Before you install
The server reads the files you name, so point it only at paths you intend to expose. Without reference_path it makes a network request to fetch the included reference model. Recovery rewrites values in the returned record, so review recovered output before relying on it.

Installation

In SourceWeft

  1. Open Sdcvalidator Ts in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

sdcvalidator-ts

SDC4 validation in TypeScript. It validates Governed Data Records against their published SDC4 models and recovers semantic errors with ISO 21090 ExceptionalValues, giving the same results as sdcvalidator, the reference implementation, on its conformance suite.

Conforms to: sdcvalidator 4.6.3 (all 151 cases of its conformance suite). CI runs that release's suite, pinned by tag.

It runs in Node (20 or later), Deno (including Supabase Edge Functions) and browsers. You supply the model and record text, so it reads no files and makes no network requests.

ts
import { SDC4Validator, REFERENCE_MODEL_URL } from 'sdcvalidator-ts';
const validator = new SDC4Validator({  text: modelXsd,                       // the model's published XSD  resolve: (location) => sdc4Xsd,       // the reference model it includes (REFERENCE_MODEL_URL)});
const result = validator.validate(recordXml);// { valid, structural: [...], semantic: [{ path, ev, kind, constraint, message }, ...] }
const recovered = validator.recover(recordXml);// { ok, recoveries: [{ path, code, name, inserted }], unrecoverable: [...], record, text }// Throws StructuralValidationError if the record has structural errors.

MCP server

The package includes an MCP server, so agents can call it directly. It speaks JSON-RPC 2.0 over stdio and runs on Node; it reads the files you name.

bash
npx sdcvalidator-ts mcp
ToolWhat it does
validate_instancePass or fail, with error counts
validate_and_reportEvery error: path, tier, the constraint that failed, the ExceptionalValue code
recover_instanceThe recovered record and each value covered; a structural error rejects it
check_schema_complianceWhether a schema follows SDC4 principles: restriction, never extension

Each tool takes schema_path and instance_path (except the compliance check, which takes only the schema), plus an optional reference_path. The model's xsd:include of the reference model is fetched from its URL once and cached. With reference_path, it is read from that local copy instead, so the server works offline.

It is registered in the MCP registry as io.github.SemanticDataCharter/sdcvalidator-ts.

What "the same results" means

The conformance suite compares, for every case:

  • the verdict;
  • structural and semantic errors by path;
  • the ExceptionalValue code for each semantic error;
  • the recovery outcome;
  • the recovered record, compared as a tree with comments ignored.

Error messages are not compared. Errors are classified by the constraint that failed, never by message wording.

The ExceptionalValue codes are the reference's (sdcvalidator 4.6.3):

  • OTH: a value outside its enumeration.
  • INV: a value that is not of its type, or that breaks any other facet (pattern, length, range, digits, a built-in type's own range), a fixed value or an assertion.
  • NA: character data where only elements are allowed.
  • No code: an error on a structural element (label, vtb, vte, ...). It cannot be recovered.

When sdcvalidator's mapping changes, the suite's expectations change, and this library follows before its next release.

The XSD subset

SDC4 schemas use a narrow part of XSD 1.1, and this library implements that part:

  • Elements: global and local, with ref, occurrence, fixed, abstract and substitution groups.
  • Complex types: complex and simple content, restriction and extension, sequence and choice.
  • Simple types: restriction (with the enumeration, pattern, length, range, digits and whiteSpace facets) and list; about forty built-in types.
  • xsd:assert: evaluated with fontoxpath, inherited by derived types.
  • xsd:include.

A construct outside the subset raises UnsupportedSchemaError naming it. It is never ignored.

DOCTYPE and entity declarations are refused before parsing, so no external entity is ever resolved.

Development

bash
npm installnpm run typechecknpm test     # needs the conformance suite: a sibling sdcvalidator checkout, or CONFORMANCE_DIRnpm run build

Dependencies are pinned exactly: @xmldom/xmldom 0.9.12 (parsing) and fontoxpath 3.34.0 (XPath 3.1, for assertions).

License

Apache-2.0.

Source: README.md at commit 0e7cb68

Tools

4

validate_instance

Validate an XML instance against its SDC4 XSD schema. Returns pass or fail with error counts.

Parametersschema_pathrequiredinstance_pathrequiredreference_path

validate_and_report

Validate an XML instance and report every error: its path, its tier (structural or semantic), the constraint that failed, and the ExceptionalValue code recovery would use.

Parametersschema_pathrequiredinstance_pathrequiredreference_path

recover_instance

Recover an XML instance: each value with a semantic error keeps its value and is tagged with an ISO 21090 ExceptionalValue. Returns the recovered record and each value covered; a record with structural errors is rejected.

Parametersschema_pathrequiredinstance_pathrequiredreference_path

check_schema_compliance

Check whether an XSD schema follows SDC4 principles (restriction only, no xsd:extension). Does not validate instances.

Parametersschema_pathrequired

Version history

1
  1. v4.0.0LatestNov 1, 2026

Score

90% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts
  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts