Provides comprehensive tools for interacting with Firebase Firestore, enabling CRUD operations, collection and subcollection management, document counting, and complex querying with automatic support for Firestore-specific data types.
Enables secure access and management of Firestore databases within the Google Cloud Platform, supporting document manipulation and collection navigation through service account authentication and IAM role management.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Firestore MCP ServerFind all documents in the 'users' collection where 'status' equals 'active'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Firestore MCP Server
Model Context Protocol (MCP) server for Firebase Firestore. This server enables AI assistants like Claude to directly interact with your Firestore database.
Firebase Firestore用のModel Context Protocol (MCP)サーバーです。ClaudeなどのAIアシスタントがFirestoreデータベースと直接やり取りできるようになります。
Features / 機能
Full CRUD Operations: Create, read, update, and delete documents
Collection Management: List collections and subcollections
Query Support: Filter documents with Firestore query operators
Document Counting: Get document counts without fetching all data
Type Conversion: Automatic handling of Firestore types (Timestamp, GeoPoint, etc.)
フルCRUD操作: ドキュメントの作成、読み取り、更新、削除
コレクション管理: コレクションとサブコレクションの一覧表示
クエリサポート: Firestoreクエリ演算子によるドキュメントのフィルタリング
ドキュメントカウント: 全データを取得せずにドキュメント数を取得
型変換: Firestoreの型(Timestamp、GeoPointなど)の自動処理
Requirements / 必要条件
Node.js 18+
Firebase project with Firestore enabled / Firestoreが有効なFirebaseプロジェクト
Firebase Admin SDK credentials (service account) / Firebase Admin SDK認証情報(サービスアカウント)
Installation / インストール
1. Clone the repository / リポジトリをクローン
2. Install dependencies / 依存関係をインストール
3. Configure Firebase credentials / Firebase認証情報を設定
Copy the example environment file: / 環境変数ファイルをコピー:
Edit .env with your Firebase credentials: / .envにFirebase認証情報を設定:
How to get Firebase credentials / Firebase認証情報の取得方法
Go to Firebase Console / Firebaseコンソールにアクセス
Select your project / プロジェクトを選択
Navigate to Project Settings > Service accounts / プロジェクトの設定 > サービスアカウントに移動
Click Generate new private key / 新しい秘密鍵を生成をクリック
Download the JSON file / JSONファイルをダウンロード
Copy values to your
.envfile: /.envファイルに値をコピー:project_id→FIREBASE_PROJECT_IDclient_email→FIREBASE_CLIENT_EMAILprivate_key→FIREBASE_PRIVATE_KEY
4. Build the project / プロジェクトをビルド
Claude Code Configuration / Claude Code設定
Project-level configuration (recommended) / プロジェクトレベル設定(推奨)
Create .mcp.json in your project root: / プロジェクトルートに.mcp.jsonを作成:
Note: The server automatically loads
.envfrom its installation directory, socwdis not required.注意: サーバーはインストールディレクトリから自動的に
.envを読み込むため、cwdは不要です。
With environment variables inline / 環境変数をインラインで指定
If you prefer not to use a .env file: / .envファイルを使用しない場合:
After configuration / 設定後
Restart Claude Code / Claude Codeを再起動
When prompted, approve the MCP server / プロンプトが表示されたらMCPサーバーを承認
The Firestore tools will be available in your conversation / Firestoreツールが会話で使用可能になります
Available Tools / 利用可能なツール
Collection Operations / コレクション操作
Tool | Description | Parameters |
| List all top-level collections / トップレベルコレクションを一覧表示 | None |
| List subcollections of a document / ドキュメントのサブコレクションを一覧表示 |
|
| Count documents in a collection / コレクション内のドキュメント数をカウント |
|
Document Operations / ドキュメント操作
Tool | Description | Parameters |
| Get a single document / 単一ドキュメントを取得 |
|
| List documents in a collection / コレクション内のドキュメントを一覧表示 |
|
| Create a new document / 新しいドキュメントを作成 |
|
| Update an existing document / 既存ドキュメントを更新 |
|
| Delete a document / ドキュメントを削除 |
|
Query Operations / クエリ操作
Tool | Description | Parameters |
| Query with filters / フィルタ付きクエリ |
|
Supported Query Operators / サポートされているクエリ演算子
==- Equal to / 等しい!=- Not equal to / 等しくない<- Less than / より小さい<=- Less than or equal to / 以下>- Greater than / より大きい>=- Greater than or equal to / 以上array-contains- Array contains value / 配列に値が含まれるin- Value in array / 配列内の値array-contains-any- Array contains any of values / 配列にいずれかの値が含まれる
Usage Examples / 使用例
List all collections / 全コレクションを一覧表示
Get a specific document / 特定のドキュメントを取得
List documents with limit / ドキュメントを件数制限付きで一覧表示
Query documents / ドキュメントをクエリ
Create a document / ドキュメントを作成
Update a document / ドキュメントを更新
Delete a document / ドキュメントを削除
Access subcollections / サブコレクションにアクセス
Configuration Options / 設定オプション
Environment Variables / 環境変数
Variable | Required | Description |
| Yes | Your Firebase project ID / FirebaseプロジェクトID |
| Yes | Service account email / サービスアカウントのメールアドレス |
| Yes | Service account private key / サービスアカウントの秘密鍵 |
Adjusting Behavior / 動作の調整
Default query limit / デフォルトのクエリ制限
The default limit for list_documents and query_documents is 20. You can override this per-request by specifying the limit parameter.
list_documentsとquery_documentsのデフォルト制限は20件です。limitパラメータを指定することでリクエストごとに上書きできます。
Merge vs Replace on update / 更新時のマージと置換
By default, update_document merges new data with existing document data (merge: true). Set merge: false to replace the entire document.
デフォルトでは、update_documentは新しいデータを既存のドキュメントデータにマージします(merge: true)。ドキュメント全体を置き換えるにはmerge: falseを設定します。
Security Considerations / セキュリティに関する注意事項
Never commit - They contain sensitive credentials
Use service accounts with minimal permissions - Only grant Firestore access needed
Consider read-only service accounts for development - Prevent accidental data modification
Rotate credentials regularly - Generate new service account keys periodically
.env- 機密性の高い認証情報が含まれています最小権限のサービスアカウントを使用 - 必要なFirestoreアクセス権限のみを付与
開発には読み取り専用サービスアカウントを検討 - 誤ってデータを変更することを防止
認証情報を定期的にローテーション - サービスアカウントキーを定期的に再生成
Creating a read-only service account / 読み取り専用サービスアカウントの作成
Go to Google Cloud Console / Google Cloudコンソールにアクセス
Navigate to IAM & Admin > Service Accounts / IAMと管理 > サービスアカウントに移動
Create a new service account / 新しいサービスアカウントを作成
Grant only the
Cloud Datastore Userrole (read-only) /Cloud Datastore ユーザーロール(読み取り専用)のみを付与Generate and download the key / キーを生成してダウンロード
Firestore Data Types / Firestoreデータ型
The server automatically handles these Firestore types:
サーバーは以下のFirestoreデータ型を自動的に処理します:
Firestore Type | JSON Output |
| ISO 8601 string ( |
|
|
| Document path string ( |
| JSON array / JSON配列 |
| JSON object / JSONオブジェクト |
Troubleshooting / トラブルシューティング
"Permission denied" errors / 「権限が拒否されました」エラー
Verify your service account has Firestore access / サービスアカウントにFirestoreアクセス権があることを確認
Check that
FIREBASE_PROJECT_IDmatches your actual project /FIREBASE_PROJECT_IDが実際のプロジェクトと一致していることを確認Ensure the private key includes
\ncharacters for newlines / 秘密鍵に改行用の\n文字が含まれていることを確認
"Could not load the default credentials" / 「デフォルトの認証情報を読み込めませんでした」エラー
Verify all three environment variables are set / 3つの環境変数がすべて設定されていることを確認
Check that
FIREBASE_PRIVATE_KEYis properly quoted /FIREBASE_PRIVATE_KEYが適切に引用符で囲まれていることを確認
MCP server not appearing in Claude / MCPサーバーがClaudeに表示されない
Restart Claude Code after adding
.mcp.json/.mcp.jsonを追加した後、Claude Codeを再起動Check the file path in configuration is correct / 設定のファイルパスが正しいことを確認
Verify the build completed successfully (
dist/index.jsexists) / ビルドが正常に完了したことを確認(dist/index.jsが存在する)
MCP server shows "failed" status / MCPサーバーが「失敗」ステータスを表示
The server loads
.envfrom its installation directory automatically / サーバーはインストールディレクトリから自動的に.envを読み込みますVerify your
.envfile exists in the firestore-mcp directory (not your project directory) /.envファイルがfirestore-mcpディレクトリ(プロジェクトディレクトリではなく)に存在することを確認Run
node /path/to/firestore-mcp/dist/index.jsmanually to see error messages / エラーメッセージを確認するにはnode /path/to/firestore-mcp/dist/index.jsを手動で実行
Development / 開発
License / ライセンス
MIT
Contributing / コントリビュート
Contributions are welcome! Please open an issue or submit a pull request.
コントリビューションを歓迎します!Issueを作成するか、プルリクエストを送信してください。