Firebase MCP

Firebase MCP

Connect AI assistants with Firebase services seamlessly using MCP.

229
Stars
42
Forks
229
Watchers
11
Issues
Firebase MCP enables AI assistants to interact directly with Firebase services such as Firestore, Storage, and Authentication. It provides a server that integrates with established MCP clients, allowing tools to perform database operations, manage files, and handle user authentication within Firebase environments. The solution offers flexible setup options, including npx-based and local installations, and supports both stdio and HTTP transports for integration. Environment variables configure specific Firebase credentials and server behavior to ensure secure and reliable connections.

Key Features

Direct interaction with Firebase Firestore database
Integration with Firebase Storage for file operations
User management and authentication functionalities
Compatible with AI assistant clients such as Claude Desktop, Augment, VS Code, and Cursor
Supports installation via npx or local setup
Configurable transport modes (stdio or HTTP)
Environment variable-based secure configuration
Automated test suite and CI integration
Detailed API toolset for database and storage operations
Robust logging options for debugging

Use Cases

AI-assisted Firebase database management
Automating Firebase Storage file uploads and retrievals through AI
Managing Firebase Authentication for user workflows
Enabling local or cloud-hosted AI agents to perform Firebase operations in real time
Integrating conversational or code assistants with Firebase backend
Testing and validating Firebase tools via NLP clients
Application development with automated backend management
Rapid prototyping of AI-integrated apps using Firebase
Collaborative workflows where assistants require direct Firebase access
Streamlining user verification and management tasks for applications

README

Firebase MCP

Project Logo

Firebase Tests CI

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_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.

⚡ 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)

json
{
  "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

json
{
  "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

  1. Go to Firebase Console → Project Settings → Service Accounts
  2. Click "Generate new private key"
  3. 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 (stdio or http) (defaults to stdio)
  • MCP_HTTP_PORT: Port for HTTP transport (defaults to 3000)
  • MCP_HTTP_HOST: Host for HTTP transport (defaults to localhost)
  • MCP_HTTP_PATH: Path for HTTP transport (defaults to /mcp)
  • DEBUG_LOG_FILE: Enable file logging:
    • Set to true to log to ~/.firebase-mcp/debug.log
    • Set to a file path to log to a custom location

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

bash
git clone https://github.com/gannonh/firebase-mcp
cd firebase-mcp
npm install
npm run build

Running Tests

First, install and start Firebase emulators:

bash
npm install -g firebase-tools
firebase init emulators
firebase emulators:start

Then run tests:

bash
# Run tests with emulator
npm run test:emulator

# Run tests with coverage
npm run test:coverage:emulator

Project Structure

bash
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:

bash
# 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:

json
{
  "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:

  1. Verify your bucket name in Firebase Console → Storage
  2. Set the correct bucket name in FIREBASE_STORAGE_BUCKET environment variable

Firebase Initialization Failed

If you see "Firebase is not initialized" error:

  1. Check that your service account key path is correct and absolute
  2. Ensure the service account has proper permissions for Firebase services

Composite Index Required

If you receive "This query requires a composite index" error:

  1. Look for the provided URL in the error message
  2. Follow the link to create the required index in Firebase Console
  3. 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_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.

Debugging

Enable File Logging

To help diagnose issues, you can enable file logging:

bash
# 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:

json
{
  "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:

bash
# 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:

bash
# 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

json
{
  "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:

markdown
## 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

  1. Fork the repository
  2. Create a feature branch
  3. Implement changes with tests (80%+ coverage required)
  4. Submit a pull request

📄 License

MIT License - see LICENSE file for details

🔗 Related Resources

Star History

Star History Chart

Repository Owner

gannonh
gannonh

User

Repository Details

Language TypeScript
Default Branch main
Size 930 KB
Contributors 4
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

TypeScript
86.29%
JavaScript
13.54%
Dockerfile
0.17%

Tags

Topics

firebase modelcontextprotocol

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • Firefly MCP Server

    Firefly MCP Server

    Seamless resource discovery and codification for Cloud and SaaS with Model Context Protocol integration.

    Firefly MCP Server is a TypeScript-based server implementing the Model Context Protocol to enable integration with the Firefly platform for discovering and managing resources across Cloud and SaaS accounts. It supports secure authentication, resource codification into infrastructure as code, and easy integration with tools such as Claude and Cursor. The server can be configured via environment variables or command line and communicates using standardized MCP interfaces. Its features facilitate automation and codification workflows for cloud resource management.

    • 15
    • MCP
    • gofireflyio/firefly-mcp
  • Supabase MCP Server

    Supabase MCP Server

    Connect Supabase projects to AI assistants using the Model Context Protocol.

    Supabase MCP Server enables direct, secure integration between Supabase projects and AI assistants such as Cursor, Claude, and Windsurf. Leveraging the Model Context Protocol, it provides standardized endpoints for external LLMs to perform tasks like managing tables, fetching configurations, and querying data on Supabase. The server supports OAuth 2.1 Dynamic Client Registration and offers easy setup with feature groups and popular client installers for local, cloud, and self-hosted environments.

    • 2,263
    • MCP
    • supabase-community/supabase-mcp
  • InfluxDB MCP Server

    InfluxDB MCP Server

    Expose InfluxDB data and tools to AI models via the Model Context Protocol.

    InfluxDB MCP Server is a Model Context Protocol (MCP) server that enables AI models to access, write, and manage time-series data stored in InfluxDB instances through a standardized API. It provides resources for organizations, buckets, and measurements, as well as tools for running Flux queries, writing data, and managing InfluxDB objects. The server includes prompt templates for common query operations and supports seamless integration with AI platforms like Claude Desktop. Easy installation options are offered via Smithery, npx, npm, or from source.

    • 27
    • MCP
    • idoru/influxdb-mcp-server
  • box-mcp-server

    box-mcp-server

    Expose your Box files to AI with a Model Context Protocol server.

    box-mcp-server lets users connect their Box accounts to AI applications via the Model Context Protocol (MCP). It securely authenticates to Box with enterprise credentials or developer tokens and serves file search and reading capabilities to downstream clients. Designed for use with Claude Desktop and the MCP Inspector, it provides seamless integration of Box documents into AI workflows.

    • 10
    • MCP
    • hmk/box-mcp-server
  • Flowcore Platform MCP Server

    Flowcore Platform MCP Server

    A standardized MCP server for managing and interacting with Flowcore Platform resources.

    Flowcore Platform MCP Server provides an implementation of the Model Context Protocol (MCP) for seamless interaction and management of Flowcore resources. It enables AI assistants to query and control the Flowcore Platform using a structured API, allowing for enhanced context handling and data access. The server supports easy deployment with npx, npm, or Bun and requires user authentication using Flowcore credentials.

    • 9
    • MCP
    • flowcore-io/mcp-flowcore-platform
  • mcp-server-atlassian-confluence

    mcp-server-atlassian-confluence

    Seamlessly connect AI assistants to your Atlassian Confluence knowledge base.

    Enables integration of AI assistants like Claude and Cursor AI directly with Atlassian Confluence, allowing users to interact with their documentation and knowledge base using natural language queries. Supports instant answers, search across all spaces, and access to specific Confluence content and discussions. Follows the Model Context Protocol (MCP) for standardized model context management and easy configuration with various AI assistants via STDIO transport or config files.

    • 39
    • MCP
    • aashari/mcp-server-atlassian-confluence
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results