Firestore using MCP
Model Context Protocol (MCP) is an open protocol for connecting Large Language Models (LLMs) to data sources like Firestore. This guide covers how to use MCP Toolbox for Databases to expose your developer assistant tools to a Firestore instance:
- Cursor
- Windsurf (Codium)
- Visual Studio Code (Copilot)
- Cline (VS Code extension)
- Claude desktop
- Claude code
- Gemini CLI
- Gemini Code Assist
Set up Firestore
Create or select a Google Cloud project.
Enable the Firestore API for your project.
Create a Firestore database if you haven’t already.
Set up authentication for your local environment.
- Install gcloud CLI
- Run
gcloud auth application-default login
to authenticate
Install MCP Toolbox
Download the latest version of Toolbox as a binary. Select the correct binary corresponding to your OS and CPU architecture. You are required to use Toolbox version V0.10.0+:
curl -O https://storage.googleapis.com/genai-toolbox/v0.13.0/linux/amd64/toolbox
curl -O https://storage.googleapis.com/genai-toolbox/v0.13.0/darwin/arm64/toolbox
curl -O https://storage.googleapis.com/genai-toolbox/v0.13.0/darwin/amd64/toolbox
curl -O https://storage.googleapis.com/genai-toolbox/v0.13.0/windows/amd64/toolbox
Make the binary executable:
chmod +x toolbox
Verify the installation:
./toolbox --version
Configure your MCP Client
Install Claude Code.
Create a
.mcp.json
file in your project root if it doesn’t exist.Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "firestore": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","firestore","--stdio"], "env": { "FIRESTORE_PROJECT": "your-project-id", "FIRESTORE_DATABASE": "(default)" } } } }
Restart Claude code to apply the new configuration.
Open Claude desktop and navigate to Settings.
Under the Developer tab, tap Edit Config to open the configuration file.
Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "firestore": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","firestore","--stdio"], "env": { "FIRESTORE_PROJECT": "your-project-id", "FIRESTORE_DATABASE": "(default)" } } } }
Restart Claude desktop.
From the new chat screen, you should see a hammer (MCP) icon appear with the new MCP server available.
Open the Cline extension in VS Code and tap the MCP Servers icon.
Tap Configure MCP Servers to open the configuration file.
Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "firestore": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","firestore","--stdio"], "env": { "FIRESTORE_PROJECT": "your-project-id", "FIRESTORE_DATABASE": "(default)" } } } }
You should see a green active status after the server is successfully connected.
Create a
.cursor
directory in your project root if it doesn’t exist.Create a
.cursor/mcp.json
file if it doesn’t exist and open it.Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "firestore": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","firestore","--stdio"], "env": { "FIRESTORE_PROJECT": "your-project-id", "FIRESTORE_DATABASE": "(default)" } } } }
Cursor and navigate to Settings > Cursor Settings > MCP. You should see a green active status after the server is successfully connected.
Open VS Code and create a
.vscode
directory in your project root if it doesn’t exist.Create a
.vscode/mcp.json
file if it doesn’t exist and open it.Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "firestore": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","firestore","--stdio"], "env": { "FIRESTORE_PROJECT": "your-project-id", "FIRESTORE_DATABASE": "(default)" } } } }
Open Windsurf and navigate to the Cascade assistant.
Tap on the hammer (MCP) icon, then Configure to open the configuration file.
Add the following configuration, replace the environment variables with your values, and save:
{ "mcpServers": { "firestore": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","firestore","--stdio"], "env": { "FIRESTORE_PROJECT": "your-project-id", "FIRESTORE_DATABASE": "(default)" } } } }
Install the Gemini CLI.
In your working directory, create a folder named
.gemini
. Within it, create asettings.json
file.Add the following configuration, replace the environment variables with your values, and then save:
{ "mcpServers": { "firestore": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","firestore","--stdio"], "env": { "FIRESTORE_PROJECT": "your-project-id", "FIRESTORE_DATABASE": "(default)" } } } }
Install the Gemini Code Assist extension in Visual Studio Code.
Enable Agent Mode in Gemini Code Assist chat.
In your working directory, create a folder named
.gemini
. Within it, create asettings.json
file.Add the following configuration, replace the environment variables with your values, and then save:
{ "mcpServers": { "firestore": { "command": "./PATH/TO/toolbox", "args": ["--prebuilt","firestore","--stdio"], "env": { "FIRESTORE_PROJECT": "your-project-id", "FIRESTORE_DATABASE": "(default)" } } } }
Use Tools
Your AI tool is now connected to Firestore using MCP. Try asking your AI assistant to list collections, get documents, query collections, or manage security rules.
The following tools are available to the LLM:
- firestore-get-documents: Gets multiple documents from Firestore by their paths
- firestore-list-collections: List Firestore collections for a given parent path
- firestore-delete-documents: Delete multiple documents from Firestore
- firestore-query-collection: Query documents from a collection with filtering, ordering, and limit options
- firestore-get-rules: Retrieves the active Firestore security rules for the current project
- firestore-validate-rules: Validates Firestore security rules syntax and errors
Note
Prebuilt tools are pre-1.0, so expect some tool changes between versions. LLMs will adapt to the tools available, so this shouldn’t affect most users.