Firebase MCP
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Firebase MCP Server
Overview
The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. This MCP server provides a standardized interface to interact with Firebase services including:
- Authentication: User management and verification
- Firestore: Document database operations
- Storage: File storage and retrieval
The server exposes Firebase services through MCP tools, making them accessible to LLM clients including Claude Desktop, Cursor, Roo Code, and Cline, while handling authentication and connection management.
Setup
The easiest way to install the Firebase MCP server is to simply feed your LLM client (like Cline) the llms-install.md file.
1. Firebase Configuration
- Go to Firebase Console
- Navigate to Project Settings > Service Accounts
- Click "Generate new private key"
- Save the JSON file securely
2. Environment Variables
The server requires the following environment variables:
SERVICE_ACCOUNT_KEY_PATH
: Path to your Firebase service account key JSON file (required)FIREBASE_STORAGE_BUCKET
: Bucket name for Firebase Storage (optional)- If not provided, defaults to
[projectId].appspot.com
- If not provided, defaults to
3. Install MCP Server
Add the server configuration to your MCP settings file:
- Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json
- Cursor:
[project root]/.cursor/mcp.json
- Roo Code (VS Code Extension): (
~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
) - Cline (VS Code Extension):
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
MCP Servers can be installed manually or at runtime via npx (recommended). How you install determines your configuration:
Configure for npx
Configure for local installation
Manual Installation
Install Dependencies
Build the Project
Test your Installation
To make sure everything is working, simply prompt your client: Please run through and test all of your Firebase MCP tools.
Features
Authentication Tools
auth_get_user
: Get user details by ID or emailCopy
Firestore Tools
firestore_add_document
: Add a document to a collectionCopyfirestore_list_collections
: List available collectionsCopyfirestore_list_documents
: List documents with optional filteringCopyfirestore_get_document
: Get a specific documentCopyfirestore_update_document
: Update an existing documentCopyfirestore_delete_document
: Delete a documentCopy
Storage Tools
storage_list_files
: List files in a directoryCopystorage_get_file_info
: Get file metadata and download URLCopy
Development
Building
Testing
The project uses Jest for testing. Tests can be run against Firebase emulators to avoid affecting production data.
- Install Firebase EmulatorsCopy
- Start EmulatorsCopy
- Run TestsCopy
Architecture
The server is structured into three main components:
Each client module implements specific Firebase service operations and exposes them as MCP tools.
Contributing
- Fork the repository
- Create a feature branch
- Implement changes with tests
- Submit a pull request
License
MIT License - see LICENSE file for details
Related Resources
Troubleshooting
Common Issues
"The specified bucket does not exist" Error
If you encounter this error when trying to access Firebase Storage:
- Check that your Firebase project has Storage enabled
- Go to the Firebase Console
- Navigate to Storage
- Complete the initial setup if you haven't already
- Verify the correct bucket name
- The default bucket name is usually
[projectId].appspot.com
- Some projects use
[projectId].firebasestorage.app
instead - You can find your bucket name in the Firebase Console under Storage
- The default bucket name is usually
- Set the
FIREBASE_STORAGE_BUCKET
environment variable- Add the correct bucket name to your MCP configuration
- Example:
"FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app"
"Firebase is not initialized" Error
If you see this error:
- Verify your service account key path
- Make sure the path in
SERVICE_ACCOUNT_KEY_PATH
is correct and absolute - Check that the file exists and is readable
- Make sure the path in
- Check service account permissions
- Ensure the service account has the necessary permissions for the Firebase services you're using
- For Storage, the service account needs the Storage Admin role
JSON Parsing Errors
If you see errors about invalid JSON:
- Make sure there are no
console.log
statements in the code- All logging should use
console.error
to avoid interfering with the JSON communication - The MCP protocol uses stdout for JSON communication
- All logging should use
- Check for syntax errors in your requests
- Verify that all parameters are correctly formatted
- Check for typos in field names
You must be authenticated.
The Firebase MCP server provides a standardized interface to interact with Firebase services, including Firebase Authentication, Firestore, and Firebase Storage.