0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Laravel Boost(Laravel公式MCP)をVSCode + GitHub Copilot + Docker環境で使ってみた

Posted at

Laravel BoostとはLaravelの開発者体験を向上させるMCPです。
Laravel10以上で導入可能なので、MCP Clientが使える環境で開発しているLaravel初学者の方は導入すべきだと思います!
また、Agentが勝手に使ってくれるので、開発が爆速になります!!

Laravel Boostは、AIにLaravelの"作法"を教え込み、高品質なコード生成を加速。あなたの開発体験を次のレベルへ引き上げます。

使えるツール

Name Notes (原文) 翻訳(一部わかりやすく)
Application Info Read PHP & Laravel versions, database engine, list of ecosystem packages with versions, and Eloquent models PHP・Laravelのバージョン、データベースの種類、使っているパッケージとそのバージョン、Eloquentモデル(データベースと連携する部品)の情報を表示します。
Browser Logs Read logs and errors from the browser ブラウザ(Chromeなど)のログやエラーを読み込みます。
Database Connections Inspect available database connections, including the default connection 利用できるデータベース接続の設定を確認します。
Database Query Execute a query against the database データベースに命令(クエリ)を送って、データを操作します。
Database Schema Read the database schema データベースの構造(どんなテーブルや列があるか)を読み込みます。
Get Absolute URL Convert relative path URIs to absolute so agents generate valid URLs /usersのような相対パスをhttp://.../usersという完全なURL(絶対URL)に変換します。
Get Config Get a value from the configuration files using "dot" notation 設定ファイルから、指定した項目の値を取得します。
Last Error Read the last error from the application's log files アプリケーションのログファイルに記録された、一番新しいエラーを読み込みます。
List Artisan Commands Inspect the available Artisan commands 利用できるArtisanコマンド(Laravelの便利な命令)の一覧を表示します。
List Available Config Keys Inspect the available configuration keys 設定ファイルで利用できる項目名(キー)の一覧を表示します。
List Available Env Vars Inspect the available environment variable keys .envファイルで設定できる環境変数の一覧を表示します。
List Routes Inspect the application's routes アプリケーションのURL設定(どのURLがどの処理に繋がるか)の一覧を表示します。
Read Log Entries Read the last N log entries ログファイルから、最新のログを指定した件数だけ読み込みます。
Report Feedback Share Boost & Laravel AI feedback with the team, just say "give Boost feedback: x, y, and z" 開発チームにフィードバックを送ります。
Search Docs Query the Laravel hosted documentation API service to retrieve documentation based on installed packages Laravelの公式ドキュメントを検索します。
Tinker Execute arbitrary code within the context of the application アプリケーションの環境で、好きなPHPコードを直接実行できます。デバッグなどに便利です。

公式

インストール

composer require laravel/boost --dev
php artisan boost:install

これで動くかと思いきや、、、
下記のmcp.jsonを調整する必要がありました。

{
  "servers": {
    "laravel-boost": {
      "command": "php",
      "args": [
        "artisan",
        "boost:mcp"
      ]
    }
  }
}

私の環境で動いたのは下記でした。
app-nameはお使いのdokcer-compose.yamlに記載のものを参照して�ださい。

{
  "servers": {
    "laravel-boost": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "exec",
        "-i",
        "app-name",
        "php",
        "artisan",
        "boost:mcp"
      ]
    }
  }
}

その他

  • Log Channelsに注意
    • tinker、database-queryはローカル用にログを標準出力(stdout)していると邪魔してしまうようなので、止めましょう。
  • Search-Docsは日本語には対応していないので、英語で調べてもらう必要があります。
  • MCP InspectorでMCPをデバッグすると問題対処にたどりつきやすいです。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?