Skip to main content
Glama

Firebase MCP

Firebase MCP

プロジェクトロゴ

概要

Firebase MCP を使用すると、AI アシスタントが次のような Firebase サービスと直接連携できるようになります。

  • Firestore : ドキュメントデータベース操作
  • ストレージ: 強力なアップロード機能を備えたファイル管理
  • 認証: ユーザー管理と検証

サーバーは、 Claude DesktopAugment CodeVS CodeCursorなどの MCP クライアント アプリケーションで動作します。

⚠️既知の問題firestore_list_collectionsツールは、クライアントログに Zod 検証エラーを返す場合があります。これは MCP SDK の誤った検証エラーであり、調査の結果、レスポンスにブール値が含まれていないことが確認されました。エラーメッセージが表示されても、クエリは正常に動作し、適切なコレクションデータを返します。これはログレベルのエラーであり、機能には影響しません。

⚡ クイックスタート

前提条件

  • サービス アカウントの認証情報を持つ Firebase プロジェクト
  • Node.js環境

1. MCPサーバーをインストールする

MCP 設定ファイルにサーバー構成を追加します。

  • Claude デスクトップ: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 拡張: ~/Library/Application Support/Code/User/settings.json
  • カーソル: [project root]/.cursor/mcp.json

MCPサーバーは手動でインストールすることも、npx経由で実行時にインストールすることもできます(推奨)。インストール方法によって構成が異なります。

npx 用に設定する(推奨)
{ "firebase-mcp": { "command": "npx", "args": [ "-y", "@gannonh/firebase-mcp" ], "env": { "SERVICE_ACCOUNT_KEY_PATH": "/absolute/path/to/serviceAccountKey.json", "FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app" } } }
ローカルインストール用に設定する
{ "firebase-mcp": { "command": "node", "args": [ "/absolute/path/to/firebase-mcp/dist/index.js" ], "env": { "SERVICE_ACCOUNT_KEY_PATH": "/absolute/path/to/serviceAccountKey.json", "FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app" } } }

2. インストールをテストする

AI クライアントに「すべての Firebase MCP ツールをテストしてください」と依頼します。

🛠️ セットアップと構成

1. Firebaseの設定

  1. Firebaseコンソール→プロジェクト設定→サービスアカウントに移動します
  2. 「新しい秘密鍵を生成」をクリックします
  3. JSONファイルを安全に保存する

2. 環境変数

必須
  • SERVICE_ACCOUNT_KEY_PATH : Firebase サービス アカウント キー JSON へのパス (必須)
