# firebase-mcp

> MCP Server

This repository provides a Model Context Protocol (MCP) server that enables LLM clients to interact with Firebase services like Authentication, Firestore, and Storage. It allows LLMs to access Firebase data and tools.

## Overview

- **Category:** Developer Tools
- **Language:** TypeScript
- **Stars:** 248
- **Forks:** 9
- **Owner:** gannonh
- **GitHub:** https://github.com/gannonh/firebase-mcp
- **Created:** 2025-03-08T21:00:09+00:00
- **Updated:** 2025-03-28T20:54:29+00:00
- **Source:** https://model-context-protocol.com/servers/firebase-llm-model-context-protocol

## Setup

## Setup

> The easiest way to install the Firebase MCP server is to simply feed your LLM client (like Cline) the [llms-install.md](./llms-install.md) file.

### 1. Firebase Configuration

- Go to [Firebase Console](https://console.firebase.google.com)
- 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`

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

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

#### Manual Installation

##### Install Dependencies

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

##### Build the Project

   ```bash
   npm run build
   ```

### Test your Installation

To make sure everything is working, simply prompt your client: `Please run through and test all of your Firebase MCP tools.`

## Tools

## Available Tools

1.  `auth_get_user` (Get user details by ID or email)
2.  `firestore_add_document` (Add a document to a collection)
3.  `firestore_list_collections` (List available collections)
4.  `firestore_list_documents` (List documents with optional filtering)
5.  `firestore_get_document` (Get a specific document)
6.  `firestore_update_document` (Update an existing document)
7.  `firestore_delete_document` (Delete a document)
8.  `storage_list_files` (List files in a directory)
9.  `storage_get_file_info` (Get file metadata and download URL)
