MigrateSafe MCP
Allows CrewAI agents to analyze database migration scripts, flagging table-locking statements, destructive drops, and incompatible schema changes before deployment.
Integrates migration safety inspection into LangGraph agent workflows, allowing SQL migration analysis for lock contention, destructive DDL, and estimated production outage risk.
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., "@MigrateSafe MCPcheck if this migration is safe: ALTER TABLE users ADD COLUMN email NOT NULL;"
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.
MigrateSafe MCP (Lite Edition)
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:
Production Table Lockups: A naive
ALTER TABLE ... ADD COLUMN ... NOT NULLor unindexed column change acquires anAccessExclusiveLock, blocking all reads and writes and taking down user-facing services.Silent Breaking Changes: Dropping or renaming columns without an Expand/Contract migration pattern breaks active application pods during rolling deployments.
Write-Blocking Index Builds: Running
CREATE INDEXinstead ofCREATE INDEX CONCURRENTLYblocks 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
AccessExclusiveLockorShareLock.โ ๏ธ 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 |
|
| Inspects migration for table locks and destructive patterns |
|
| Maps lock levels ( |
|
| Estimates exclusive lock time and production outage risk |
|
| 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.sqlcompletely 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 toolsanalyze_migration_safetyB
Analyze a SQL migration script for table locks, destructive drops, and breaking changes.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Raw SQL migration text to inspect. | |
| dialect | No | SQL dialect ('postgres', 'mysql', 'sqlite'). Default: 'postgres'. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full behavioral burden. It discloses the risk categories checked, but does not clarify whether the tool only statically inspects SQL or executes anything, what permissions are required, or what the analysis result contains.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The definition is a single front-loaded sentence with no wasted words. The action and the three risk categories are immediately clear.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The schema fully covers the two parameters, but there is no output schema and no annotations. The description is adequate on purpose but does not describe the analysis result or behavioral constraints, leaving some gaps for an agent invoking the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents the 'sql' and 'dialect' parameters including the default dialect. The description adds no additional meaning beyond what the schema provides, so the baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb and resource ('Analyze a SQL migration script') and names three concrete risk categories it inspects. It is clear on what the tool does, but it does not differentiate itself from siblings such as detect_table_locks, which overlaps with one of its stated checks.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives no explicit guidance on when to use this tool versus alternatives like detect_table_locks or inspect_schema_diff. Usage is only implied by the purpose statement, with no exclusions or decision criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
detect_table_locksC
Map out lock levels (AccessExclusiveLock, ShareLock) acquired per statement in migration.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Raw SQL migration text to inspect. | |
| dialect | No | Target SQL dialect (default: 'postgres'). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It says nothing about whether the SQL is executed or only parsed, whether the operation is read-only, or what happens with unsupported dialects. For an analysis tool operating on raw SQL, the execution/safety profile is a meaningful omission.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single tight sentence with the core concept (lock levels per statement) front-loaded and zero filler. It is efficient, though it errs toward terseness given the absence of annotations and output schema.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema and no annotations, the description should explain the return shape and execution semantics. It does convey the essential idea (lock levels mapped per statement), which is the minimum viable for this analysis tool, but leaves the response format and read-only behavior unspecified.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% for both parameters (sql, dialect), so the schema already documents them fully. The description adds no syntax, format, or dialect-handling detail beyond what the schema provides, which matches the baseline 3.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Map out') and resource ('lock levels ... acquired per statement in migration'), naming concrete examples (AccessExclusiveLock, ShareLock) that make the scope unambiguous. It is clearly distinguishable from siblings like inspect_schema_diff or generate_dry_run_plan, though it never names them explicitly.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no when-to-use statement, no prerequisite, and no mention of the three sibling tools. The 'in migration' phrasing implies a migration-analysis context, but the agent gets no guidance on when to pick this over analyze_migration_safety.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_dry_run_planC
Estimate lock duration and production outage risk based on table row count.
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Raw SQL migration script. | |
| sample_row_count | No | Estimated target table row count (default: 100,000). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden. 'Estimate' and the tool's dry-run framing imply a non-destructive read, and it usefully signals that output concerns outage risk, but it never explicitly states that no migration is applied, nor does it describe limits, cost, or return format.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single tight sentence with no filler and a front-loaded statement of what is computed. It is, however, arguably too terse for a tool whose name implies a richer 'plan' output.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a two-parameter tool with full schema coverage the input side is complete, but there is no output schema and the description never explains what the 'plan' or risk estimate looks like. An agent knows what it computes but not what it receives back.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so both 'sql' and 'sample_row_count' are already documented. The description reinforces that row count drives the estimate, which usefully connects sample_row_count to the result, but adds no format or default detail beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific computation โ estimating lock duration and production outage risk โ but diverges from the tool name, which promises a 'dry run plan.' An agent sees no mention of what the plan actually contains, leaving the link between the name and the described output unclear.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no when-to-use guidance and no comparison to the siblings analyze_migration_safety, detect_table_locks, or inspect_schema_diff. The agent must infer that this is a pre-execution estimation step rather than an analysis of an already-running migration.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
inspect_schema_diffB
Compare before and after SQL DDL schemas to identify breaking changes.
| Name | Required | Description | Default |
|---|---|---|---|
| after_sql | Yes | Proposed schema definition. | |
| before_sql | Yes | Previous schema definition. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden, and it does imply the operation is a read-only comparison that reports breaking changes. However, it says nothing about the shape of the result, whether the change set is classified by severity, or any prerequisites, so it is only partially transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no wasted words; the purpose and output are both delivered immediately. It is efficient, though arguably terse given the absence of annotations and output schema.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a two-string-parameter tool this covers the core action, but with no annotations and no output schema an agent still lacks any sense of what the diff returns and how it differs from the migration-safety sibling. Adequate but with clear gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% and both parameters are documented in the schema, so the baseline is 3. The description confirms the before/after ordering concept but adds no format or syntax detail beyond what the schema already states.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description pairs a specific verb (compare) with a specific resource (before/after SQL DDL schemas) and states the outcome (identify breaking changes). It is clear on its own, but it never acknowledges the adjacent siblings such as analyze_migration_safety or generate_dry_run_plan, so an agent must infer the boundary itself.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no explicit when-to-use or when-not-to-use statement and no alternative tool is named. The phrase 'to identify breaking changes' hints at intent but gives no condition that would route an agent here rather than to analyze_migration_safety.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v1.0.0- First observed
analyze_migration_safety - First observed
detect_table_locks - First observed
generate_dry_run_plan - First observed
inspect_schema_diff
TDQS
Scored across 4 tools
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.
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.
Four tools is well-scoped for a focused SQL migration safety server. Each tool maps to a clear, non-redundant capability within that domain.
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.
Maintenance
Related MCP Connectors
Guard AI agents' PostgreSQL/MySQL access via MCP: SQL audit, auth, masking, write approval
- SchemaOAuthai.schemalabs
The AI that understands raw data: Schema over your tables and databases, as MCP tools.
Read-only AI coding tools for change verification, release readiness, capacity, and guidance.
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables 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
- 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.612 npmMIT
- AlicenseAqualityBmaintenanceMCP 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.121MIT
- AlicenseNot gradedqualityCmaintenanceEnables 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