PHPackages                             junko5/laravel-safe-migration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. junko5/laravel-safe-migration

ActiveLibrary[Database &amp; ORM](/categories/database)

junko5/laravel-safe-migration
=============================

MCP server for safe Laravel database migrations with confirmation prompts

011PHP

Since Oct 7Pushed 7mo agoCompare

[ Source](https://github.com/junko5/safe-migration-mcp)[ Packagist](https://packagist.org/packages/junko5/laravel-safe-migration)[ RSS](/packages/junko5-laravel-safe-migration/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Safe Migration
======================

[](#laravel-safe-migration)

> ⚠️ **Beta Version** / β版

Laravelデータベースマイグレーション安全実行MCPサーバー。Claude Code/Cursor用。 MCP server for safe Laravel database migrations with confirmation prompts for Claude Code/Cursor.

[![Confirmation Screen](.github/images/safemigration_img01.png)](.github/images/safemigration_img01.png)

📺 Demo / デモ
-----------

[](#-demo--デモ)

こちらの動画でインストール方法・使い方ご紹介しています。

[🎥 Watch Full Demo Video (Vimeo)](https://vimeo.com/1124737442/821b6e4592)

---

📖 日本語ドキュメント
-----------

[](#-日本語ドキュメント)

### 概要

[](#概要)

AIエージェントがデータベースマイグレーションを実行する際に、データ損失を防ぐためのMCPサーバーです。 破壊的な操作を行う前に、データベースの影響を分析し、ユーザー確認を要求します。

### インストール方法

[](#インストール方法)

#### 1. Composerでインストール

[](#1-composerでインストール)

```
composer require junko5/laravel-safe-migration:dev-main
```

#### 2. MCPクライアントの設定

[](#2-mcpクライアントの設定)

##### Claude Code

[](#claude-code)

```
claude mcp add safe-migration --scope local -- php artisan mcp:start safe-migration
```

##### Cursor

[](#cursor)

`.cursor/mcp.json`に追加：

```
{
  "mcpServers": {
    "safe-migration": {
      "type": "stdio",
      "command": "php",
      "args": [
        "{your-laravel-project-path}/artisan",
        "mcp:start",
        "safe-migration"
      ]
    }
  }
}
```

> **パスについて注意:** `{your-laravel-project-path}`は、Laravelプロジェクトの絶対パスに置き換えてください（`pwd`コマンドで確認できます）。 例: `C:/Users/username/Documents/laravel-project/artisan`
>
> バックスラッシュ(`\`)はスラッシュ(`/`)に置き換えてください。

> **phpについて注意:** `php`コマンドがPATHに登録されていない場合（XAMPPなど）は、フルパスを指定してください：
>
> **Claude Code:**
>
> ```
> claude mcp add safe-migration --scope local -- C:/xampp/php/php.exe artisan mcp:start safe-migration
> ```
>
>
>
> **Cursor:**
>
> ```
> "command": "C:/xampp/php/php.exe"
> ```

### 使い方

[](#使い方)

MCPサーバーは以下のコマンドを自動的に監視します：

- `php artisan migrate:rollback`
- `php artisan migrate:reset`
- `php artisan migrate:fresh`
- `php artisan db:wipe`

AIエージェントがこれらのコマンドを実行しようとすると、以下の処理が行われます：

1. データベースへの影響（テーブルとレコード数）を確認
2. データ損失がある場合に警告
3. 明示的な確認を要求

### 動作環境

[](#動作環境)

- PHP ^8.2
- Laravel ^12.28.1以上

### テスト済み環境

[](#テスト済み環境)

- **AIクライアント:** Claude Code, Cursor
- **データベース:** SQLite, MySQL (phpMyAdmin)

その他のAIクライアントやデータベースでも動作する可能性がありますが、まだテストしていません。

### ライセンス

[](#ライセンス)

MIT

---

📖 English Documentation
-----------------------

[](#-english-documentation)

### Overview

[](#overview)

MCP server that prevents data loss when AI agents execute database migrations. Analyzes database impact before destructive operations and requires user confirmation.

### Installation

[](#installation)

#### 1. Install via Composer

[](#1-install-via-composer)

```
composer require junko5/laravel-safe-migration:dev-main
```

#### 2. Configure MCP Client

[](#2-configure-mcp-client)

##### Claude Code

[](#claude-code-1)

```
claude mcp add safe-migration --scope local -- php artisan mcp:start safe-migration
```

##### Cursor

[](#cursor-1)

Add to `.cursor/mcp.json`:

```
{
  "mcpServers": {
    "safe-migration": {
      "type": "stdio",
      "command": "php",
      "args": [
        "{your-laravel-project-path}/artisan",
        "mcp:start",
        "safe-migration"
      ]
    }
  }
}
```

> **Note:** Replace `{your-laravel-project-path}` with the absolute path to your Laravel project (use `pwd` command to get the path). Example: `C:/Users/username/Documents/laravel-project/artisan`
>
> Replace backslashes (`\`) with forward slashes (`/`).

> **Note:** If `php` is not in your PATH (e.g., XAMPP), specify the full path:
>
> **Claude Code:**
>
> ```
> claude mcp add safe-migration --scope local -- C:/xampp/php/php.exe artisan mcp:start safe-migration
> ```
>
>
>
> **Cursor:**
>
> ```
> "command": "C:/xampp/php/php.exe"
> ```

### Usage

[](#usage)

The MCP server automatically monitors the following commands:

- `php artisan migrate:rollback`
- `php artisan migrate:reset`
- `php artisan migrate:fresh`
- `php artisan db:wipe`

When AI agents attempt to run these commands, they will:

1. Check database impact (tables and records)
2. Warn about data loss if applicable
3. Request explicit confirmation from you

### Requirements

[](#requirements)

- PHP ^8.2
- Laravel ^12.28.1+

### Tested Environments

[](#tested-environments)

- **AI Client:** Claude Code, Cursor
- **Database:** SQLite, MySQL (phpMyAdmin)

Other AI clients and databases may work but have not been tested yet.

### License

[](#license)

MIT

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance45

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7612f0a59ffb877e5cb603956104ae33886f6d8ae1cb39d38dbcc398ac561af?d=identicon)[junko5](/maintainers/junko5)

---

Top Contributors

[![junko5](https://avatars.githubusercontent.com/u/70782949?v=4)](https://github.com/junko5 "junko5 (1 commits)")

---

Tags

claude-codecursorlaravelmcp-servermigrationrollback

### Embed Badge

![Health badge](/badges/junko5-laravel-safe-migration/health.svg)

```
[![Health](https://phpackages.com/badges/junko5-laravel-safe-migration/health.svg)](https://phpackages.com/packages/junko5-laravel-safe-migration)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
