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 分