Back to MCP Catalog

Firebase MCP Server

Cloud PlatformsTypeScript
Enables AI assistants to interact with Firebase services
Available Tools

firestore_get_document

Retrieves a document from Firestore by its path

path

firestore_set_document

Creates or updates a document in Firestore

pathdatamerge

firestore_update_document

Updates fields in an existing Firestore document

pathdata

firestore_delete_document

Deletes a document from Firestore

path

firestore_query_collection

Queries documents in a Firestore collection

pathquery

firestore_list_collections

Lists all collections in Firestore or subcollections of a document

path

storage_upload_file

Uploads a file to Firebase Storage

pathdatametadata

storage_download_file

Downloads a file from Firebase Storage

path

storage_list_files

Lists files in a Firebase Storage directory

pathoptions

storage_delete_file

Deletes a file from Firebase Storage

path

auth_sign_in

Signs in a user with email and password

emailpassword

auth_sign_up

Creates a new user account

emailpassword

auth_sign_out

Signs out the current user

auth_get_current_user

Gets the currently authenticated user

Firebase MCP provides AI assistants with direct access to Firebase's powerful suite of cloud services. It enables seamless interaction with Firestore for document database operations, Storage for file management, and Authentication for user management, all through a standardized protocol. This integration allows AI systems to leverage Firebase's scalable infrastructure while maintaining security and proper access controls.

Introduction

Firebase MCP is a Model Context Protocol server that enables AI assistants to interact directly with Firebase services. This integration allows AI systems to perform operations on Firestore databases, manage files in Firebase Storage, and handle user authentication, all while maintaining proper security controls.

Installation

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • A Firebase project with appropriate services enabled
  • Firebase configuration details (API keys, project IDs, etc.)

Installation Steps

  1. Install the Firebase MCP package:
npm install @gannonh/firebase-mcp
  1. Create a configuration file for your Firebase project. You'll need to include your Firebase credentials:
// firebase-config.js
export const firebaseConfig = {
  apiKey: "your-api-key",
  authDomain: "your-project-id.firebaseapp.com",
  projectId: "your-project-id",
  storageBucket: "your-project-id.appspot.com",
  messagingSenderId: "your-messaging-sender-id",
  appId: "your-app-id"
};
  1. Create a server file to initialize and run the Firebase MCP server:
// server.js
import { startServer } from '@gannonh/firebase-mcp';
import { firebaseConfig } from './firebase-config.js';

startServer({
  port: 3000,
  firebaseConfig
});
  1. Run your server:
node server.js

Docker Installation

Alternatively, you can use Docker:

  1. Create a Dockerfile:
FROM node:16
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]
  1. Build and run the Docker container:
docker build -t firebase-mcp .
docker run -p 3000:3000 firebase-mcp

Configuration

Security Rules

Ensure your Firebase security rules are properly configured to control access to your data. The MCP server will respect these rules when performing operations.

For Firestore:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

For Storage:

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth != null;
    }
  }
}

Environment Variables

You can also use environment variables for configuration:

FIREBASE_API_KEY=your-api-key
FIREBASE_AUTH_DOMAIN=your-project-id.firebaseapp.com
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_STORAGE_BUCKET=your-project-id.appspot.com
FIREBASE_MESSAGING_SENDER_ID=your-messaging-sender-id
FIREBASE_APP_ID=your-app-id
MCP_SERVER_PORT=3000

Usage

Once your server is running, AI assistants can interact with your Firebase services through the MCP protocol. The server provides tools for:

  1. Firestore Operations: Create, read, update, and delete documents, query collections, and manage subcollections.

  2. Storage Operations: Upload, download, list, and delete files in Firebase Storage.

  3. Authentication: Manage user authentication, including sign-in, sign-up, and user profile management.

Known Issues

  • When using the firestore_list_collections tool, Firebase SDK may output console logs to stdio during the operation. This is a known behavior of the Firebase SDK.

Troubleshooting

  • Connection Issues: Ensure your server is running and accessible at the specified port.
  • Authentication Errors: Verify your Firebase configuration details are correct.
  • Permission Denied: Check your Firebase security rules to ensure they allow the operations you're attempting.
  • Rate Limiting: Be aware of Firebase's rate limits for various operations.

Updating

To update to the latest version:

npm update @gannonh/firebase-mcp

Check the CHANGELOG.md file for details on new features, bug fixes, and breaking changes in each release.

Related MCPs

AWS CLI
Cloud PlatformsPython

Execute AWS CLI commands securely through AI assistants

Kubernetes
Cloud PlatformsGo

Connect to and manage Kubernetes clusters through natural language

Cloudflare
Cloud PlatformsTypeScript

A Model Context Protocol server for Cloudflare services

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.