junko5/laravel-safe-migration

MCP server for safe Laravel database migrations with confirmation prompts

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/junko5/laravel-safe-migration

v0.1.0 2025-10-05 06:54 UTC

This package is not auto-updated.

Last update: 2025-10-06 23:53:37 UTC


README

⚠️ Beta Version / β版

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

Confirmation Screen

📺 Demo / デモ

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

🎥 Watch Full Demo Video (Vimeo)

📖 日本語ドキュメント

概要

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

インストール方法

1. Composerでインストール

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

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

Claude Code
claude mcp add safe-migration --scope local -- php artisan mcp:start safe-migration
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

Overview

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

Installation

1. Install via Composer

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

2. Configure MCP Client

Claude Code
claude mcp add safe-migration --scope local -- php artisan mcp:start safe-migration
Cursor

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

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

  • PHP ^8.2
  • Laravel ^12.28.1+

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

MIT