# Database Migration Safety Analyzer MCP for AI Agents MCP

> Database Migration Safety Analyzer prevents accidental data loss by scanning SQL and ORM migration files for dangerous commands like DROP TABLE or DROP COLUMN. It calculates a risk score to help you decide if a schema change is safe for production or limited to development.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_cQXrWgHqm2EKHWPLeBUQJNj8bF55KD1SU2fpMiU1/mcp
- **Tags:** sql, migrations, database-safety, schema-changes, devops

## Description

Running a destructive SQL command in production is every developer's nightmare. Instead of manually squinting at massive migration files to find a hidden DROP TABLE, you can let your agent do the scanning for you. It looks through your schema changes and flags anything that might delete data permanently. When you use this MCP through Vinkius, you're adding an automated safety check that doesn't get a single line of code wrong. You get a clear idea of the risks before any code is actually executed. The analyze_migration tool identifies high-risk operations while assess_deployment_safety helps you determine if a migration is acceptable for your target environment.

## Tools

### analyze_migration
Scans SQL migration content to find destructive operations. It flags commands like DROP TABLE or DROP COLUMN immediately.

### assess_deployment_safety
Determines if a deployment is safe based on an analysis report. This helps you decide if a change can go to production or should stay in dev.

## Prompt Examples

**Prompt:** 
```
Is this migration script safe to run in production?
```

**Response:** 
```
| Operation | Status |
| :--- | :--- |
| **DROP TABLE** | ⚠️ Detected |
| **Danger Score** | **1.0** |
| **Verdict** | **UNSAFE** |

This migration contains a critical operation that will cause irreversible data loss.
```

**Prompt:** 
```
Check this SQL for any risky changes.
```

**Response:** 
```
I found the following risks in your script:
* `DROP COLUMN user_email` (High Risk)
* `RENAME COLUMN old_id TO new_id` (Medium Risk)

Proceed with caution.
```

**Prompt:** 
```
Can I deploy this to staging?
```

**Response:** 
```
The assessment shows a danger score of **0.4**. This is within the acceptable threshold for your **staging** environment, but it exceeds the limit for production.
```

## Capabilities

### Catch destructive SQL commands
Automatically flags DROP TABLE or DROP COLUMN statements in your migration scripts.

### Score migration risks
Generates a concrete danger score to quantify how risky a schema change is.

### Audit ORM-generated files
Inspects migrations from your ORM to find hidden deletions or renames.

### Verify environment safety
Checks if a specific migration meets the safety thresholds for production or staging.

### Automate schema reviews
Acts as an automated peer review step during your deployment workflow.

## Use Cases

### Preventing a production outage
A DevOps engineer uses the agent to check a migration script and discovers a DROP TABLE command that would have wiped a user table.

### Verifying ORM migrations
A developer runs an analysis on an auto-generated migration and realizes a RENAME COLUMN was actually a destructive drop and add operation.

### Staging deployment audits
An engineer uses the safety assessment to confirm that a high-risk migration is acceptable for staging but blocked for production.

## Benefits

- Stop accidental deletions by catching DROP TABLE commands before they run.
- Get a clear danger score using the analysis report to quantify migration risk.
- Protect your staging environment by enforcing strict deployment safety thresholds.
- Audit ORM-generated migrations to find hidden column drops or renames.
- Reduce manual review time by automating the inspection of SQL scripts.

## How It Works

The bottom line is you stop accidental deletions before they hit your database.

1. Point your agent to the SQL or ORM migration file you want to check.
2. The MCP parses the file for any high-risk schema operations.
3. You receive a danger score and a clear safety verdict for your deployment.

## Frequently Asked Questions

**How does Database Migration Safety Analyzer prevent data loss?**
It scans your SQL or ORM migration files for commands like DROP TABLE or DROP COLUMN that could delete data permanently.

**Can I use Database Migration Safety Analyzer with my ORM migrations?**
Yes, it parses the content of your migration files to identify any destructive schema changes regardless of how they were generated.

**Does Database Migration Safety Analyzer work for staging environments?**
Absolutely, you can use it to check if a specific danger score is acceptable for staging even if it's too risky for production.

**What kind of SQL commands does Database Migration Safety Analyzer flag?**
It specifically looks for high-risk operations like dropping tables, dropping columns, or renaming columns that might break existing dependencies.

**Can I automate my database reviews with Database Migration Safety Analyzer?**
Yes, by connecting this MCP to your agent, you can automatically audit every migration file as part of your development workflow.

**How does the analyzer detect risky operations?**
It uses deterministic pattern matching to scan migration content for keywords associated with destructive actions like `DROP` or `ALTER`.

**What is a danger score?**
The danger score is a value between 0.0 and 1.0 representing the risk level of a migration based on the severity and frequency of detected operations.

**Can I use this for different environments?**
Yes, you can use `assess_deployment_safety` to check if a migration meets the specific risk thresholds for production, staging, or development.