Back to Browse

Contractgate MCP Server

Developer ToolsUse Caution4.6MCP RegistryLocal
Free

Server data from the Official MCP Registry

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

About

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

Security Report

4.6
Use Caution4.6High Risk

The provided code is a data contract validation gateway with no evidence of exfiltration, backdoors, or unsafe shell execution, and the MCP server reads its API key from an environment variable. The score is held back because the MCP tool implementation (mcp/src/server.ts) and the truncated Rust handlers were not included, so tool behavior and egress paths could not be fully verified, and the dev-mode auth bypass and x-org-id trust path are worth monitoring. Supply chain analysis found 9 known vulnerabilities in dependencies (2 critical, 5 high severity). Package verification found 1 issue.

9 files analyzed · 15 issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

HTTP Network Access

Connects to external APIs or services over the internet.

env_vars

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

DataContractGate API key (cg_live_...). Create one at https://app.datacontractgate.com/accountRequired

Environment variable: CONTRACTGATE_API_KEY

Gateway base URL. Defaults to https://api.datacontractgate.comOptional

Environment variable: CONTRACTGATE_BASE_URL

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "io-github-nightmoose-contractgate": {
      "env": {
        "CONTRACTGATE_API_KEY": "your-contractgate-api-key-here",
        "CONTRACTGATE_BASE_URL": "your-contractgate-base-url-here"
      },
      "args": [
        "-y",
        "@nightmoose/contractgate-mcp-server"
      ],
      "command": "npx"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

DataContractGate

Semantic Contract Enforcement at Ingestion — Patent Pending

Stop bad data before it reaches your warehouse, lakehouse, or ML pipeline.

Try it in 10 minutes (Self-Hosted Free)

No Supabase account. No API keys. No sign-up.

git clone https://github.com/nightmoose/contractgate.git
cd contractgate
make demo

Opens at http://localhost:3000 — dashboard pre-loaded with three starter contracts and a live event stream. First build ~3 min, subsequent runs instant (Docker layer cache).

make demo-reset   # wipe + reseed (clean slate)
make demo-down    # stop and remove volumes
make demo-logs    # follow all service logs

Self-Hosted Free (make demo) runs the real gateway binary with auth off. Unlimited local events, full YAML editor, playground, audit log. Feature comparison below ↓

Run the demo locally

Everything the demo shows runs on your machine in Docker — no account, no hosted service, no data leaving your laptop. Two options, depending on what you want to see:

1. The full product (dashboard in your browser). The zero-auth stack boots the real gateway, Postgres, and the dashboard, pre-seeded with three starter contracts and a live event stream:

git clone https://github.com/nightmoose/contractgate.git
cd contractgate
make demo            # docker compose --profile demo up --build
# open http://localhost:3000

Prefer a single container? The gateway image is published to GHCR on every release, so you can run just the API without cloning:

docker run --rm -p 3001:3001 ghcr.io/contractgate/gateway:latest
# health check: curl http://localhost:3001/health

2. The throughput speed demo. A self-contained, Kafka-backed demo that races the real validator against a zero-validation baseline over the same stream, with a live dashboard at http://localhost:8088. This is the local replacement for the old hosted stream demo:

docker compose -f docker-compose.kafka-demo.yml up -d   # Redpanda (Kafka)
cargo run --release --features demo --bin demo          # start the demo
# open http://localhost:8088

Full walkthrough and tuning knobs: demo/README.md.

Purchase passes the user_events contract; delete is outside the enum and a negative amount is below the minimum

DataContractGate is a high-performance validation gateway that enforces rich semantic data contracts in real time. Built in Rust for sub-millisecond per-event validation (86k+ events/sec/core), it goes far beyond JSON Schema or basic type checks — ontology, glossary, patterns, enums, computed metrics, and automatic inference.

The same contract can gate what leaves your system. POST /egress/{contract_id} runs the identical engine on any outbound payload — a reverse-ETL row, a notebook export, a state object headed to a decision model. Failing records are blocked, declared PII is masked, and the caller forwards only the returned payload. See docs/egress-validation-reference.md.

Validating LLM output? The same engine powers AISchemaGate (pip install aischemagate / npm install @nightmoose/aischemagate). One-line wrapper over OpenAI / Anthropic / vLLM / Ollama responses — extracts the structured JSON, validates against your contract, optionally re-prompts on violation. Non-streaming only in v1. See docs/llm-output-validation.md, docs/llm-sdk-reference.md, and the copy-paste guides in docs/integrations/ (Vercel AI SDK, structured outputs, LangGraph). Ingest recipes: examples/recipes/.

Security Dependabot License: MIT

See it run → Run the demo locally in Docker, or open the playground.


Using Claude, Cursor, or Codex? Paste this

https://app.datacontractgate.com/llm-integration.md
https://github.com/nightmoose/contractgate

implement this in my repo

Your agent reads the integration playbook (source), finds your event shape, infers a contract from real samples, deploys it, wires your producer to /v1/ingest, and verifies with a dry run before anything is written. Machine index: /llms.txt.

MCP (Cursor, Claude Desktop, Windsurf, Copilot, Codex):

{
  "mcpServers": {
    "contractgate": {
      "command": "npx",
      "args": ["-y", "@nightmoose/contractgate-mcp-server"],
      "env": {
        "CONTRACTGATE_API_KEY": "${CONTRACTGATE_API_KEY}"
      }
    }
  }
}

Tools and auth: docs/mcp-reference.md.

Claude Code / Cursor plugin:

/plugin marketplace add nightmoose/contractgate
/plugin install contractgate@contractgate

Redpanda Connect (HTTP processor, no custom plugin): docs/examples/redpanda-connect/.

Zapier — validate the record a Zap just pulled, before the next step writes it. A failure is quarantined and the Zap stops. A pass continues with the payload DataContractGate returned. Setup and the zapier-platform push commands: docs/zapier.md. Source: zapier/.


Real login (self-host)

Auth on, dashboard sign-up, and every paid feature unlocked. From a fresh clone:

git clone https://github.com/nightmoose/contractgate.git
cd contractgate
docker compose -f docker-compose.yml -f docker-compose.selfhost.yml up --build

Sign up at http://localhost:3000/auth/signup, then sign in at http://localhost:3000/auth/login. Mail is not configured; confirmation is automatic. Do not combine this with --profile demo. First boot generates keys and binds ports to 127.0.0.1. Exact steps: docs/self-host-reference.md.

The comparison table below is the zero-auth demo. With CONTRACTGATE_SELF_HOSTED=true the stored plan stays free and paid gates open.


Key Features

  • Semantic YAML Contracts — entities, types, patterns, enums, required fields, glossary, and computed metrics
  • Real-time Validation — at ingestion (Kafka, HTTP, batch) with sub-millisecond per-event validation
  • Visual Contract Builder — intuitive UI + live YAML preview (Cloud)
  • AI-Powered Inference — paste sample JSON → instantly generates a full contract (Cloud)
  • Quarantine + Replay — automatically hold and replay violating events (Cloud)
  • Versioned Contracts — draft → stable → deprecated with compliance mode (Cloud)
  • High Performance — Rust + Axum core, 86k+ events/sec/core
  • Polyglot — Rust engine, Python SDK, CLI, Kafka Connect, Zapier, Next.js dashboard

Self-Hosted Free vs Cloud

CapabilitySelf-Hosted FreeCloud (Free / Pro / Enterprise)
Validation engine✅ Unlimited (local)✅ 100K / 25M / Unlimited events/month
Starter contracts✅ 3✅ 3 / Unlimited / Unlimited
Playground✅✅
Audit log✅ Local Postgres✅ 7 / 90 / Custom days retention
Live event stream✅✅
Auth & API keys❌✅
Multi-tenancy❌ Single org✅
Visual contract builder❌✅ Growth+
AI inference (JSON → YAML)❌✅ Growth+
Quarantine + replay❌✅ Growth+
PII transform rules❌✅ Growth+
Semantic versioning UI❌✅ Growth+
GitHub sync❌✅ Growth+
Team invites & roles❌✅ Growth+
SSO / SAML❌✅ Enterprise
Managed hosting + SLA❌ Self-hosted✅

→ Full pricing → Talk to sales


Other Quickstarts

Docker (gateway + Postgres only):

docker compose up

Python SDK:

pip install contractgate
from contractgate import Client
client = Client(base_url="http://localhost:8080", api_key="cg_demo_key")
client.ingest(contract_id="...", events={"user_id": "u1", "event_type": "click"})

CLI:

cargo install --git https://github.com/nightmoose/contractgate contractgate
contractgate test --contract examples/contracts/api/user_events.yaml --data examples/contracts/api/pass.json
contractgate test --contract examples/contracts/api/user_events.yaml --data examples/contracts/api/fail.json

GitHub Action (compile every YAML under contracts/ on PRs):

- uses: nightmoose/contractgate/actions/validate@main
  with:
    path: contracts

pre-commit (same compile, no network):

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/nightmoose/contractgate
    rev: main   # pin to a git sha
    hooks:
      - id: contractgate-validate

Architecture

LayerTech
Validation engineRust + Axum (sub-millisecond per-event, see note)
DashboardNext.js 15 + TypeScript + Tailwind
StorageSupabase (Postgres + Auth)
ConnectorsKafka Connect, HTTP, batch, Python SDK, CLI
ObservabilityPrometheus + Grafana

Full RFCs and design docs live in docs/rfcs/. For a quick shipped-vs-draft view, see docs/STATUS.md.


Comparison

FeatureDataContractGateGreat ExpectationsSodaMonte Carlodbt
Validation timingAt ingestionPost-hoc / batchMix (mostly batch)ObservabilityDuring dbt runs
PerformanceSub-ms per-event, 86k+ ev/s (Rust, see note)Python-basedVariesNot a validatorNot real-time
Semantic depthOntology + glossary + metricsBasic expectationsChecks + rulesNo contractsBasic schema
Visual builderYes + live YAMLPartialLimitedNoYAML only
Inference from sample dataOne-click JSON → YAMLProfiler (basic)LimitedNoNo
Quarantine + replayBuilt-inNoNoNoNo
VersioningDraft → stable → deprecatedManualBasicNoBasic
Self-hosted OSSYes (make demo)YesOpen coreCommercialYes
LicenseMITApache 2.0Open coreCommercialApache 2.0

Contributing

PRs welcome. See CONTRIBUTING.md and the reference docs in docs/.

Active RFCs: docs/rfcs/ · RFC status index: docs/STATUS.md


License

MIT — see LICENSE. Free to use, fork, and build on top (commercial use welcome).

The semantic contract enforcement algorithm is the subject of a pending patent. The patent covers the invention — your right to use, modify, and distribute the code under the MIT license is unaffected. See NOTICE for details.


Built with ❤️ in Florida by NightMoose

Reviews

No reviews yet

Be the first to review this server!