Firebase Mcp Server

io.github.dasasian由 GitHub 帳號 dasasian 發布v1.1.0更新於 Oct 24, 2026

MCP server for Firebase — Firestore, Storage, Auth, and Cloud Logging, with schema validation.

概覽

AI 產生的概覽

一個本機 Firebase MCP 伺服器,讓助理瀏覽、查詢和修改 Firestore、Storage 與 Auth 資料,並查詢 Cloud Functions 日誌。

可以做什麼
瀏覽和讀取 Firestore 集合與文件,執行查詢、計數、加總和統計,並依路徑式 schema 驗證文件,可選自動探索未登記的集合與索引感知的查詢檢查。匯入、更新和刪除 Firestore 文件。列出、讀取、上傳、複製、移動、同步和刪除 Storage 檔案,並檢視或設定檔案存取權。列出、建立、更新和刪除 Auth 使用者,並撤銷其工作階段。以類 SQL 的篩選、分組和彙總查詢 Cloud Functions 日誌。
適用情境
當你使用 Firebase 專案,希望助理不必離開對話就能檢視或編輯 Firestore 資料、管理 Storage 檔案或 Auth 使用者,或排查 Cloud Functions 日誌時適用。提供 schema 檔案可強化驗證與自動完成,但在未知資料庫上也能以探索模式運作。
執行需求
透過 npx 或全域 npm 安裝在本機執行(需要 Node.js)。Firebase 驗證使用應用程式預設憑證,因此需要已設定的 Google Cloud/Firebase 專案與憑證。啟動時可傳入選用的 schema 與索引 JSON 路徑;可用命令列旗標或環境變數限制工具群組。讀取函式日誌需要為 Admin SDK 服務帳號授予日誌檢視存取的 IAM 角色。
安裝前請注意
許多工具會寫入或刪除:Firestore 的匯入、更新和刪除;Storage 的上傳、刪除、複製、移動、同步、推送和權限變更;Auth 使用者的建立、更新、刪除和工作階段撤銷。這些操作作用於真實專案資料,核准前請確認。自動探索會產生少量 Firestore 讀取費用。日誌工具會將探索到的 schema 檔案寫入磁碟。憑證來自應用程式預設憑證,伺服器會繼承其專案層級權限。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Firebase Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Firebase MCP Server

[npm] [License: MIT] [Model Context Protocol server] [Node 18+]

General-purpose Model Context Protocol (MCP) server for Firebase (Firestore, Storage, Auth, Functions Logging) with schema-driven validation and context-efficient tools.

Features

  • @ Mention Support - Reference Firestore documents with @firebase:firestore://users/user-123
  • Smart Autocomplete - MRU cache tracks accessed documents for quick re-reference
  • Auto-Discovery - Shows both schema-based AND discovered collections
  • Path-based schemas - Follows Firebase firestore.rules convention
  • Schema evolution - Field status metadata (experimental → official → legacy)
  • Hot reload - File watching, no restart needed when schemas change
  • Flexible validation - Three modes: strict, warn (default), permissive
  • Works without schemas - Discovery mode for exploring unknown databases
  • Context-efficient tools - 99% token reduction for large datasets
  • Index-aware queries - Validates queries against firestore.indexes.json
  • Functions logging - SQL-like queries for Cloud Functions logs with aggregations and label filtering

Install

Add it to your MCP client (e.g. Claude Code) — runs via npx, no global install needed:

jsonc
{  "mcpServers": {    "firebase": {      "command": "npx",      "args": ["-y", "@dasasian/firebase-mcp-server", "start", "./firestore-schemas.json"]    }  }}

start takes an optional schema config path (default ./firestore-schemas.json) and an optional indexes path (default ./firestore.indexes.json) — see Schema Format. Firebase auth uses Application Default Credentials.

Or install the CLI globally:

bash
npm install -g @dasasian/firebase-mcp-serverfirebase-mcp start ./firestore-schemas.json

Development (from source)

bash
npm installnpm run buildnpm run cli -- start --config ./examples/basic/firestore-schemas.json

@ Mention Support (Resources)

Reference Firestore documents directly in Claude Code:

What's the email for @firebase:firestore://users/user-123?Show me all posts: @firebase:firestore://posts/*

How It Works

When you type @firebase in Claude Code:

Shows schema-based collections (with validation):

  • 📋 Users (User account documents)
  • 📋 Posts (Blog post documents)
  • 📋 Comments (Comments on posts)

Plus auto-discovered collections (no schema):

  • 🔍 analytics
  • 🔍 sessions
  • 🔍 audit_logs

Configuration

bash
# Enable/disable auto-discovery (default: true)export FIRESTORE_AUTO_DISCOVER=true
# Cache duration in seconds (default: 300 = 5 minutes)export FIRESTORE_DISCOVERY_CACHE_TTL=300

Auto-discovery cost: ~$0.0003/day (negligible)

Tools

