Firebase MCP
Firebase MCP

概要
Firebase MCP を使用すると、AI アシスタントが次のような Firebase サービスと直接連携できるようになります。
Firestore : ドキュメントデータベース操作
ストレージ: 強力なアップロード機能を備えたファイル管理
認証: ユーザー管理と検証
サーバーは、 Claude Desktop 、 Augment Code 、 VS Code 、 Cursorなどの MCP クライアント アプリケーションで動作します。
⚠️既知の問題:
firestore_list_collectionsツールは、クライアントログに Zod 検証エラーを返す場合があります。これは MCP SDK の誤った検証エラーであり、調査の結果、レスポンスにブール値が含まれていないことが確認されました。エラーメッセージが表示されても、クエリは正常に動作し、適切なコレクションデータを返します。これはログレベルのエラーであり、機能には影響しません。
Related MCP server: FireConfigMCP
⚡ クイックスタート
前提条件
サービス アカウントの認証情報を持つ 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の設定
Firebaseコンソール→プロジェクト設定→サービスアカウントに移動します
「新しい秘密鍵を生成」をクリックします
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 ツール
道具 | 説明 | 必須パラメータ |
| コレクションにドキュメントを追加する |
|
| フィルタリングしたドキュメントの一覧 |
|
| 特定の文書を取得する |
|
| 既存のドキュメントを更新する |
|
| ドキュメントを削除する |
|
| ルートコレクションの一覧 | なし |
| サブコレクション間のクエリ |
|
ストレージツール
道具 | 説明 | 必須パラメータ |
| ディレクトリ内のファイルを一覧表示する | なし(オプション: |
| ファイルのメタデータとURLを取得する |
|
| コンテンツからファイルをアップロード |
|
| URLからファイルをアップロード |
|
認証ツール
道具 | 説明 | 必須パラメータ |
| IDまたはメールでユーザーを取得する |
|
💻 開発者ガイド
設置と構築
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-mcpHTTPクライアント構成
HTTP トランスポートを使用する場合は、MCP クライアントを HTTP エンドポイントに接続するように構成します。
{
"firebase-mcp": {
"url": "http://localhost:3000/mcp"
}
}セッション管理
HTTPトランスポートはセッション管理をサポートしており、複数のクライアントが同じサーバーインスタンスに接続できます。各クライアントは、リクエスト間の状態を維持するために使用される一意のセッションIDを受け取ります。
🔍 トラブルシューティング
よくある問題
ストレージバケットが見つかりません
「指定されたバケットが存在しません」というエラーが表示された場合:
Firebaseコンソール→ストレージでバケット名を確認します
FIREBASE_STORAGE_BUCKET環境変数に正しいバケット名を設定します
Firebaseの初期化に失敗しました
「Firebase が初期化されていません」というエラーが表示される場合:
サービス アカウント キーのパスが正しく絶対であることを確認してください
サービス アカウントに Firebase サービスに対する適切な権限があることを確認する
複合インデックスが必要です
「このクエリには複合インデックスが必要です」というエラーが表示された場合:
エラーメッセージに記載されているURLを探します
リンクに従って、Firebase コンソールで必要なインデックスを作成します。
インデックスが作成された後にクエリを再試行してください(数分かかる場合があります)
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-mcpMCP クライアント構成でログ記録を有効にすることもできます。
{
"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.txtMCPインスペクターの使用
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)**🤝 貢献する
リポジトリをフォークする
機能ブランチを作成する
テストを使用して変更を実装する(80%以上のカバレッジが必要)
プルリクエストを送信する
📄 ライセンス
MITライセンス - 詳細はLICENSEファイルを参照
🔗 関連リソース
This server cannot be deployed
Maintenance
Related MCP Connectors
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
MCP server for Appcircle mobile CI/CD platform.
The Fireflies MCP Server enables AI tools to connect directly to meeting data from Fireflies.ai, providing access to meeting transcripts, summaries, action items, and insights without switching platforms. It includes capabilities for querying cross-meeting data for analysis (such as sales insights or product feedback), and a separate Documentation MCP Server that allows searching the Fireflies knowledge base for API references, guides, and code examples.
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Related MCP Servers
- AlicenseAqualityDmaintenanceA server providing a unified interface to interact with Firebase services, including Authentication, Firestore, and Storage.974 npm10MIT
- FlicenseNot gradedqualityDmaintenanceAn 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.-
- FlicenseNot gradedqualityDmaintenanceAn MCP Server providing access to Google's Firebase API, allowing natural language interaction with Firebase services and resources.-
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides a conversational interface to Firebase Rules API, allowing users to manage and deploy rules that determine data access in Firebase services.-