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. - Firebase project with service account credentials - Nod
Add this skill
npx mdskills install gannonh/firebase-mcpComprehensive Firebase MCP server with Firestore, Storage, and Auth tools, excellent docs and setup guidance
1# Firebase MCP23456<a href="https://glama.ai/mcp/servers/x4i8z2xmrq">7 <img width="380" height="200" src="https://glama.ai/mcp/servers/x4i8z2xmrq/badge" alt="Firebase MCP server" />8</a>910[](https://github.com/gannonh/firebase-mcp/actions/workflows/tests.yml)1112## Overview1314**Firebase MCP** enables AI assistants to work directly with Firebase services, including:1516- **Firestore**: Document database operations17- **Storage**: File management with robust upload capabilities18- **Authentication**: User management and verification1920The server works with MCP client applicatios such as [Claude Desktop](https://claude.ai/download), [Augment Code](https://docs.augmentcode.com/setup-augment/mcp), [VS Code](https://code.visualstudio.com/docs/copilot/chat/mcp-servers), and [Cursor](https://www.cursor.com/).2122> ⚠️ **Known Issue**: The `firestore_list_collections` tool 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.2324## ⚡ Quick Start2526### Prerequisites27- Firebase project with service account credentials28- Node.js environment2930### 1. Install MCP Server3132Add the server configuration to your MCP settings file:3334- Claude Desktop: `~/Library/Application Support/Claude/claude_desktop_config.json`35- Augment: `~/Library/Application Support/Code/User/settings.json`36- Cursor: `[project root]/.cursor/mcp.json`3738MCP Servers can be installed manually or at runtime via npx (recommended). How you install determines your configuration:3940#### Configure for npx (recommended)4142 ```json43 {44 "firebase-mcp": {45 "command": "npx",46 "args": [47 "-y",48 "@gannonh/firebase-mcp"49 ],50 "env": {51 "SERVICE_ACCOUNT_KEY_PATH": "/absolute/path/to/serviceAccountKey.json",52 "FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app"53 }54 }55 }56 ```5758#### Configure for local installation5960 ```json61 {62 "firebase-mcp": {63 "command": "node",64 "args": [65 "/absolute/path/to/firebase-mcp/dist/index.js"66 ],67 "env": {68 "SERVICE_ACCOUNT_KEY_PATH": "/absolute/path/to/serviceAccountKey.json",69 "FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app"70 }71 }72 }73```747576### 2. Test the Installation7778Ask your AI client: "Please test all Firebase MCP tools."7980## 🛠️ Setup & Configuration8182### 1. Firebase Configuration83841. Go to [Firebase Console](https://console.firebase.google.com) → Project Settings → Service Accounts852. Click "Generate new private key"863. Save the JSON file securely8788### 2. Environment Variables8990#### Required91- `SERVICE_ACCOUNT_KEY_PATH`: Path to your Firebase service account key JSON (required)9293#### Optional94- `FIREBASE_STORAGE_BUCKET`: Bucket name for Firebase Storage (defaults to `[projectId].appspot.com`)95- `MCP_TRANSPORT`: Transport type to use (`stdio` or `http`) (defaults to `stdio`)96- `MCP_HTTP_PORT`: Port for HTTP transport (defaults to `3000`)97- `MCP_HTTP_HOST`: Host for HTTP transport (defaults to `localhost`)98- `MCP_HTTP_PATH`: Path for HTTP transport (defaults to `/mcp`)99- `DEBUG_LOG_FILE`: Enable file logging:100 - Set to `true` to log to `~/.firebase-mcp/debug.log`101 - Set to a file path to log to a custom location102103### 3. Client Integration104105#### Claude Desktop106Edit: `~/Library/Application Support/Claude/claude_desktop_config.json`107108#### VS Code / Augment109Edit: `~/Library/Application Support/Code/User/settings.json`110111#### Cursor112Edit: `[project root]/.cursor/mcp.json`113114## 📚 API Reference115116### Firestore Tools117118| Tool | Description | Required Parameters |119| ---------------------------------- | ------------------------------ | -------------------------- |120| `firestore_add_document` | Add a document to a collection | `collection`, `data` |121| `firestore_list_documents` | List documents with filtering | `collection` |122| `firestore_get_document` | Get a specific document | `collection`, `id` |123| `firestore_update_document` | Update an existing document | `collection`, `id`, `data` |124| `firestore_delete_document` | Delete a document | `collection`, `id` |125| `firestore_list_collections` | List root collections | None |126| `firestore_query_collection_group` | Query across subcollections | `collectionId` |127128### Storage Tools129130| Tool | Description | Required Parameters |131| ------------------------- | ------------------------- | -------------------------------- |132| `storage_list_files` | List files in a directory | None (optional: `directoryPath`) |133| `storage_get_file_info` | Get file metadata and URL | `filePath` |134| `storage_upload` | Upload file from content | `filePath`, `content` |135| `storage_upload_from_url` | Upload file from URL | `filePath`, `url` |136137### Authentication Tools138139| Tool | Description | Required Parameters |140| --------------- | ----------------------- | ------------------- |141| `auth_get_user` | Get user by ID or email | `identifier` |142143## 💻 Developer Guide144145### Installation & Building146147```bash148git clone https://github.com/gannonh/firebase-mcp149cd firebase-mcp150npm install151npm run build152```153154### Running Tests155156First, install and start Firebase emulators:157```bash158npm install -g firebase-tools159firebase init emulators160firebase emulators:start161```162163Then run tests:164```bash165# Run tests with emulator166npm run test:emulator167168# Run tests with coverage169npm run test:coverage:emulator170```171172### Project Structure173174```bash175src/176├── index.ts # Server entry point177├── utils/ # Utility functions178└── lib/179 └── firebase/ # Firebase service clients180 ├── authClient.ts # Authentication operations181 ├── firebaseConfig.ts # Firebase configuration182 ├── firestoreClient.ts # Firestore operations183 └── storageClient.ts # Storage operations184```185186## 🌐 HTTP Transport187188Firebase 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.189190### Running with HTTP Transport191192To run the server with HTTP transport:193194```bash195# Using environment variables196MCP_TRANSPORT=http MCP_HTTP_PORT=3000 node dist/index.js197198# Or with npx199MCP_TRANSPORT=http MCP_HTTP_PORT=3000 npx @gannonh/firebase-mcp200```201202### Client Configuration for HTTP203204When using HTTP transport, configure your MCP client to connect to the HTTP endpoint:205206```json207{208 "firebase-mcp": {209 "url": "http://localhost:3000/mcp"210 }211}212```213214### Session Management215216The 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.217218## 🔍 Troubleshooting219220### Common Issues221222#### Storage Bucket Not Found223If you see "The specified bucket does not exist" error:2241. Verify your bucket name in Firebase Console → Storage2252. Set the correct bucket name in `FIREBASE_STORAGE_BUCKET` environment variable226227#### Firebase Initialization Failed228If you see "Firebase is not initialized" error:2291. Check that your service account key path is correct and absolute2302. Ensure the service account has proper permissions for Firebase services231232#### Composite Index Required233If you receive "This query requires a composite index" error:2341. Look for the provided URL in the error message2352. Follow the link to create the required index in Firebase Console2363. Retry your query after the index is created (may take a few minutes)237238#### Zod Validation Error with `firestore_list_collections`239If you see a Zod validation error with message "Expected object, received boolean" when using the `firestore_list_collections` tool:240241> ⚠️ **Known Issue**: The `firestore_list_collections` tool 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.242243### Debugging244245#### Enable File Logging246To help diagnose issues, you can enable file logging:247248```bash249# Log to default location (~/.firebase-mcp/debug.log)250DEBUG_LOG_FILE=true npx @gannonh/firebase-mcp251252# Log to a custom location253DEBUG_LOG_FILE=/path/to/custom/debug.log npx @gannonh/firebase-mcp254```255256You can also enable logging in your MCP client configuration:257258```json259{260 "firebase-mcp": {261 "command": "npx",262 "args": ["-y", "@gannonh/firebase-mcp"],263 "env": {264 "SERVICE_ACCOUNT_KEY_PATH": "/path/to/serviceAccountKey.json",265 "FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app",266 "DEBUG_LOG_FILE": "true"267 }268 }269}270```271272#### Real-time Log Viewing273To view logs in real-time:274275```bash276# Using tail to follow the log file277tail -f ~/.firebase-mcp/debug.log278279# Using a split terminal to capture stderr280npm start 2>&1 | tee logs.txt281```282283#### Using MCP Inspector284The MCP Inspector provides interactive debugging:285286```bash287# Install MCP Inspector288npm install -g @mcp/inspector289290# Connect to your MCP server291mcp-inspector --connect stdio --command "node ./dist/index.js"292```293294## 📋 Response Formatting295296### Storage Upload Response Example297298```json299{300 "name": "reports/quarterly.pdf",301 "size": "1024000",302 "contentType": "application/pdf",303 "updated": "2025-04-11T15:37:10.290Z",304 "downloadUrl": "https://storage.googleapis.com/bucket/reports/quarterly.pdf?alt=media",305 "bucket": "your-project.appspot.com"306}307```308309Displayed to the user as:310311```markdown312## File Successfully Uploaded! 📁313314Your file has been uploaded to Firebase Storage:315316**File Details:**317- **Name:** reports/quarterly.pdf318- **Size:** 1024000 bytes319- **Type:** application/pdf320- **Last Updated:** April 11, 2025 at 15:37:10 UTC321322**[Click here to download your file](https://storage.googleapis.com/bucket/reports/quarterly.pdf?alt=media)**323```324325## 🤝 Contributing3263271. Fork the repository3282. Create a feature branch3293. Implement changes with tests (80%+ coverage required)3304. Submit a pull request331332## 📄 License333334MIT License - see [LICENSE](LICENSE) file for details335336## 🔗 Related Resources337338- [Model Context Protocol Documentation](https://github.com/modelcontextprotocol)339- [Firebase Documentation](https://firebase.google.com/docs)340- [Firebase Admin SDK](https://firebase.google.com/docs/admin/setup)341
Full transparency — inspect the skill content before installing.