nock-mcp
Provides PostgreSQL migration safety checking by analyzing DDL statements against estate snapshots to assess lock modes, hot-table risk, and policy violations before applying.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@nock-mcpcheck migrations/001.sql against .nock/estate.json"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Nock
Estate-aware approve/block for Postgres DDL.
Same verdict in CLI, CI, and Cursor MCP. Never applies migrations.
Why Nock
Checks your proposed DDL against an estate — a snapshot of your table sizes plus catalogue facts (columns, constraints, indexes) — so it approves or blocks based on your data, not generic SQL patterns
Check-only: never applies migrations and never writes to your database
Returns the same JSON verdict from the CLI, GitHub Actions, and Cursor MCP
Exit codes:
0pass ·1warnings only ·2fail (blocking)
Related MCP server: postgres-aiops
Quick start (golden path)
An estate is a small JSON snapshot of your Postgres table sizes and catalogue facts (columns, constraints, indexes)—not a dump of row data—that Nock uses to approve or block DDL for your database. Details: Estate schema.
Get an estate (pick one)
Bring your own estate: commit
.nock/estate.jsonSync estate yourself:
npx @nockhq/cli@latest sync-estate --database-url "$DATABASE_URL" --out .nock/estate.jsonLive DATABASE_URL check: omit
--estate, pass--database-url
Check
npx @nockhq/cli@latest check \
--sql migrations/001.sql \
--estate .nock/estate.json \
--format jsonWire the gate — same command in Actions or MCP
check_before_apply. Exit: 0 pass · 1 warn · 2 fail.
Example verdict (truncated)
{ "verdict": "fail", "violations": [ { "rule_id": "R001", "severity": "red" } ] }Add to CI (GitHub Action)
Preferred: use the published Action from this repo’s packages/action subdirectory, pinned to a tag:
name: Nock — Postgres migration safety (Action)
on:
pull_request:
paths: ['migrations/**', '.nock/**']
jobs:
nock:
runs-on: ubuntu-latest
permissions: { contents: read, pull-requests: write }
steps:
- uses: actions/checkout@v4
- name: Run Nock check (Action)
uses: saiyamshah1496/nock/packages/action@v0.1.9
with:
migration-path: migrations/
estate-path: .nock/estate.json
policy-path: policy.default.yml
fail-on: red
github-token: ${{ secrets.GITHUB_TOKEN }}Notes:
This Action is intentionally published from a subdirectory; GitHub Marketplace listing requires a dedicated public repo with a root
action.yml(follow‑up item).You can also test a PR branch by pinning a commit SHA in
uses: owner/repo/path@<sha>.
Alternative (CLI):
Copy-paste into .github/workflows/nock.yml:
name: Nock — Postgres migration safety (CLI)
on:
pull_request:
paths: ['migrations/**', '.nock/**']
jobs:
nock:
runs-on: ubuntu-latest
permissions: { contents: read, pull-requests: write }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: 'npm' }
- name: Run Nock check (CLI)
run: |
npx @nockhq/cli@latest check \
--sql "migrations/001.sql" \
--estate ".nock/estate.json" \
--policy "policy.default.yml" \
--fail-on "red" \
--format "json" | tee nock-verdict.jsonSee more in examples/workflows/nock.yml and examples/workflows/nock-action.yml.
Add to Cursor (MCP)
Install server via npx:
{ "mcpServers": { "nock": { "command": "npx", "args": ["-y", "@nockhq/mcp@latest"] } } }Call
check_before_applywith either:estatePath: ".nock/estate.json"(file)or
databaseUrl: "postgres://..."(live DATABASE_URL check)
Not Squawk, not Atlas
Not Squawk, not Atlas. Squawk lints migration shapes without knowing your table sizes. Atlas plans and applies schema changes. Nock does neither: it takes your DDL plus an estate snapshot (or a live read-only
DATABASE_URL) and returns approve or block for CI and agents—lock risk on your data—without ever applying SQL.
Free vs Team
Free — one estate, DIY
Bring your own estate file, sync estate yourself, or run a live DATABASE_URL check on your runner. Staging + production means two checks or a CI matrix you own. Nock does not host multi-estate packs on Free.
Team — estate packs Hosted staging / production / tenant estates under one org, plus org policy, audit, and export. Same approve/block engine as Free — ops convenience when you outgrow a single estate file in CI.
Docs
Reference: CLI · Rules · Verdict JSON · Estate schema
Security
No row data is read or processed; only catalogue (columns, constraints, indexes) and table sizes
Your database URL never leaves your runner in Free mode
Prefer read‑only roles and replicas for
sync-estateor live checks See docs/SECURITY.md.
Contributing
See docs/DEVELOPMENT.md.
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Deterministic safety, correctness & cost gate that vets Postgres SQL before your AI agent runs it.
Detects database migration table locks, terraform cost leaks, and OWASP API flaws.
Generate, fix, explain and run read-only SQL on PostgreSQL, MySQL and SQL Server
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Related MCP Servers
- AlicenseAqualityDmaintenanceAnalyzes database migrations for risks like lock contention and data loss before they run. Supports Flyway and Liquibase formats, providing risk scores and rollback generation.616 npmMIT
- AlicenseAqualityAmaintenanceGoverned PostgreSQL DBA operations — slow-query, bloat, and blocking-lock RCA, index management, vacuum/analyze, and replication lag, with unbypassable audit logging (MCP + CLI), budget/runaway guards, dry-run, and undo/rollback.35MIT
- AlicenseNot gradedqualityCmaintenanceEnables auditing PostgreSQL role write privileges against a policy file, using read-only tools to explain, describe, and check permissions.MIT
- AlicenseAqualityAmaintenanceBlocks unsafe PostgreSQL migrations before an AI agent writes or runs them. check_before_apply returns a pass/fail gate; reads the real Postgres parser, classifies the lock each statement takes, checks 112 safety rules. Runs offline, no database required.7822 npm7MIT