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.
This Firebase MCP (Model Context Protocol) server enables LLM clients to interact with Firebase services, including Authentication, Firestore, and Storage. It supports LLM clients like Claude Desktop, Cursor, Roo Code, and Cline. The server exposes Firebase services through MCP tools, handling authentication and connection management.
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)[projectId].appspot.com
Add the server configuration to your MCP settings file:
~/Library/Application Support/Claude/claude_desktop_config.json
[project root]/.cursor/mcp.json
~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
)~/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:
{
"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"
}
}
}
{
"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"
}
}
}
git clone https://github.com/gannonh/firebase-mcp
cd firebase-mcp
npm install
npm run build
To make sure everything is working, simply prompt your client: Please run through and test all of your Firebase MCP tools.
auth_get_user
: Get user details by ID or email{
identifier: string // User ID or email address
}
firestore_add_document
: Add a document to a collection{
collection: string,
data: object
}
firestore_list_collections
: List available collections{
documentPath?: string, // Optional parent document path
limit?: number, // Default: 20
pageToken?: string // For pagination
}
firestore_list_documents
: List documents with optional filtering{
collection: string,
filters?: Array<{
field: string,
operator: string,
value: any
}>,
limit?: number,
pageToken?: string
}
firestore_get_document
: Get a specific document{
collection: string,
id: string
}
firestore_update_document
: Update an existing document{
collection: string,
id: string,
data: object
}
firestore_delete_document
: Delete a document{
collection: string,
id: string
}
storage_list_files
: List files in a directory{
directoryPath?: string, // Optional path, defaults to root
pageSize?: number, // Number of items per page, defaults to 10
pageToken?: string // Token for pagination
}
storage_get_file_info
: Get file metadata and download URL{
filePath: string // Path to the file in storage
}
npm run build
The project uses Jest for testing. Tests can be run against Firebase emulators to avoid affecting production data.
npm install -g firebase-tools
firebase init emulators
firebase emulators:start
npm run test:emulator
The server is structured into three main components:
src/
⌘⌘⌘ index.ts # Server entry point
⌘⌘⌘ lib/
⌘⌘⌘ firebase/
⌘⌘⌘ authClient.ts # Authentication operations
⌘⌘⌘ firebaseConfig.ts # Firebase configuration
⌘⌘⌘ firestoreClient.ts # Firestore operations
⌘⌘⌘ storageClient.ts # Storage operations
Each client module implements specific Firebase service operations and exposes them as MCP tools.
MIT License - see LICENSE file for details
If you encounter this error when trying to access Firebase Storage:
[projectId].appspot.com
[projectId].firebasestorage.app
insteadFIREBASE_STORAGE_BUCKET
environment variable"FIREBASE_STORAGE_BUCKET": "your-project-id.firebasestorage.app"
If you see this error:
SERVICE_ACCOUNT_KEY_PATH
is correct and absoluteIf you see errors about invalid JSON:
console.log
statements in the codeconsole.error
to avoid interfering with the JSON communicationThe Firebase MCP Server bridges LLM clients with Firebase services via the Model Context Protocol. It enables LLMs like Claude and Cursor to interact with Firebase Authentication, Firestore, and Storage. Key features include user management, document database operations, and file storage/retrieval, all accessible through MCP tools.
Setup involves configuring Firebase, setting environment variables for the service account key path and storage bucket, and installing the server using either npx
or a local installation. The server provides tools for authentication (e.g., auth_get_user
), Firestore (e.g., firestore_add_document
, firestore_get_document
), and Storage (e.g., storage_list_files
, storage_get_file_info
).
The architecture is structured into modules for authentication, Firestore, and storage operations. Development includes building, testing with Jest and Firebase emulators, and contributing through forking, creating feature branches, and submitting pull requests.
gannonh/firebase-mcp
March 8, 2025
March 28, 2025
TypeScript