MCP Firebase Server
About
Connects Large Language Models to Firebase Firestore and Storage via the Model Context Protocol.
Details
- Author
- davo20019
- Categories
- Cloud Service, Database, File Management, Infrastructure
Jump to
Setup
Install MCP Firebase Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/davo20019/mcp-firebase-server
Follow the installation instructions in the repository README, then restart your MCP client.
MCP Firebase Server (Model Context Protocol)
This server implements the Model Context Protocol (MCP) to act as a bridge between a Large Language Model (LLM) like Claude and Firebase (Firestore). It allows the LLM to read from and write to Firestore collections by exposing these operations as MCP "tools."
This server is built using the officialmcpPython SDK.
- Python 3.7+ (preferably 3.8+ forasynccontextmanagerand full type hinting features used by MCP)
- Pip (Python package installer) oruv(recommended by MCP docs for project management)
- A Firebase project with Firestore enabled.
- A Firebase service account key JSON file.
-
Clone/Download:Ensure you have the server file (mcp_firebase_server.py),requirements.txt, etc., in a local directory.
- The server needs a Firebase service account key to authenticate.
- Option 1 (Recommended for MCP Client Configuration):Set theSERVICE_ACCOUNT_KEY_PATHenvironment variable to the absolute path of your service account JSON file. This is the most flexible method when the server is launched by an MCP client.
- Option 2 (Fallback):If theSERVICE_ACCOUNT_KEY_PATHenvironment variable is not set, the server will look for a file namedserviceAccountKey.jsonin its own directory (the same directory asmcp_firebase_server.py). If using this method, rename your key file accordingly.
- Important:Ensure your service account key file (however it's named or accessed) is kept secure and ideally listed in your.gitignoreif a local copy exists in the project.
- If you intend to use Firebase Storage functionalities with this server (currently no tools use it, but it can be added), set theFIREBASE_STORAGE_BUCKETenvironment variable to your Firebase project's storage bucket name (e.g.,your-project-id.appspot.com). The server will read and print this value if set.
Create a Virtual Environment (Recommended):Usingvenv:
python3 -m venv venv source venv/bin/activate # On macOS/Linux # venv\\Scripts\\activate # On Windows
Or, if usinguv(as suggested by MCP docs for new projects):
uv venv source .venv/bin/activate # Or similar, depending on your uv setup
This will installmcp[cli]andfirebase-admin.
There are a couple of ways to run this MCP server:
-
Direct Execution (for stdio transport viarun_server.sh):Arun_server.shscript is provided to simplify launching the server. This script handles activating the virtual environment (if namedvenvand present in the project root) before running the Python script.
This is how an MCP client would typically be configured to launch the server (see "Using with Claude" section below).
Using MCP CLI for Development and Inspection (mcp dev): ThemcpCLI (installed as part ofmcp[cli]) provides a development server and inspector tool. This is highly recommended during development.
This will start the server and often provide a web interface for inspecting its capabilities (tools, resources) and making test calls.
This server, namedMCPFirebaseServer, exposes the following tools:
1.mcp_firebase_query_firestore_collection
- Description (from docstring):Retrieves documents from a specified Firestore collection.
- Arguments:
- collection_name(string, required): The name of the Firestore collection to query.
- limit(integer, optional, default: 50): The maximum number of documents to return.
2.mcp_firebase_add_document_to_firestore
- Description (from docstring):Adds a new document with an auto-generated ID to the specified Firestore collection.
- Arguments:
- collection_name(string, required): The name of the Firestore collection where the document will be added.
- document_data(object/dictionary, required): A dictionary representing the document to add.
3.mcp_firebase_list_firestore_collections
- Description (from docstring):Lists all top-level collections in the Firestore database.
- Arguments:
- random_string(string, required): A dummy parameter (can be any string) as this tool takes no meaningful input.
- Description (from docstring):Retrieves a specific document from a Firestore collection by its ID.
- Arguments:
- collection_name(string, required): The name of the Firestore collection.
- document_id(string, required): The ID of the document to retrieve.
5.mcp_firebase_list_document_subcollections
- Description (from docstring):Lists all subcollections of a specified document in Firestore.
- Arguments:
- collection_name(string, required): The name of the parent collection.
- document_id(string, required): The ID of the document whose subcollections are to be listed.
6.mcp_firebase_update_firestore_document
- Description (from docstring):Updates an existing document in a specified Firestore collection.
- Arguments:
- collection_name(string, required): The name of the Firestore collection.
- document_id(string, required): The ID of the document to update.
- update_data(object/dictionary, required): A dictionary containing the fields to update.
7.mcp_firebase_query_firestore_collection_with_filter
- Description (from docstring):Retrieves documents from a specified Firestore collection, filtering by field values (equality==only).
- Arguments:**
- collection_name(string, required): The name of the Firestore collection to query.
- filters(object/dictionary, required): A dictionary where keys are field names and values are the values to filter by (e.g.,{"category": "electronics", "available": True}).
- limit(integer, optional, default: 50): The maximum number of documents to return.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



