AISchemaGate and DataContractGate

io.github.nightmoose由 GitHub 账号 nightmoose 发布v0.4.1更新于 Nov 3, 2026

AISchemaGate validates and repairs structured LLM output against a contract, plus DataContractGate.

概览

AI 生成的概览

按契约校验并修复结构化 LLM 输出,同时可推断、部署和校验 DataContractGate 数据契约。

可以做什么
  • 从真实 JSON 样本事件推断草稿契约 YAML,且不持久化
  • 按已部署契约或内联 YAML 校验事件,默认以 dry-run 方式运行
  • 按名称和版本部署契约,并列出该 API 密钥可见的契约
  • 查看被隔离的拒绝事件及其违规详情
  • 校验结构化 LLM 输出,读取 min、max、pattern、enum 与 compliance_mode 违规以进行有限修复
适用场景
适合需要让助手生成或检查必须满足数据契约的结构化 JSON 的场景,也适合维护 DataContractGate 契约、希望在对话中完成推断、校验、部署和隔离区查看而不打开控制台的用户。
运行要求
通过 npx 以 stdio 在本地运行(需要 Node.js)。需在 CONTRACTGATE_API_KEY 中提供 DataContractGate API 密钥;网关地址默认指向托管 API,可用 CONTRACTGATE_BASE_URL 覆盖。需要能访问该网关的网络。
安装前请注意
API 密钥是真实凭据并会发送给网关,请勿放入共享配置。deploy_contract 会改动远端状态:创建或提升稳定版契约并弃用原稳定版,且存在待处理隔离事件时会被拒绝。校验与输出检查默认 dry_run 为 true,只有关闭后才会产生审计记录或隔离。

安装

在 SourceWeft 中

  1. 打开 控制台中的 AISchemaGate and DataContractGate,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@nightmoose/contractgate-mcp-server

AISchemaGate validates and repairs structured LLM output against a contract, plus DataContractGate data contracts. Repair uses the violation fields from that check. The contract checks values a JSON Schema or Pydantic validation can leave open.

Official Model Context Protocol server. Thin stdio wrapper over the HTTP API at https://api.datacontractgate.com (override with CONTRACTGATE_BASE_URL). The dashboard host https://app.datacontractgate.com is not the gateway.

One server, two products, same API key:

  • AISchemaGate — validates structured LLM output (egress_validate → POST /egress/{id}). Repair uses the violation fields from that check (min, max, pattern, enum, compliance_mode). Forward payload from the tool result, not the original body.
  • DataContractGate — infer and deploy data contracts, validate ingest (validate_events → POST /v1/ingest/{id}), including ODCS v3.1.0 and v3.2.0 contracts, and inspect quarantine (get_quarantine). Replay stays on the HTTP API (POST /contracts/{id}/quarantine/replay).

Registry metadata for the Official MCP Registry is server.json. The title and description lead with AISchemaGate (description is the 100-character registry field). The server name stays io.github.nightmoose/contractgate. Keywords and the longer summary are under _meta. Smithery config is smithery.yaml; its default contractgateBaseUrl is the API gateway. npm keywords, this README, and DIRECTORY_LISTINGS.md are the directory listing.

See docs/mcp-reference.md for tools and auth. AISchemaGate app integrations: docs/integrations/.

json
{  "mcpServers": {    "contractgate": {      "command": "npx",      "args": ["-y", "@nightmoose/contractgate-mcp-server"],      "env": {        "CONTRACTGATE_API_KEY": "${CONTRACTGATE_API_KEY}"      }    }  }}
bash
cd mcpnpm installnpm testnpm run build

来源:mcp/README.md,提交 b6ac5f4

工具

6

infer_contract

Infer a contract from sample events

Generate draft DataContractGate YAML from real JSON sample events via POST /contracts/infer. Does not persist. Review and write the YAML to contracts/<name>.yaml before deploying.

输入参数name必填samples必填description

validate_events

Validate events against a contract

Validate events. Pass contract_id to hit POST /v1/ingest/{id} (dry_run defaults true — no audit, quarantine, or usage). Pass yaml_content to hit POST /playground/validate per event (never persists). Exactly one of contract_id or yaml_content. 207/422 responses are returned as data so you can apply each violation's suggestion.

输入参数events必填dry_runcontract_idyaml_content

deploy_contract

Deploy a contract to stable

POST /contracts/deploy — find-or-create by name, insert YAML as stable, deprecate prior stable. 409 if that (name, version) exists: bump version in the YAML. Refused while quarantine is pending. Save the returned contract_id.

输入参数name必填sourcedeployed_byyaml_content必填

get_quarantine

List quarantined events

GET /quarantine — rejected events for the caller's org, newest first, with violation details.

输入参数limitoffsetcontract_id

list_contracts

List contracts

GET /contracts — identities the API key can see.

无需输入参数。

egress_validate

Validate an outbound payload

AISchemaGate structured-output check. POST /egress/{contract_id}. dry_run defaults true — no audit row or quarantine. Returns 200/207/422 so you can read min, max, pattern, enum, and compliance_mode violations and run a bounded auto-repair. Forward response.payload only — never the original body after a block or fail.

输入参数events必填dry_runversioncontract_id必填disposition

版本历史

6
  1. v0.4.1最新Oct 29, 2026
  2. v0.4.0Oct 13, 2026
  3. v0.3.1Oct 13, 2026
  4. v0.3.0Oct 12, 2026
  5. v0.2.0Sep 30, 2026
  6. v0.1.2Sep 17, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分