{
  "markdown": "# Firebase MCP Server\n\n<p>\n  <a href=\"https://www.npmjs.com/package/@dasasian/firebase-mcp-server\"><img alt=\"npm\" src=\"https://img.shields.io/npm/v/@dasasian/firebase-mcp-server?style=flat-square&color=235a9b\"></a>\n  <a href=\"LICENSE\"><img alt=\"License: MIT\" src=\"https://img.shields.io/badge/license-MIT-235a9b?style=flat-square\"></a>\n  <a href=\"https://modelcontextprotocol.io\"><img alt=\"Model Context Protocol server\" src=\"https://img.shields.io/badge/MCP-server-235a9b?style=flat-square\"></a>\n  <img alt=\"Node 18+\" src=\"https://img.shields.io/badge/node-18%2B-5fa04e?style=flat-square\">\n</p>\n\nGeneral-purpose Model Context Protocol (MCP) server for Firebase (Firestore, Storage, Auth, Functions Logging) with schema-driven validation and context-efficient tools.\n\n## Features\n\n- **@ Mention Support** - Reference Firestore documents with `@firebase:firestore://users/user-123`\n- **Smart Autocomplete** - MRU cache tracks accessed documents for quick re-reference\n- **Auto-Discovery** - Shows both schema-based AND discovered collections\n- **Path-based schemas** - Follows Firebase `firestore.rules` convention\n- **Schema evolution** - Field status metadata (experimental → official → legacy)\n- **Hot reload** - File watching, no restart needed when schemas change\n- **Flexible validation** - Three modes: strict, warn (default), permissive\n- **Works without schemas** - Discovery mode for exploring unknown databases\n- **Context-efficient tools** - 99% token reduction for large datasets\n- **Index-aware queries** - Validates queries against `firestore.indexes.json`\n- **Functions logging** - SQL-like queries for Cloud Functions logs with aggregations and label filtering\n\n## Install\n\nAdd it to your MCP client (e.g. Claude Code) — runs via `npx`, no global install needed:\n\n```jsonc\n{\n  \"mcpServers\": {\n    \"firebase\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@dasasian/firebase-mcp-server\", \"start\", \"./firestore-schemas.json\"]\n    }\n  }\n}\n```\n\n`start` takes an optional schema config path (default `./firestore-schemas.json`) and an optional indexes path (default `./firestore.indexes.json`) — see [Schema Format](#schema-format). Firebase auth uses Application Default Credentials.\n\nOr install the CLI globally:\n\n```bash\nnpm install -g @dasasian/firebase-mcp-server\nfirebase-mcp start ./firestore-schemas.json\n```\n\n## Development (from source)\n\n```bash\nnpm install\nnpm run build\nnpm run cli -- start --config ./examples/basic/firestore-schemas.json\n```\n\n## @ Mention Support (Resources)\n\nReference Firestore documents directly in Claude Code:\n\n```\nWhat's the email for @firebase:firestore://users/user-123?\nShow me all posts: @firebase:firestore://posts/*\n```\n\n### How It Works\n\nWhen you type `@firebase` in Claude Code:\n\n**Shows schema-based collections** (with validation):\n- 📋 Users (User account documents)\n- 📋 Posts (Blog post documents)\n- 📋 Comments (Comments on posts)\n\n**Plus auto-discovered collections** (no schema):\n- 🔍 analytics\n- 🔍 sessions\n- 🔍 audit_logs\n\n### Configuration\n\n```bash\n# Enable/disable auto-discovery (default: true)\nexport FIRESTORE_AUTO_DISCOVER=true\n\n# Cache duration in seconds (default: 300 = 5 minutes)\nexport FIRESTORE_DISCOVERY_CACHE_TTL=300\n```\n\n**Auto-discovery cost**: ~$0.0003/day (negligible)\n\n## Tools\n\nThe server ships 33 tools in four groups. Every tool declares MCP annotations\n(`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) so a client\ncan auto-approve reads and ask before writes.\n\n### Choosing which tools to load\n\nAll 33 tool definitions cost roughly 12k tokens of context on every session. If\nyou only need part of the surface, narrow it:\n\n```bash\n# Only Firestore (12 tools, ~4.3k tokens)\nfirebase-mcp start --tools firestore\n\n# Firestore plus Auth\nfirebase-mcp start --tools firestore,auth\n```\n\nOr set it in your MCP client config:\n\n```bash\nexport FIREBASE_MCP_TOOLS=firestore,storage\n```\n\nThe `--tools` flag wins over the environment variable. Leaving both unset loads\neverything, so upgrading never hides a tool you were already using. Calling a\ntool from a group you switched off returns an error naming the group to add.\n\n| Group | Tools | ~Tokens |\n|---|---:|---:|\n| `firestore` | 12 | 4,341 |\n| `storage` | 14 | 4,152 |\n| `auth` | 6 | 2,075 |\n| `logs` | 1 | 1,817 |\n| *all (default)* | *33* | *12,387* |\n\n### Firestore (12) — `--tools firestore`\n\n- `firestore_show_collections` — Show collections *(read)*\n- `firestore_read` — Read document *(read)*\n- `firestore_export` — Export collection *(read)*\n- `firestore_validate` — Validate against schema *(read)*\n- `firestore_query_select` — Query documents *(read)*\n- `firestore_query_collection_group` — Query collection group *(read)*\n- `firestore_count` — Count documents *(read)*\n- `firestore_sum` — Sum a field *(read)*\n- `firestore_stats` — Collection statistics *(read)*\n- `firestore_import` — Import document *(write, destructive)*\n- `firestore_update` — Update documents *(write, destructive)*\n- `firestore_delete` — Delete documents *(write, destructive)*\n\n### Firebase Auth (6) — `--tools auth`\n\n- `firebase_auth_list_users` — List users *(read)*\n- `firebase_auth_get_user` — Get user *(read)*\n- `firebase_auth_create_user` — Create user *(write)*\n- `firebase_auth_update_user` — Update user *(write, destructive)*\n- `firebase_auth_delete_user` — Delete user *(write, destructive)*\n- `firebase_auth_revoke_sessions` — Revoke sessions *(write, destructive)*\n\n### Firebase Storage (14) — `--tools storage`\n\n- `firebase_storage_list_buckets` — List buckets *(read)*\n- `firebase_storage_ls` — List files *(read)*\n- `firebase_storage_stat` — File metadata *(read)*\n- `firebase_storage_find` — Find files *(read)*\n- `firebase_storage_get_url` — Get file URL *(read)*\n- `firebase_storage_get_access` — Get file access *(read)*\n- `firebase_storage_read` — Download file to a local temp path *(write)*\n- `firebase_storage_upload` — Upload file *(write, destructive)*\n- `firebase_storage_rm` — Delete file *(write, destructive)*\n- `firebase_storage_cp` — Copy file *(write, destructive)*\n- `firebase_storage_mv` — Move file *(write, destructive)*\n- `firebase_storage_sync` — Sync bucket to local *(write, destructive)*\n- `firebase_storage_push` — Push local to bucket *(write, destructive)*\n- `firebase_storage_set_access` — Set file access *(write, destructive)*\n\n### Cloud Logging (1) — `--tools logs`\n\n- `firebase_functions_logs` — Query Cloud Functions logs with SQL-like syntax *(write)*\n\n`firebase_storage_read` and `firebase_functions_logs` are not marked read-only\nbecause they write: the first downloads to a local temp file, the second updates\nits auto-discovered logging schema on disk.\n\n> **Reading function logs needs an extra IAM role.** The Firebase Admin SDK service\n> account has no Cloud Logging access by default, so `firebase_functions_logs` fails\n> with `PERMISSION_DENIED: Permission denied for all log views` even when every other\n> tool works. Grant the role and allow a few minutes for it to take effect:\n>\n> ```bash\n> gcloud projects add-iam-policy-binding PROJECT_ID \\\n>   --member=\"serviceAccount:firebase-adminsdk-xxxxx@PROJECT_ID.iam.gserviceaccount.com\" \\\n>   --role=\"roles/logging.viewAccessor\"\n> ```\n>\n> `roles/logging.viewer` alone may not be enough — the error names *log views*, and the\n> `logging.views.access` permission is in `viewAccessor`.\n\n**Example queries:**\n```json\n// Discover what functions exist\n{\"distinct\": \"functionName\"}\n\n// Show recent errors\n{\"where\": [{\"field\": \"severity\", \"operator\": \"==\", \"value\": \"ERROR\"}], \"limit\": 20}\n\n// Top error patterns with counts (use \"message\" — structured logs have no textPayload)\n{\"groupBy\": [\"message\"], \"aggregates\": [{\"field\": \"*\", \"operation\": \"count\", \"alias\": \"count\"}], \"where\": [{\"field\": \"severity\", \"operator\": \"==\", \"value\": \"ERROR\"}], \"orderBy\": [{\"field\": \"count\", \"direction\": \"desc\"}], \"limit\": 10}\n\n// Filter by custom labels (e.g., user, environment)\n{\"where\": [{\"field\": \"labels.user_id\", \"operator\": \"==\", \"value\": \"123\"}]}\n```\n\n## Schema Format\n\nSchemas follow Firebase's path-based convention:\n\n```json\n{\n  \"schemas\": {\n    \"/organizations/{organizationId}\": {\n      \"description\": \"Organization documents\",\n      \"schema\": {\n        \"type\": \"object\",\n        \"required\": [\"id\", \"name\"],\n        \"properties\": {\n          \"id\": { \"type\": \"string\" },\n          \"name\": { \"type\": \"string\" }\n        }\n      }\n    },\n    \"/organizations/{organizationId}/products/{productId}\": {\n      \"description\": \"Product catalog\",\n      \"schema\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"name\": { \"type\": \"string\" },\n          \"category\": {\n            \"type\": \"string\",\n            \"x-status\": \"legacy\",\n            \"x-replacedBy\": \"productType\"\n          },\n          \"productType\": {\n            \"type\": \"string\",\n            \"x-status\": \"experimental\"\n          }\n        }\n      },\n      \"timestampFields\": [\"createdAt\", \"updatedAt\"]\n    }\n  }\n}\n```\n\n## Documentation\n\n- [Installation Guide](docs/installation.md)\n- [@ Mention Support Guide](docs/resources-guide.md) - How to use `@firebase:firestore://` references\n- [Configuration Reference](docs/configuration.md)\n- [Schema Creation Guide](docs/schema-guide.md)\n- [Functions Logging Guide](docs/logging-guide.md) - Query Cloud Functions logs with SQL-like syntax, aggregations, and custom labels\n\n## License\n\nMIT\n",
  "bytes": 9339,
  "sha": "2848f09b3a85ed2ab907f2a48c1c0092f3fb9ba03cd790fc94348fd615481e79",
  "repo_slug": "dasasian/firebase-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_dasasian_firebase_mcp_server_71e330bd/readme"
}