オプション
  • FIREBASE_STORAGE_BUCKET : Firebase Storage のバケット名(デフォルトは[projectId].appspot.com
  • MCP_TRANSPORT : 使用するトランスポートタイプ( stdioまたはhttp )(デフォルトはstdio
  • MCP_HTTP_PORT : HTTPトランスポートのポート(デフォルトは3000
  • MCP_HTTP_HOST : HTTPトランスポートのホスト(デフォルトはlocalhost
  • MCP_HTTP_PATH : HTTPトランスポートのパス(デフォルトは/mcp
  • DEBUG_LOG_FILE : ファイルログを有効にする:
    • trueに設定すると、 ~/.firebase-mcp/debug.logにログが記録されます。
    • カスタムの場所にログを記録するファイルパスを設定します

3. クライアント統合

クロードデスクトップ

編集: ~/Library/Application Support/Claude/claude_desktop_config.json

VSコード / 拡張

編集: ~/Library/Application Support/Code/User/settings.json

カーソル

編集: [project root]/.cursor/mcp.json

📚 APIリファレンス

Firestore ツール

道具説明必須パラメータ
firestore_add_documentコレクションにドキュメントを追加するcollectiondata
firestore_list_documentsフィルタリングしたドキュメントの一覧collection
firestore_get_document特定の文書を取得するcollectionid
firestore_update_document既存のドキュメントを更新するcollectioniddata
firestore_delete_documentドキュメントを削除するcollectionid
firestore_list_collectionsルートコレクションの一覧なし
firestore_query_collection_groupサブコレクション間のクエリcollectionId

ストレージツール

道具説明必須パラメータ
storage_list_filesディレクトリ内のファイルを一覧表示するなし(オプション: directoryPath
storage_get_file_infoファイルのメタデータとURLを取得するfilePath
storage_uploadコンテンツからファイルをアップロードfilePathcontent
storage_upload_from_urlURLからファイルをアップロードfilePathurl

認証ツール

道具説明必須パラメータ
auth_get_userIDまたはメールでユーザーを取得するidentifier

💻 開発者ガイド

設置と構築

git clone https://github.com/gannonh/firebase-mcp cd firebase-mcp npm install npm run build

テストの実行

まず、Firebase エミュレータをインストールして起動します。

npm install -g firebase-tools firebase init emulators firebase emulators:start

次にテストを実行します。

# Run tests with emulator npm run test:emulator # Run tests with coverage npm run test:coverage:emulator

プロジェクト構造

src/ ├── index.ts # Server entry point ├── utils/ # Utility functions └── lib/ └── firebase/ # Firebase service clients ├── authClient.ts # Authentication operations ├── firebaseConfig.ts # Firebase configuration ├── firestoreClient.ts # Firestore operations └── storageClient.ts # Storage operations

🌐 HTTP トランスポート

Firebase MCPは、デフォルトのstdioトランスポートに加えて、HTTPトランスポートをサポートするようになりました。これにより、サーバーを複数のクライアントからアクセスできるスタンドアロンのHTTPサービスとして実行できるようになります。

HTTPトランスポートで実行

HTTP トランスポートを使用してサーバーを実行するには:

# Using environment variables MCP_TRANSPORT=http MCP_HTTP_PORT=3000 node dist/index.js # Or with npx MCP_TRANSPORT=http MCP_HTTP_PORT=3000 npx @gannonh/firebase-mcp

HTTPクライアント構成

HTTP トランスポートを使用する場合は、MCP クライアントを HTTP エンドポイントに接続するように構成します。

{ "firebase-mcp": { "url": "http://localhost:3000/mcp" } }

セッション管理

HTTPトランスポートはセッション管理をサポートしており、複数のクライアントが同じサーバーインスタンスに接続できます。各クライアントは、リクエスト間の状態を維持するために使用される一意のセッションIDを受け取ります。

🔍 トラブルシューティング

よくある問題

ストレージバケットが見つかりません

「指定されたバケットが存在しません」というエラーが表示された場合:

  1. Firebaseコンソール→ストレージでバケット名を確認します
  2. FIREBASE_STORAGE_BUCKET環境変数に正しいバケット名を設定します
Firebaseの初期化に失敗しました

「Firebase が初期化されていません」というエラーが表示される場合:

  1. サービス アカウント キーのパスが正しく絶対であることを確認してください
  2. サービス アカウントに Firebase サービスに対する適切な権限があることを確認する
複合インデックスが必要です

「このクエリには複合インデックスが必要です」というエラーが表示された場合:

  1. エラーメッセージに記載されているURLを探します
  2. リンクに従って、Firebase コンソールで必要なインデックスを作成します。
  3. インデックスが作成された後にクエリを再試行してください(数分かかる場合があります)
firestore_list_collectionsでの Zod 検証エラー

firestore_list_collectionsツールの使用時に、「Expected object, received boolean」というメッセージを含む Zod 検証エラーが表示される場合:

⚠️既知の問題firestore_list_collectionsツールは、クライアントログに Zod 検証エラーを返す場合があります。これは MCP SDK の誤った検証エラーであり、調査の結果、レスポンスにブール値が含まれていないことが確認されました。エラーメッセージが表示されても、クエリは正常に動作し、適切なコレクションデータを返します。これはログレベルのエラーであり、機能には影響しません。

デバッグ

ファイルログを有効にする

問題の診断を支援するために、ファイル ログを有効にすることができます。

# Log to default location (~/.firebase-mcp/debug.log) DEBUG_LOG_FILE=true npx @gannonh/firebase-mcp # Log to a custom location DEBUG_LOG_FILE=/path/to/custom/debug.log npx @gannonh/firebase-mcp

MCP クライアント構成でログ記録を有効にすることもできます。

{ "firebase-mcp": { "command": "npx", "args": ["-y", "@gannonh/firebase-mcp"], "env": { "SERVICE_ACCOUNT_KEY_PATH": "/path/to/serviceAccountKey.json", "FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app", "DEBUG_LOG_FILE": "true" } } }
リアルタイムログ表示

ログをリアルタイムで表示するには:

# Using tail to follow the log file tail -f ~/.firebase-mcp/debug.log # Using a split terminal to capture stderr npm start 2>&1 | tee logs.txt
MCPインスペクターの使用

MCP インスペクタは対話型のデバッグを提供します。

# Install MCP Inspector npm install -g @mcp/inspector # Connect to your MCP server mcp-inspector --connect stdio --command "node ./dist/index.js"

📋 レスポンスのフォーマット

ストレージアップロードレスポンスの例

{ "name": "reports/quarterly.pdf", "size": "1024000", "contentType": "application/pdf", "updated": "2025-04-11T15:37:10.290Z", "downloadUrl": "https://storage.googleapis.com/bucket/reports/quarterly.pdf?alt=media", "bucket": "your-project.appspot.com" }

ユーザーには次のように表示されます:

## File Successfully Uploaded! 📁 Your file has been uploaded to Firebase Storage: **File Details:** - **Name:** reports/quarterly.pdf - **Size:** 1024000 bytes - **Type:** application/pdf - **Last Updated:** April 11, 2025 at 15:37:10 UTC **[Click here to download your file](https://storage.googleapis.com/bucket/reports/quarterly.pdf?alt=media)**

🤝 貢献する

  1. リポジトリをフォークする
  2. 機能ブランチを作成する
  3. テストを使用して変更を実装する(80%以上のカバレッジが必要)
  4. プルリクエストを送信する

📄 ライセンス

MITライセンス - 詳細はLICENSEファイルを参照

🔗 関連リソース

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Firebase MCP サーバーは、Firebase Authentication、Firestore、Firebase Storage などの Firebase サービスと対話するための標準化されたインターフェースを提供します。

  1. 概要
    1. ⚡ クイックスタート
      1. 前提条件
      2. MCPサーバーをインストールする
      3. インストールをテストする
    2. 🛠️ セットアップと構成
      1. Firebaseの設定
      2. 環境変数
      3. クライアント統合
    3. 📚 APIリファレンス
      1. Firestore ツール
      2. ストレージツール
      3. 認証ツール
    4. 💻 開発者ガイド
      1. 設置と構築
      2. テストの実行
      3. プロジェクト構造
    5. 🌐 HTTP トランスポート
      1. HTTPトランスポートで実行
      2. HTTPクライアント構成
      3. セッション管理
    6. 🔍 トラブルシューティング
      1. よくある問題
      2. デバッグ
    7. 📋 レスポンスのフォーマット
      1. ストレージアップロードレスポンスの例
    8. 🤝 貢献する
      1. 📄 ライセンス
        1. 🔗 関連リソース

          Related MCP Servers

          • -
            security
            F
            license
            -
            quality
            An MCP server that provides access to Firebase Remote Config, allowing clients to interact with and manage Firebase remote configuration settings through the Model Context Protocol.
            Last updated -
            TypeScript
          • -
            security
            F
            license
            -
            quality
            Auto-generated MCP server that enables interaction with the Firebase App Distribution API, allowing users to manage distribution of pre-release app builds to testers through natural language commands.
            Last updated -
            Python
          • -
            security
            F
            license
            -
            quality
            An MCP Server providing access to Google's Firebase API, allowing natural language interaction with Firebase services and resources.
            Last updated -
            Python
            • Linux
            • Apple

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/gannonh/firebase-mcp'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server