Provides comprehensive tools for interacting with Firebase Firestore, enabling CRUD operations, collection and subcollection management, document counting, and complex querying with automatic support for Firestore-specific data types.
Enables secure access and management of Firestore databases within the Google Cloud Platform, supporting document manipulation and collection navigation through service account authentication and IAM role management.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Firestore MCP ServerFind all documents in the 'users' collection where 'status' equals 'active'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Firestore MCP Server
Model Context Protocol (MCP) server for Firebase Firestore. This server enables AI assistants like Claude to directly interact with your Firestore database.
Features
Full CRUD Operations: Create, read, update, and delete documents
Collection Management: List collections and subcollections
Query Support: Filter documents with Firestore query operators
Document Counting: Get document counts without fetching all data
Type Conversion: Automatic handling of Firestore types (Timestamp, GeoPoint, etc.)
Requirements
Node.js 18+
Firebase project with Firestore enabled
Firebase Admin SDK credentials (service account)
Installation
1. Clone the repository
2. Install dependencies
3. Configure Firebase credentials
Copy the example environment file:
Edit .env with your Firebase credentials:
How to get Firebase credentials
Go to Firebase Console
Select your project
Navigate to Project Settings > Service accounts
Click Generate new private key
Download the JSON file
Copy values to your
.envfile:project_id→FIREBASE_PROJECT_IDclient_email→FIREBASE_CLIENT_EMAILprivate_key→FIREBASE_PRIVATE_KEY
4. Build the project
Claude Code Configuration
Project-level configuration (recommended)
Create .mcp.json in your project root:
Note: The server automatically loads
.envfrom its installation directory, socwdis not required.
With environment variables inline
If you prefer not to use a .env file:
After configuration
Restart Claude Code
When prompted, approve the MCP server
The Firestore tools will be available in your conversation
Available Tools
Collection Operations
Tool | Description | Parameters |
| List all top-level collections | None |
| List subcollections of a document |
|
| Count documents in a collection |
|
Document Operations
Tool | Description | Parameters |
| Get a single document |
|
| List documents in a collection |
|
| Create a new document |
|
| Update an existing document |
|
| Delete a document |
|
Query Operations
Tool | Description | Parameters |
| Query with filters |
|
Supported Query Operators
==- Equal to!=- Not equal to<- Less than<=- Less than or equal to>- Greater than>=- Greater than or equal toarray-contains- Array contains valuein- Value in arrayarray-contains-any- Array contains any of values
Usage Examples
List all collections
Get a specific document
List documents with limit
Query documents
Create a document
Update a document
Delete a document
Access subcollections
Configuration Options
Environment Variables
Variable | Required | Description |
| Yes | Your Firebase project ID |
| Yes | Service account email |
| Yes | Service account private key |
Adjusting Behavior
Default query limit
The default limit for list_documents and query_documents is 20. You can override this per-request by specifying the limit parameter.
Merge vs Replace on update
By default, update_document merges new data with existing document data (merge: true). Set merge: false to replace the entire document.
Security Considerations
Never commit - They contain sensitive credentials
Use service accounts with minimal permissions - Only grant Firestore access needed
Consider read-only service accounts for development - Prevent accidental data modification
Rotate credentials regularly - Generate new service account keys periodically
Creating a read-only service account
Go to Google Cloud Console
Navigate to IAM & Admin > Service Accounts
Create a new service account
Grant only the
Cloud Datastore Userrole (read-only)Generate and download the key
Firestore Data Types
The server automatically handles these Firestore types:
Firestore Type | JSON Output |
| ISO 8601 string ( |
|
|
| Document path string ( |
| JSON array |
| JSON object |
Troubleshooting
"Permission denied" errors
Verify your service account has Firestore access
Check that
FIREBASE_PROJECT_IDmatches your actual projectEnsure the private key includes
\ncharacters for newlines
"Could not load the default credentials"
Verify all three environment variables are set
Check that
FIREBASE_PRIVATE_KEYis properly quoted
MCP server not appearing in Claude
Restart Claude Code after adding
.mcp.jsonCheck the file path in configuration is correct
Verify the build completed successfully (
dist/index.jsexists)
MCP server shows "failed" status
The server loads
.envfrom its installation directory automaticallyVerify your
.envfile exists in the firestore-mcp directory (not your project directory)Run
node /path/to/firestore-mcp/dist/index.jsmanually to see error messages
Development
License
MIT
Contributing
Contributions are welcome! Please open an issue or submit a pull request.