A Model Context Protocol (MCP) server that provides Firestore database operations.
npx @nerd305/mcp-firestore-server
The server requires the following environment variables:
GOOGLE_CLOUD_PROJECT
orFIREBASE_PROJECT_ID
: Your Firebase project ID (required)FIRESTORE_EMULATOR_HOST
: Firestore emulator host (optional, e.g., "127.0.0.1:8080")
Add to your .mcp.json
configuration:
{
"mcpServers": {
"firestore": {
"command": "npx",
"args": ["-y", "@nerd305/mcp-firestore-server"],
"env": {
"GOOGLE_CLOUD_PROJECT": "your-project-id",
"FIRESTORE_EMULATOR_HOST": "127.0.0.1:8080"
}
}
}
}
For production Firestore (requires authentication):
{
"mcpServers": {
"firestore": {
"command": "npx",
"args": ["-y", "@nerd305/mcp-firestore-server"],
"env": {
"GOOGLE_CLOUD_PROJECT": "your-project-id",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
}
}
Query documents from a Firestore collection.
{
collection: string;
limit?: number;
orderBy?: string;
orderDirection?: "asc" | "desc";
}
Get a specific document by ID.
{
collection: string;
docId: string;
}
Query documents with where conditions.
{
collection: string;
field: string;
operator: "==" | "!=" | "<" | "<=" | ">" | ">=" | "array-contains" | "in" | "array-contains-any";
value: string;
limit?: number;
}
List all top-level collections.
{
}
Create a new document.
{
collection: string;
docId?: string; // Optional, auto-generated if not provided
data: object;
}
Update an existing document.
{
collection: string;
docId: string;
data: object;
merge?: boolean; // Default: true
}
Delete a document.
{
collection: string;
docId: string;
}
- Clone the repository
- Install dependencies:
npm install
- Run locally:
npm start
cd mcp-firestore-server
npm link
# In your project
npm link @nerd305/mcp-firestore-server
MIT