firebase-mcp-server
Gives an AI agent a schema-aware view of Firebase.
$ npx -y @dasasian/firebase-mcp-server start
It reads ./firestore-schemas.json by default, or you pass a path; auth is your own Application Default Credentials. The same command goes in an MCP client’s config.
MIT · 1.1.0 · also on npm and the MCP registry
Why it exists
An agent working in a Firebase app is working half-blind. It can call the Admin SDK, but it has no idea what a document is supposed to look like — which fields are current, which are half-migrated, which were renamed two releases ago and never cleaned up. So it reads a collection, infers a shape from whatever happens to be there, and writes something plausible that quietly doesn’t match.
Most Firebase tooling for agents leans into that: hand over raw SDK access and hope. It holds up until the data has history in it. This one starts from the schema you already keep — Firebase’s own path convention, users/{userId}/orders/{orderId} — and checks every read and write against it, aware that a field can be official, experimental, or legacy, not merely present or absent.
The other half is the context window. A naive “read this collection” answer pulls thousands of documents through the model just to count them. The query tools return the count, the sum, the projection, the overview — the answer, not the raw material for it — which is the difference between a question an agent can afford to ask and one it can’t.
The tool list is itself a context cost, charged before anything is asked: thirty-three tool definitions run to roughly twelve thousand tokens in every session. So the surface divides. --tools firestore loads the twelve Firestore tools and leaves Auth, Storage, and logging out of the conversation entirely.
And it works without a schema at all: pointed at an unfamiliar database it discovers collections rather than refusing. Schemas make it careful; their absence doesn’t make it useless.
Under it
- Built with
- TypeScript in strict mode, the Model Context Protocol SDK, ajv for JSON-Schema validation, and the Firebase Admin SDK. Node 18+.
- Surface
- Thirty-three tools in four groups you can load separately. Reads and writes, schema validation, index-aware queries; context-efficient count, select, sum, and stats; and SQL-like Cloud Functions log queries.
- Consent
- Every tool declares whether it reads or writes, and whether a write can be undone, so a client can wave a count through and stop to ask before a delete.
- Schema
- Firebase’s path-based convention, with field-status metadata — official, experimental, legacy — so validation warns on the fields you are migrating rather than only the missing ones.
- Mentions
- Firestore documents are addressable as @-mention resources. Recently read ones are listed; everything else is reachable through a URI template built from your schema, so a document need not have been seen before it can be named.
- Tested
- The pure logic — path matching, schema validation, the import diff, timestamp serialization, the log query engine — runs a unit suite on Node 18, 20, and 22 on every commit.
- License
- MIT
More open source
- gdocs-mcp
- A Google Doc as a local file, for an agent.
- firebase-structured-logger
- Browser errors, symbolicated and structured.