The server ships 33 tools in four groups. Every tool declares MCP annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) so a client can auto-approve reads and ask before writes.

Choosing which tools to load

All 33 tool definitions cost roughly 12k tokens of context on every session. If you only need part of the surface, narrow it:

bash
# Only Firestore (12 tools, ~4.3k tokens)firebase-mcp start --tools firestore
# Firestore plus Authfirebase-mcp start --tools firestore,auth

Or set it in your MCP client config:

bash
export FIREBASE_MCP_TOOLS=firestore,storage

The --tools flag wins over the environment variable. Leaving both unset loads everything, so upgrading never hides a tool you were already using. Calling a tool from a group you switched off returns an error naming the group to add.

GroupTools~Tokens
firestore124,341
storage144,152
auth62,075
logs11,817
all (default)3312,387

Firestore (12) — --tools firestore

  • firestore_show_collections — Show collections (read)
  • firestore_read — Read document (read)
  • firestore_export — Export collection (read)
  • firestore_validate — Validate against schema (read)
  • firestore_query_select — Query documents (read)
  • firestore_query_collection_group — Query collection group (read)
  • firestore_count — Count documents (read)
  • firestore_sum — Sum a field (read)
  • firestore_stats — Collection statistics (read)
  • firestore_import — Import document (write, destructive)
  • firestore_update — Update documents (write, destructive)
  • firestore_delete — Delete documents (write, destructive)

Firebase Auth (6) — --tools auth

  • firebase_auth_list_users — List users (read)
  • firebase_auth_get_user — Get user (read)
  • firebase_auth_create_user — Create user (write)
  • firebase_auth_update_user — Update user (write, destructive)
  • firebase_auth_delete_user — Delete user (write, destructive)
  • firebase_auth_revoke_sessions — Revoke sessions (write, destructive)

Firebase Storage (14) — --tools storage

  • firebase_storage_list_buckets — List buckets (read)
  • firebase_storage_ls — List files (read)
  • firebase_storage_stat — File metadata (read)
  • firebase_storage_find — Find files (read)
  • firebase_storage_get_url — Get file URL (read)
  • firebase_storage_get_access — Get file access (read)
  • firebase_storage_read — Download file to a local temp path (write)
  • firebase_storage_upload — Upload file (write, destructive)
  • firebase_storage_rm — Delete file (write, destructive)
  • firebase_storage_cp — Copy file (write, destructive)
  • firebase_storage_mv — Move file (write, destructive)
  • firebase_storage_sync — Sync bucket to local (write, destructive)
  • firebase_storage_push — Push local to bucket (write, destructive)
  • firebase_storage_set_access — Set file access (write, destructive)

Cloud Logging (1) — --tools logs

  • firebase_functions_logs — Query Cloud Functions logs with SQL-like syntax (write)

firebase_storage_read and firebase_functions_logs are not marked read-only because they write: the first downloads to a local temp file, the second updates its auto-discovered logging schema on disk.

Reading function logs needs an extra IAM role. The Firebase Admin SDK service account has no Cloud Logging access by default, so firebase_functions_logs fails with PERMISSION_DENIED: Permission denied for all log views even when every other tool works. Grant the role and allow a few minutes for it to take effect:

bash
gcloud projects add-iam-policy-binding PROJECT_ID \  --member="serviceAccount:firebase-adminsdk-xxxxx@PROJECT_ID.iam.gserviceaccount.com" \  --role="roles/logging.viewAccessor"

roles/logging.viewer alone may not be enough — the error names log views, and the logging.views.access permission is in viewAccessor.

Example queries:

json
// Discover what functions exist{"distinct": "functionName"}
// Show recent errors{"where": [{"field": "severity", "operator": "==", "value": "ERROR"}], "limit": 20}
// Top error patterns with counts (use "message" — structured logs have no textPayload){"groupBy": ["message"], "aggregates": [{"field": "*", "operation": "count", "alias": "count"}], "where": [{"field": "severity", "operator": "==", "value": "ERROR"}], "orderBy": [{"field": "count", "direction": "desc"}], "limit": 10}
// Filter by custom labels (e.g., user, environment){"where": [{"field": "labels.user_id", "operator": "==", "value": "123"}]}

Schema Format

Schemas follow Firebase's path-based convention:

json
{  "schemas": {    "/organizations/{organizationId}": {      "description": "Organization documents",      "schema": {        "type": "object",        "required": ["id", "name"],        "properties": {          "id": { "type": "string" },          "name": { "type": "string" }        }      }    },    "/organizations/{organizationId}/products/{productId}": {      "description": "Product catalog",      "schema": {        "type": "object",        "properties": {          "name": { "type": "string" },          "category": {            "type": "string",            "x-status": "legacy",            "x-replacedBy": "productType"          },          "productType": {            "type": "string",            "x-status": "experimental"          }        }      },      "timestampFields": ["createdAt", "updatedAt"]    }  }}

Documentation

License

MIT

來源:README.md,提交 0d4d5b3

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.1.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分