Integrate AI with Firebase Services
Full Firestore, Storage, and Authentication access for AI assistants via the Firebase Admin SDK, over stdio or multi-session HTTP.
Maintainer of this project? Claim this page to edit the listing.
1.4.9Add to Favorites
Why it matters
Enable AI assistants to directly interact with Firebase services like Firestore, Storage, and Authentication. This connector allows for seamless data management and user authentication within your AI applications.
Outcomes
What it gets done
Perform CRUD operations on Firestore documents.
Manage files in Firebase Storage, including uploads.
Access and verify Firebase Authentication users.
Configure secure access using service account keys.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-firebase | bash Capabilities
Tools your agent gets
Add a document to a Firestore collection
List documents in a collection with filtering options
Get a specific document from Firestore
Update an existing Firestore document
Delete a document from Firestore
List root collections in Firestore
Query subcollections across Firestore
List files in a Firebase Storage directory
Overview
Firebase MCP Server
This MCP server gives an AI assistant direct access to Firestore documents, Firebase Storage files, and Authentication user lookups via a service account key, over stdio or session-managed HTTP. Use it for Firebase-backed app development or data management conversationally. Composite-index errors include a fix link; a known log-level Zod error on firestore_list_collections doesn't affect actual functionality.
What it does
Firebase MCP lets AI assistants work directly with Firebase services: Firestore document database operations, Storage file management (including upload from raw content or from a URL), and Authentication user lookups. It connects using a Firebase service account key and supports both stdio (default) and HTTP transport, with the HTTP mode supporting session management so multiple clients can share one running server instance.
When to use - and when NOT to
Use this when you want an AI assistant to read/write Firestore documents, manage files in Firebase Storage, or look up user accounts, directly from a conversation - useful for app development, data inspection, or content management workflows built on Firebase. It requires a Firebase service account key with proper permissions (SERVICE_ACCOUNT_KEY_PATH) and, for Storage, the correct bucket name (FIREBASE_STORAGE_BUCKET) since Firebase's default bucket naming has changed over time and a wrong bucket name produces a "bucket does not exist" error. Firestore queries that need composite indexes will fail with an error containing a direct link to create that index in the Firebase Console - follow it and retry after the index finishes building (can take a few minutes). Setup itself requires a Firebase project with service account credentials and a Node.js environment before the MCP server configuration is added. Note: firestore_list_collections may log a spurious Zod validation error in client logs even though the query itself works correctly and returns proper data - this is a known MCP SDK log-level issue, not a functional bug.
Capabilities
Firestore: firestore_add_document, firestore_list_documents (filterable), firestore_get_document, firestore_update_document, firestore_delete_document, firestore_list_collections, firestore_query_collection_group (queries across subcollections). Storage: storage_list_files, storage_get_file_info, storage_upload (from content), storage_upload_from_url. Auth: auth_get_user (by ID or email).
How to install
{
"firebase-mcp": {
"command": "npx",
"args": ["-y", "@gannonh/firebase-mcp"],
"env": {
"SERVICE_ACCOUNT_KEY_PATH": "/absolute/path/to/serviceAccountKey.json",
"FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app"
}
}
}
Generate the service account key at Firebase Console > Project Settings > Service Accounts > Generate new private key. Supports Claude Desktop, Augment, VS Code, and Cursor. A local-installation alternative to the npx form points command at node with the path to a built dist/index.js, using the same SERVICE_ACCOUNT_KEY_PATH/FIREBASE_STORAGE_BUCKET environment variables. For HTTP transport (multi-client, session-managed): MCP_TRANSPORT=http MCP_HTTP_PORT=3000 npx @gannonh/firebase-mcp, then point clients at http://localhost:3000/mcp. After configuring, the install can be verified by asking the AI client to test all Firebase MCP tools.
Who it's for
Developers building or managing Firebase-backed applications who want an AI assistant to query/update Firestore, manage Storage files, and look up Auth users directly from a conversation, without switching to the Firebase Console or writing one-off admin scripts for routine lookups. Licensed MIT.
Source README
Firebase MCP
Overview
Firebase MCP enables AI assistants to work directly with Firebase services, including:
- Firestore: Document database operations
- Storage: File management with robust upload capabilities
- Authentication: User management and verification
The server works with MCP client applicatios such as Claude Desktop, Augment Code, VS Code, and Cursor.
⚠️ Known Issue: The
firestore_list_collectionstool may return a Zod validation error in the client logs. This is an erroneous validation error in the MCP SDK, as our investigation confirmed no boolean values are present in the response. Despite the error message, the query still works correctly and returns the proper collection data. This is a log-level error that doesn't affect functionality.
⚡ Quick Start
Prerequisites
- Firebase project with service account credentials
- Node.js environment
1. Install MCP Server
Add the server configuration to your MCP settings file:
- Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json - Augment:
~/Library/Application Support/Code/User/settings.json - Cursor:
[project root]/.cursor/mcp.json
MCP Servers can be installed manually or at runtime via npx (recommended). How you install determines your configuration:
Configure for npx (recommended)
{
"firebase-mcp": {
"command": "npx",
"args": [
"-y",
"@gannonh/firebase-mcp"
],
"env": {
"SERVICE_ACCOUNT_KEY_PATH": "/absolute/path/to/serviceAccountKey.json",
"FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app"
}
}
}
Configure for local installation
{
"firebase-mcp": {
"command": "node",
"args": [
"/absolute/path/to/firebase-mcp/dist/index.js"
],
"env": {
"SERVICE_ACCOUNT_KEY_PATH": "/absolute/path/to/serviceAccountKey.json",
"FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app"
}
}
}
2. Test the Installation
Ask your AI client: "Please test all Firebase MCP tools."
🛠️ Setup & Configuration
1. Firebase Configuration
- Go to Firebase Console → Project Settings → Service Accounts
- Click "Generate new private key"
- Save the JSON file securely
2. Environment Variables
Required
SERVICE_ACCOUNT_KEY_PATH: Path to your Firebase service account key JSON (required)
Optional
FIREBASE_STORAGE_BUCKET: Bucket name for Firebase Storage (defaults to[projectId].appspot.com)MCP_TRANSPORT: Transport type to use (stdioorhttp) (defaults tostdio)MCP_HTTP_PORT: Port for HTTP transport (defaults to3000)MCP_HTTP_HOST: Host for HTTP transport (defaults tolocalhost)MCP_HTTP_PATH: Path for HTTP transport (defaults to/mcp)DEBUG_LOG_FILE: Enable file logging:- Set to
trueto log to~/.firebase-mcp/debug.log - Set to a file path to log to a custom location
- Set to
3. Client Integration
Claude Desktop
Edit: ~/Library/Application Support/Claude/claude_desktop_config.json
VS Code / Augment
Edit: ~/Library/Application Support/Code/User/settings.json
Cursor
Edit: [project root]/.cursor/mcp.json
📚 API Reference
Firestore Tools
| Tool | Description | Required Parameters |
|---|---|---|
firestore_add_document |
Add a document to a collection | collection, data |
firestore_list_documents |
List documents with filtering | collection |
firestore_get_document |
Get a specific document | collection, id |
firestore_update_document |
Update an existing document | collection, id, data |
firestore_delete_document |
Delete a document | collection, id |
firestore_list_collections |
List root collections | None |
firestore_query_collection_group |
Query across subcollections | collectionId |
Storage Tools
| Tool | Description | Required Parameters |
|---|---|---|
storage_list_files |
List files in a directory | None (optional: directoryPath) |
storage_get_file_info |
Get file metadata and URL | filePath |
storage_upload |
Upload file from content | filePath, content |
storage_upload_from_url |
Upload file from URL | filePath, url |
Authentication Tools
| Tool | Description | Required Parameters |
|---|---|---|
auth_get_user |
Get user by ID or email | identifier |
💻 Developer Guide
Installation & Building
git clone https://github.com/gannonh/firebase-mcp
cd firebase-mcp
npm install
npm run build
Running Tests
First, install and start Firebase emulators:
npm install -g firebase-tools
firebase init emulators
firebase emulators:start
Then run tests:
# Run tests with emulator
npm run test:emulator
# Run tests with coverage
npm run test:coverage:emulator
Project Structure
src/
├── index.ts # Server entry point
├── utils/ # Utility functions
└── lib/
└── firebase/ # Firebase service clients
├── authClient.ts # Authentication operations
├── firebaseConfig.ts # Firebase configuration
├── firestoreClient.ts # Firestore operations
└── storageClient.ts # Storage operations
🌐 HTTP Transport
Firebase MCP now supports HTTP transport in addition to the default stdio transport. This allows you to run the server as a standalone HTTP service that can be accessed by multiple clients.
Running with HTTP Transport
To run the server with HTTP transport:
# Using environment variables
MCP_TRANSPORT=http MCP_HTTP_PORT=3000 node dist/index.js
# Or with npx
MCP_TRANSPORT=http MCP_HTTP_PORT=3000 npx @gannonh/firebase-mcp
Client Configuration for HTTP
When using HTTP transport, configure your MCP client to connect to the HTTP endpoint:
{
"firebase-mcp": {
"url": "http://localhost:3000/mcp"
}
}
Session Management
The HTTP transport supports session management, allowing multiple clients to connect to the same server instance. Each client receives a unique session ID that is used to maintain state between requests.
🔍 Troubleshooting
Common Issues
Storage Bucket Not Found
If you see "The specified bucket does not exist" error:
- Verify your bucket name in Firebase Console → Storage
- Set the correct bucket name in
FIREBASE_STORAGE_BUCKETenvironment variable
Firebase Initialization Failed
If you see "Firebase is not initialized" error:
- Check that your service account key path is correct and absolute
- Ensure the service account has proper permissions for Firebase services
Composite Index Required
If you receive "This query requires a composite index" error:
- Look for the provided URL in the error message
- Follow the link to create the required index in Firebase Console
- Retry your query after the index is created (may take a few minutes)
Zod Validation Error with firestore_list_collections
If you see a Zod validation error with message "Expected object, received boolean" when using the firestore_list_collections tool:
⚠️ Known Issue: The
firestore_list_collectionstool may return a Zod validation error in the client logs. This is an erroneous validation error in the MCP SDK, as our investigation confirmed no boolean values are present in the response. Despite the error message, the query still works correctly and returns the proper collection data. This is a log-level error that doesn't affect functionality.
Debugging
Enable File Logging
To help diagnose issues, you can enable file logging:
# Log to default location (~/.firebase-mcp/debug.log)
DEBUG_LOG_FILE=true npx @gannonh/firebase-mcp
# Log to a custom location
DEBUG_LOG_FILE=/path/to/custom/debug.log npx @gannonh/firebase-mcp
You can also enable logging in your MCP client configuration:
{
"firebase-mcp": {
"command": "npx",
"args": ["-y", "@gannonh/firebase-mcp"],
"env": {
"SERVICE_ACCOUNT_KEY_PATH": "/path/to/serviceAccountKey.json",
"FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app",
"DEBUG_LOG_FILE": "true"
}
}
}
Real-time Log Viewing
To view logs in real-time:
# Using tail to follow the log file
tail -f ~/.firebase-mcp/debug.log
# Using a split terminal to capture stderr
npm start 2>&1 | tee logs.txt
Using MCP Inspector
The MCP Inspector provides interactive debugging:
# Install MCP Inspector
npm install -g @mcp/inspector
# Connect to your MCP server
mcp-inspector --connect stdio --command "node ./dist/index.js"
📋 Response Formatting
Storage Upload Response Example
{
"name": "reports/quarterly.pdf",
"size": "1024000",
"contentType": "application/pdf",
"updated": "2025-04-11T15:37:10.290Z",
"downloadUrl": "https://storage.googleapis.com/bucket/reports/quarterly.pdf?alt=media",
"bucket": "your-project.appspot.com"
}
Displayed to the user as:
## File Successfully Uploaded! 📁
Your file has been uploaded to Firebase Storage:
**File Details:**
- **Name:** reports/quarterly.pdf
- **Size:** 1024000 bytes
- **Type:** application/pdf
- **Last Updated:** April 11, 2025 at 15:37:10 UTC
**[Click here to download your file](https://storage.googleapis.com/bucket/reports/quarterly.pdf?alt=media)**
🤝 Contributing
- Fork the repository
- Create a feature branch
- Implement changes with tests (80%+ coverage required)
- Submit a pull request
📄 License
MIT License - see LICENSE file for details
🔗 Related Resources
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.