Skip to main content
Glama

MigrateSafe MCP (Lite Edition)

License: MIT Protocol: MCP Python: >=3.10

MigrateSafe MCP is a zero-downtime database migration inspection and verification Model Context Protocol server for AI coding assistants (Claude Desktop, Cursor, LangGraph, CrewAI).

It analyzes DDL migration scripts before execution, flagging table-locking statements, destructive drops, and backward-incompatible schema changes that would otherwise cause production downtime or data loss.


🎯 The Problem

When autonomous AI agents write database migrations:

  1. Production Table Lockups: A naive ALTER TABLE ... ADD COLUMN ... NOT NULL or unindexed column change acquires an AccessExclusiveLock, blocking all reads and writes and taking down user-facing services.

  2. Silent Breaking Changes: Dropping or renaming columns without an Expand/Contract migration pattern breaks active application pods during rolling deployments.

  3. Write-Blocking Index Builds: Running CREATE INDEX instead of CREATE INDEX CONCURRENTLY blocks INSERT and UPDATE traffic on critical transactional tables.

MigrateSafe catches these issues automatically inside your AI workflow before migration scripts ever reach production.


Related MCP server: MCP Migration Advisor

✨ Features (Lite Edition)

  • πŸ”’ Lock Contention Detection: Identifies statements that acquire AccessExclusiveLock or ShareLock.

  • ⚠️ Destructive Statement Detection: Flags DROP TABLE, DROP COLUMN, RENAME COLUMN, and incompatible column type rewrites.

  • ⏱️ Lock Duration & Risk Estimator: Estimates exclusive lock durations based on table row volume.

  • πŸ› οΈ Full MCP Stdio Protocol: Native integration with Claude Desktop, Cursor, and agent frameworks.


πŸš€ Quickstart

1. Installation

git clone https://github.com/johannschiffer/migratesafe-mcp.git
cd migratesafe-mcp
pip install -e .

2. Configure in Claude Desktop or Cursor

Add to your claude_desktop_config.json or Cursor MCP configuration:

{
  "mcpServers": {
    "migratesafe": {
      "command": "migratesafe",
      "args": ["run"]
    }
  }
}

3. CLI Inspection

# Analyze migration safety via CLI
migratesafe analyze path/to/migration.sql --dialect postgres

πŸ› οΈ MCP Tools Reference

Tool

Parameters

Description

analyze_migration_safety

sql, dialect

Inspects migration for table locks and destructive patterns

detect_table_locks

sql, dialect

Maps lock levels (AccessExclusiveLock, etc.) per SQL statement

generate_dry_run_plan

sql, sample_row_count

Estimates exclusive lock time and production outage risk

inspect_schema_diff

before_sql, after_sql

Identifies breaking changes between DDL schemas


πŸš€ Upgrade to MigrateSafe Pro

Need production-grade rolling upgrade validation and automated safe refactoring?

The MigrateSafe Pro Edition adds:

  • πŸ”„ Zero-Downtime Pattern Generator: Automatically transforms dangerous DDL into safe 3-phase Expand/Contract migrations.

  • ⚑ Live Shadow Traffic Simulation Harness: Runs concurrent read/write transactions against a clone database while executing the migration to benchmark lock contention and latency spikes.

  • βͺ Automated Rollback Verifier: Proves that down.sql completely restores original schema with 0 data loss.

  • 🐳 Production Docker & Compose: Ready-to-deploy CI/CD sidecar.

  • πŸ§ͺ 100% Passing Pytest Suite.

πŸ‘‰ Get MigrateSafe Pro on Gumroad ($14.99 USD)


πŸ“„ License

MIT Β© 2026 Johann Schiffer

Available Tools

4 tools
analyze_migration_safetyB

Analyze a SQL migration script for table locks, destructive drops, and breaking changes.

Inputs: sql (required), dialect.

detect_table_locksC

Map out lock levels (AccessExclusiveLock, ShareLock) acquired per statement in migration.

Inputs: sql (required), dialect.

generate_dry_run_planC

Estimate lock duration and production outage risk based on table row count.

Inputs: sql (required), sample_row_count.

inspect_schema_diffB

Compare before and after SQL DDL schemas to identify breaking changes.

Inputs: after_sql (required), before_sql (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 4 tools

    Disambiguation4/5

    Each tool has a distinct focus: safety analysis, lock detection, dry-run risk estimation, and schema diffing. analyze_migration_safety is somewhat umbrella-like and overlaps conceptually with the other three, but the descriptions still make tool boundaries understandable.

    Naming Consistency5/5

    All four tools follow a consistent snake_case verb_noun pattern: analyze_migration_safety, detect_table_locks, generate_dry_run_plan, inspect_schema_diff. No mixed conventions or vague names.

    Tool Count5/5

    Four tools is well-scoped for a focused SQL migration safety server. Each tool maps to a clear, non-redundant capability within that domain.

    Completeness4/5

    The surface covers core migration-safety workflows: broad analysis, lock mapping, outage-risk estimation, and schema diffing. Minor gaps exist around rollback planning or safe-rewrite suggestions, but agents can work around them.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to query live schema, lineage, and query-context across data warehouses, dbt projects, orchestration systems, and BI tools via MCP tools.
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      MCP server providing deep PostgreSQL context to AI assistants, including schema DDL, index health, foreign key associations, query execution plans, and performance statistics via read-only tools.
      12
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to safely explore PostgreSQL schemas, inspect sample rows, draft queries, and read EXPLAIN plans through a read-only enforced interface for MCP clients.
      MIT