F
Firebase
community
other
Server to interact with Firebase services including Firebase Authentication, Firestore, and Firebase Storage.
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.
ā” 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."
š„ Latest Features: Storage Upload (v1.3.3)
Firebase MCP now offers powerful file upload capabilities with two specialized tools:
: Upload files from text, base64 content, or local file pathsstorage_upload
: Import files directly from external URLsstorage_upload_from_url
Key Benefits
- Permanent Public URLs: All uploads generate non-expiring public URLs
- Content Type Detection: Automatic detection from file extensions and data
- Multiple Upload Methods: Flexible options for different use cases
- Rich Response Formatting: Clear, well-structured upload confirmations
Upload Methods
-
Local File Path (Recommended for all file types)
{ filePath: "my-report.pdf", content: "/path/to/local/file.pdf" }
-
Base64 Data URL (For smaller files)
{ filePath: "my-image.png", content: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." }
-
Plain Text (For text files)
{ filePath: "readme.md", content: "# My README\n\nThis is a markdown file." }
-
External URL (Using storage_upload_from_url)
{ filePath: "document.pdf", url: "https://example.com/document.pdf" }
ā ļø Important: For binary files like images and PDFs, always use the direct file path method for best reliability.
š ļø 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
: Path to your Firebase service account key JSON (required)SERVICE_ACCOUNT_KEY_PATH
: Bucket name for Firebase Storage (optional, defaults toFIREBASE_STORAGE_BUCKET
)[projectId].appspot.com
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 |
---|---|---|
| Add a document to a collection | ,
|
| List documents with filtering |
|
| Get a specific document | ,
|
| Update an existing document | , ,
|
| Delete a document | ,
|
| List root collections | None |
| Query across subcollections |
|
Storage Tools
Tool | Description | Required Parameters |
---|---|---|
| List files in a directory | None (optional: ) |
| Get file metadata and URL |
|
| Upload file from content | ,
|
| Upload file from URL | ,
|
Authentication Tools
Tool | Description | Required Parameters |
---|---|---|
| Get user by ID or email |
|
š» 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
š 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
environment variableFIREBASE_STORAGE_BUCKET
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)
š 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
Related Servers
S
Sequential Thinking
reference
Dynamic and reflective problem-solving through thought sequences
View Details