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 分