zerolock-mcp
Scans Drizzle migration directories for deployment lock and table-rewrite hazards.
Scans Flyway SQL migration directories for deployment lock and table-rewrite hazards.
Provides a GitHub Action that audits SQL migrations in pull requests, emits inline ::error annotations and Markdown step summaries, and can fail the workflow on critical lock or rewrite hazards.
Audits MySQL 8.0/8.4 DDL migrations for lock-queue, table-rewrite, and unsafe ALGORITHM/LOCK options.
Audits PostgreSQL 14–17 DDL migrations for ACCESS EXCLUSIVE lock queues, table rewrites, unsafe index builds, and missing lock_timeout guards.
Scans Prisma migration directories for deployment lock and table-rewrite hazards.
zerolock-mcp — PostgreSQL & MySQL Zero-Downtime DDL Migration Lock Auditor (MCP Server + CLI + GitHub Action)
Zero-dependency, 100% offline Model Context Protocol (MCP) Server, CLI, and node20 GitHub Action enabling AI coding agents (Claude Desktop, Cursor, Windsurf, Antigravity) and pull-request CI pipelines to catch catastrophic PostgreSQL (14–17) and MySQL (8.0 / 8.4) ACCESS EXCLUSIVE lock queues, full table rewrites, non-concurrent index builds, unvalidated foreign keys, and missing lock_timeout guards before deployment.
Why Production Migrations Fail in Seconds
FIFO
ACCESS EXCLUSIVELock Queue Pileups: Even a 5msALTER TABLEwithoutSET LOCAL lock_timeout = '2s'waiting behind one active slow query forms a lock queue that blocks 100% of subsequentSELECTandINSERTqueries, exhausting connection pools immediately.ORM Default Migrations Block Writes or Abort at Runtime: Prisma, Drizzle, Flyway, and Alembic frequently emit synchronous
CREATE INDEX(withoutCONCURRENTLY), wrapCONCURRENTLYinsideBEGIN...COMMIT, add volatile defaults (DEFAULT gen_random_uuid()), rewrite 20M+ rows onALTER COLUMN TYPE, scan full tables underSET NOT NULL, or omit MySQLALGORITHM=INPLACE, LOCK=NONE.
Related MCP server: terrabase
MCP Tools Exposed (stdio — NDJSON & Content-Length)
Tool | Purpose | Safety Annotations |
| Audits PostgreSQL 14–17 & MySQL 8.0 DDL statements across 16 deterministic lock-queue and table-rewrite rules while honoring fast-path metadata exceptions ( |
|
| Rewrites hazardous SQL migrations into multi-phase Phase 1 (Expand / |
|
| Estimates lock duration in seconds, connection-pool exhaustion risk, and blocked |
|
| Recursively scans Prisma ( |
|
Quick Start (MCP Client & Local CLI)
# Start MCP server over stdio (supports both NDJSON and LSP Content-Length framing)
npx -y github:z121245017-ai/zerolock-mcp
# List MCP tool schemas
npx -y github:z121245017-ai/zerolock-mcp --list
# Scan a Prisma or Flyway migration directory directly from terminal
npx -y github:z121245017-ai/zerolock-mcp --scan ./prisma/migrations
# Generate a zero-downtime Expand/Contract rewrite from CLI
npx -y github:z121245017-ai/zerolock-mcp --cli generate_zero_downtime_ddl '{"sql":"CREATE INDEX idx_orders_user ON orders (user_id);"}'Claude Desktop / Cursor / Windsurf / Antigravity Config
{
"mcpServers": {
"zerolock": {
"command": "npx",
"args": ["-y", "github:z121245017-ai/zerolock-mcp"]
}
}
}Docker (node:22-alpine, non-root USER node)
docker build -t zerolock-mcp .
docker run -i --rm zerolock-mcpGitHub Action (z121245017-ai/zerolock-mcp@v1)
Block CRITICAL database lock-queue and table-rewrite hazards in pull requests with inline ::error annotations on exact SQL lines plus a Markdown Step Summary:
name: ZeroLock SQL Migration Gate
on:
pull_request:
paths:
- 'prisma/migrations/**'
- 'drizzle/**'
- 'migrations/**'
- '**/*.sql'
permissions:
contents: read
jobs:
sql-lock-audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Audit SQL migrations for production lockouts
uses: z121245017-ai/zerolock-mcp@v1
with:
paths: 'prisma/migrations'
dialect: 'pg'
table-rows: '15000000'
qps: '1200'
fail-on-critical: 'true'
fail-on-high: 'false'Action Inputs & Outputs
Name | Kind | Default | Description |
| Input |
| Newline- or comma-separated |
| Input |
| SQL dialect override ( |
| Input |
| Assumed production row count for lock duration simulation. |
| Input |
| Assumed peak production QPS for blocked query simulation. |
| Input |
| Exit |
| Input |
| Also exit |
| Input |
| Comma-separated directory names skipped during recursive workspace scan. |
| Output | — | Number of |
| Output | — | Total |
| Output | — | Total |
| Output | — | Lowest |
| Output | — | Gate verdict ( |
| Output | — | Structured JSON summary of findings and blast-radius metrics. |
Verification
npm testLicense
MIT License — 0 external npm dependencies, 0 network calls, 100% local execution.
Available Tools
4 toolsaudit_migration_directoryBRead-onlyIdempotent
Recursively scans Prisma, Drizzle, Flyway, or raw .sql migration directories for CRITICAL and HIGH deployment lock-queue and full-table-rewrite hazards.
Inputs: directoryPath (required), qps, strict, dialect, +2 more.
audit_sql_migration_locksARead-onlyIdempotent
Audits PostgreSQL 14-17 and MySQL 8.0/8.4 DDL statements for ACCESS EXCLUSIVE lock queues, full table rewrites, non-concurrent index builds, unvalidated foreign keys, and missing lock_timeout guards.
Inputs: sql (required), qps, dialect, tableRows.
estimate_ddl_blast_radiusARead-onlyIdempotent
Estimates lock duration in seconds, connection-pool exhaustion risk, and blocked read/write query counts given SQL DDL statements, target table row count, and production QPS.
Inputs: qps (required), sql (required), tableRows (required), dialect, +2 more.
generate_zero_downtime_ddlARead-onlyIdempotent
Rewrites hazardous SQL migrations into multi-phase Expand/Contract runbooks using CREATE INDEX CONCURRENTLY, NOT VALID + VALIDATE CONSTRAINT, lock_timeout, ALGORITHM=INSTANT, and emergency Rollback scripts.
Inputs: sql (required), qps, dialect, tableRows.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct input/action pair: auditing raw DDL statements, generating a zero-downtime rewrite, estimating runtime blast radius from row counts/QPS, and recursively scanning a migration directory. The two 'audit' tools are separated cleanly by input type (inline SQL vs. a directory path), so misselection risk is minimal.
All four names follow a verb_noun snake_case pattern (audit_/generate_/estimate_ + domain object) and use the same vocabulary (ddl, migration, lock) as the descriptions. No mixed casing or verb-style drift.
Four tools is a tight, purposeful surface for a migration-safety domain: analyze, rewrite, quantify risk, and batch-scan. Nothing is redundant and each tool maps to a distinct stage of the workflow.
The surface covers the core lifecycle — detect hazard, rewrite safely, estimate impact, and sweep a directory — with rollback generation folded into the rewrite tool. Minor gaps remain, such as validating or re-checking an already-applied migration and no explicit support beyond PostgreSQL/MySQL, but these are workable around existing tools.
Maintenance
Related MCP Connectors
Audit your MCP servers for poisoned tools and leaked secrets, and check AI-generated code for flaws.
Hosted MCP server for PostgreSQL diagnostics: slow queries, missing indexes, connection pressure.
Monitor MCP servers, API contracts and AI outputs for schema drift. Alerts on breaking changes.
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceDatabase migration safety checker MCP server that analyzes SQL for dangerous patterns and provides safe alternatives.5 npm1MIT

terrabaseofficial
AlicenseNot gradedqualityDmaintenanceLLM-assisted, safety-gated Postgres migrations exposed as an MCP server, using a deterministic rule engine over Postgres's own parser AST for safety enforcement, with two-phase approval and append-only audit ledger.Apache 2.0- AlicenseAqualityBmaintenanceGoverned 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
- AlicenseAqualityBmaintenanceGoverned MySQL + MariaDB DBA operations — slow-query, lock-wait/deadlock, replication, and fragmentation RCA, with unbypassable audit logging (MCP + CLI), budget/runaway guards, dry-run, and undo/rollback.35MIT