Interact with Firebase Firestore databases through full CRUD operations.
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 / リポジトリをクローン
git clone https://github.com/your-username/firestore-mcp.git
cd firestore-mcp
2. Install dependencies / 依存関係をインストール
npm install
3. Configure Firebase credentials / Firebase認証情報を設定
Copy the example environment file: / 環境変数ファイルをコピー:
cp .env.example .env
Edit .env with your Firebase credentials: / .envにFirebase認証情報を設定:
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_CLIENT_EMAIL=firebase-adminsdk-xxxxx@your-project.iam.gserviceaccount.com
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
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 / プロジェクトをビルド
npm run build
Claude Code Configuration / Claude Code設定
Project-level configuration (recommended) / プロジェクトレベル設定(推奨)
Create .mcp.json in your project root: / プロジェクトルートに.mcp.jsonを作成:
{
"mcpServers": {
"firestore": {
"command": "node",
"args": ["/path/to/firestore-mcp/dist/index.js"]
}
}
}
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ファイルを使用しない場合:
{
"mcpServers": {
"firestore": {
"command": "node",
"args": ["/path/to/firestore-mcp/dist/index.js"],
"env": {
"FIREBASE_PROJECT_ID": "your-project-id",
"FIREBASE_CLIENT_EMAIL": "your-client-email",
"FIREBASE_PRIVATE_KEY": "-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n"
}
}
}
}
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_collections |
List all top-level collections / トップレベルコレクションを一覧表示 | None |
list_subcollections |
List subcollections of a document / ドキュメントのサブコレクションを一覧表示 | documentPath |
count_documents |
Count documents in a collection / コレクション内のドキュメント数をカウント | collectionPath |
Document Operations / ドキュメント操作
| Tool | Description | Parameters |
|---|---|---|
get_document |
Get a single document / 単一ドキュメントを取得 | documentPath |
list_documents |
List documents in a collection / コレクション内のドキュメントを一覧表示 | collectionPath, limit? |
create_document |
Create a new document / 新しいドキュメントを作成 | collectionPath, data, documentId? |
update_document |
Update an existing document / 既存ドキュメントを更新 | documentPath, data, merge? |
delete_document |
Delete a document / ドキュメントを削除 | documentPath |
Query Operations / クエリ操作
| Tool | Description | Parameters |
|---|---|---|
query_documents |
Query with filters / フィルタ付きクエリ | collectionPath, field, operator, value, limit? |
Supported Query Operators / サポートされているクエリ演算子
==- Equal to / 等しい!=- Not equa
Tools (9)
list_collectionsList all top-level collectionslist_subcollectionsList subcollections of a documentcount_documentsCount documents in a collectionget_documentGet a single documentlist_documentsList documents in a collectioncreate_documentCreate a new documentupdate_documentUpdate an existing documentdelete_documentDelete a documentquery_documentsQuery with filtersEnvironment Variables
FIREBASE_PROJECT_IDrequiredYour Firebase project IDFIREBASE_CLIENT_EMAILrequiredFirebase service account client emailFIREBASE_PRIVATE_KEYrequiredFirebase service account private keyConfiguration
{"mcpServers": {"firestore": {"command": "node", "args": ["/path/to/firestore-mcp/dist/index.js"]}}}