Firebase MCP server

Enables Firebase Authentication, Firestore, and Storage operations for developers building applications that require seamless backend service integration.
Back to servers
Provider
Gannon Hall
Release date
Mar 09, 2025
Language
TypeScript
Package
Stats
3.4K downloads
124 stars

Firebase MCP enables AI assistants to interact with Firebase services, including Firestore for document database operations, Storage for file management, and Authentication for user management. It works with various MCP client applications like Claude Desktop, Augment Code, VS Code, and Cursor.

Installation

Prerequisites

  • Firebase project with service account credentials
  • Node.js environment

Setting Up MCP Server

Add the server configuration to your MCP settings file, which varies by client:

  • Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Augment: ~/Library/Application Support/Code/User/settings.json
  • Cursor: [project root]/.cursor/mcp.json

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"
    }
  }
}

Testing the Installation

Ask your AI client: "Please test all Firebase MCP tools."

Firebase Configuration

Setting Up Firebase

  1. Go to Firebase Console → Project Settings → Service Accounts
  2. Click "Generate new private key"
  3. Save the JSON file securely

Environment Variables

Required

  • SERVICE_ACCOUNT_KEY_PATH: Path to your Firebase service account key JSON file

Optional

  • FIREBASE_STORAGE_BUCKET: Bucket name for Firebase Storage (defaults to [projectId].appspot.com)
  • MCP_TRANSPORT: Transport type (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 or a file path)

Storage Upload Features

Firebase MCP supports powerful file upload capabilities with two specialized tools:

  • storage_upload: Upload files from text, base64 content, or local file paths
  • storage_upload_from_url: Import files directly from external URLs

Upload Methods

  1. Local File Path (Recommended for all file types)

    {
      filePath: "my-report.pdf",
      content: "/path/to/local/file.pdf"
    }
    
  2. Base64 Data URL (For smaller files)

    {
      filePath: "my-image.png",
      content: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
    }
    
  3. Plain Text (For text files)

    {
      filePath: "readme.md",
      content: "# My README\n\nThis is a markdown file."
    }
    
  4. External URL (Using storage_upload_from_url)

    {
      filePath: "document.pdf",
      url: "https://example.com/document.pdf"
    }
    

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

HTTP Transport

Firebase MCP supports HTTP transport in addition to the default stdio transport:

Running with HTTP Transport

# 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

{
  "firebase-mcp": {
    "url": "http://localhost:3000/mcp"
  }
}

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)

Enabling Debug Logs

To enable file logging:

# 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

Or in your configuration:

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

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later