Mage.ai MCP Integration について
Mage.ai MCP Integration は、AI アシスタントを Mage.ai のデータパイプラインに接続します。MCP 経由でパイプラインやブロックの確認、編集、作成、実行ができます。
主な機能
- 01パイプラインとブロックの閲覧
- 02ブロックコードの読み取りと編集
- 03パイプラインまたは個別ブロックの実行
- 04名前、種類、内容によるブロック検索
- 05パイプラインとブロックの作成
活用シーン
- 01Mage.ai のパイプラインとブロックの確認
- 02ブロックコードの変更と実行
- 03条件に合うブロックの検索
MCP 対応
パイプラインの閲覧、編集、作成、検索、実行に使う Mage.ai のリソースとツールを MCP クライアントに提供します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
Mage.ai MCP 統合
Mage.ai 向けの包括的な Model Context Protocol(MCP)統合です。Anthropic の Claude などの AI アシスタントが、Mage のデータパイプラインを効率よく操作できます。
機能
- パイプラインの参照:Mage.ai のすべてのパイプラインとそのコンポーネントを確認できます
- コードの表示と編集:ブロックのコードを読み取り、変更できます
- パイプラインの実行:パイプライン全体または個別のブロックを実行できます
- 検索機能:名前、タイプ、内容でブロックを検索できます
- パイプラインの作成:新しいパイプラインとブロックを一から作成できます
インストール
# Clone the repository
git clone https://github.com/yourusername/mage-mcp.git
cd mage-mcp
# Install dependencies
pip install -r requirements.txt
設定
サーバーは環境変数またはコマンドライン引数を使用して設定できます。
MAGE_API_URL:Mage.ai API の URL(デフォルト:http://localhost:6789/api/)MAGE_API_KEY:認証用の API キー(必要な場合)
設定を永続化するには、.env ファイルを作成します。
MAGE_API_URL=http://localhost:6789/api/
MAGE_API_KEY=your_api_key_if_needed
使用方法
サーバーの起動
付属のスクリプトを使用して MCP サーバーを起動します。
# Using stdio transport (default)
python run_server.py
# Using SSE transport
python run_server.py --transport sse --host localhost --port 3000
# Additional options
python run_server.py --api-url http://your-mage-instance:6789/api/ --api-key your_key --debug
Claude Desktop へのインストール
最適な環境で利用するには、このサーバーを Claude Desktop に直接インストールしてください。
# Using mcp CLI
mcp install run_server.py --name "Mage.ai Manager"
# With environment variables
mcp install run_server.py -v MAGE_API_URL=http://localhost:6789/api/ -v MAGE_API_KEY=your_key
開発モード
テストおよび開発用です。
mcp dev run_server.py
MCP リソースとツール
リソース
mage://pipelines- すべてのパイプラインを一覧表示mage://pipelines/{pipeline_uuid}- パイプラインの詳細を取得mage://pipelines/{pipeline_uuid}/blocks- パイプライン内のブロックを一覧表示mage://pipelines/{pipeline_uuid}/blocks/{block_uuid}- ブロックの詳細を取得mage://pipelines/{pipeline_uuid}/blocks/{block_uuid}/content- ブロックのコードを取得mage://pipelines/{pipeline_uuid}/content- パイプライン全体の内容を取得mage://pipelines/{pipeline_uuid}/execution- パイプラインの実行詳細を取得mage://blocks/search/{query}- 名前、タイプ、内容でブロックを検索
ツール
list_all_pipelines()- 詳細情報付きですべてのパイプラインを一覧表示get_pipeline_details(pipeline_uuid)- パイプラインの情報を取得list_pipeline_blocks(pipeline_uuid)- パイプライン内のブロックを一覧表示get_block_content(pipeline_uuid, block_uuid)- ブロックのコードを取得create_pipeline(name, description, pipeline_type)- 新しいパイプラインを作成create_block(pipeline_uuid, name, block_type, language, content, upstream_blocks)- ブロックを作成update_block_content(pipeline_uuid, block_uuid, content)- ブロックのコードを更新execute_pipeline(pipeline_uuid)- パイプラインを実行execute_block(pipeline_uuid, block_uuid)- 指定したブロックを実行get_pipeline_code(pipeline_uuid)- パイプラインのコード全体を取得
インタラクション例
User: Show me all the pipelines in Mage.ai.
Claude: Let me check what pipelines are available in your Mage.ai instance.
[Lists all pipelines with descriptions and types]
User: Can you show me the blocks in the data_ingestion pipeline?
Claude: Here are all the blocks in the data_ingestion pipeline:
[Lists all blocks with their types, languages, and status]
User: I need to modify the 'transform_data' block to fix a bug.
Claude: Let me help you with that. First, let's look at the current code:
[Shows the current block code]
Here's how we can fix the bug:
[Explains the issue and suggests changes]
Would you like me to update the block with these changes?
User: Yes, please update it.
Claude: I've updated the block. Here's the new content:
[Shows the updated code]
The changes have been saved successfully.
コントリビューション
コントリビューションを歓迎します。お気軽にプルリクエストを送信してください。
ライセンス
このプロジェクトは MIT License のもとでライセンスされています。詳細は LICENSE ファイルをご覧ください。
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。