Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Conectar seu ambiente de desenvolvimento integrado ao Firestore usando a caixa de ferramentas do MCP
Nesta página, descrevemos como usar a MCP Toolbox para bancos de dados e conectar sua instância do Firestore a ambientes de desenvolvimento integrado (IDEs) e ferramentas para desenvolvedores que oferecem suporte ao Protocolo de contexto de modelo (MCP). Use essas ferramentas para executar consultas e interagir com seu banco de dados. Este guia é destinado a desenvolvedores que usam os IDEs e as ferramentas de desenvolvimento atuais para trabalhar com o Firestore.
O Protocolo de Contexto de Modelo (MCP) é um protocolo aberto para conectar modelos de linguagem grandes (LLMs) a fontes de dados como o Firestore. Nesta página, descrevemos como usar a caixa de ferramentas do MCP para bancos de dados e expor suas ferramentas de assistência ao desenvolvedor a uma instância do Firestore usando os seguintes IDEs:
Execute gcloud auth application-default login para autenticar
Instalar a caixa de ferramentas do MCP
Faça o download da versão mais recente da MCP Toolbox como um binário. Selecione o binário correspondente ao seu sistema operacional e à arquitetura da CPU. Use a versão V0.13.0 ou mais recente da caixa de ferramentas do MCP.
Sua ferramenta de IA agora está conectada ao Firestore usando o MCP. Peça ao assistente de IA para listar coleções, receber documentos, consultar coleções ou gerenciar regras de segurança.
As seguintes ferramentas estão disponíveis para o LLM:
firestore-add-documents: adiciona um documento a um caminho de coleção do Firestore.
firestore-get-documents: recebe vários documentos do Firestore pelos caminhos deles.
firestore-list-collections: lista as coleções do Firestore para um determinado caminho principal.
firestore-delete-documents: exclui vários documentos do Firestore.
firestore-query-collection: consulta documentos de uma coleção com opções de filtragem, ordenação e limite.
firestore-get-rules: recupera as regras de segurança ativas do Firestore para o projeto atual.
firestore-update-document: atualiza um documento existente no Firestore pelo caminho dele.
firestore-validate-rules: valida a sintaxe e os erros das regras de segurança do Firestore.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 UTC."],[],[],null,["Connect your IDE to Firestore using MCP Toolbox\n\nThis page describes how to use the [MCP Toolbox for databases](https://github.com/googleapis/genai-toolbox) to connect your Firestore instance to integrated development environments (IDE) and developer tools that support [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction). Use these tools to execute queries and interact with your database. This guide is for developers who use their existing IDEs and developer tools to work with Firestore.\n\n[Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) is an open protocol for connecting large language models (LLMs) to data sources like Firestore. This page describes how to use the [MCP Toolbox for Databases](https://github.com/googleapis/genai-toolbox) to expose your developer assistance tools to a Firestore instance using the following IDEs:\n\n- [Cursor](#configure-your-mcp-client)\n- [Windsurf](#configure-your-mcp-client) (Codium)\n- [Visual Studio Code](#configure-your-mcp-client) (Copilot)\n- [Cline](#configure-your-mcp-client) (VS Code extension)\n- [Claude desktop](#configure-your-mcp-client)\n- [Claude code](#configure-your-mcp-client)\n- [Gemini CLI](#configure-your-mcp-client)\n- [Gemini Code Assist](#configure-your-mcp-client)\n\nSet up Firestore\n\n1. [Create a new Google Cloud project](/resource-manager/docs/creating-managing-projects) or [select an existing one](/resource-manager/docs/creating-managing-projects#identifying_projects).\n\n2. [Enable the Firestore API](https://console.cloud.google.com/apis/library/firestore.googleapis.com) for your project.\n\n3. [Create a Firestore database](/firestore/docs/create-database-web-mobile-client-library) if you haven't already.\n\n4. Set up authentication for your local environment.\n\n - [Install gcloud CLI](/sdk/docs/install)\n - Run `gcloud auth application-default login` to authenticate\n\nInstall MCP Toolbox\n\n1. Download the latest version of MCP Toolbox as a binary. Select the [binary](https://github.com/googleapis/genai-toolbox/releases) corresponding to your operating system (OS) and CPU architecture. You must use MCP Toolbox version V0.13.0 or later.\n\n linux/amd64 \n\n ```\n curl -O https://storage.googleapis.com/genai-toolbox/version/linux/amd64/toolbox\n ```\n\n Replace \u003cvar translate=\"no\"\u003eversion\u003c/var\u003e with the MCP Toolbox\n version number, for example `v0.13.0`.\n\n darwin/arm64 \n\n ```\n curl -O https://storage.googleapis.com/genai-toolbox/version/darwin/arm64/toolbox\n ```\n\n Replace \u003cvar translate=\"no\"\u003eversion\u003c/var\u003e with the MCP Toolbox\n version number, for example `v0.13.0`.\n\n darwin/amd64 \n\n ```\n curl -O https://storage.googleapis.com/genai-toolbox/version/darwin/amd64/toolbox\n ```\n\n Replace \u003cvar translate=\"no\"\u003eversion\u003c/var\u003e with the MCP Toolbox\n version number, for example `v0.13.0`.\n\n windows/amd64 \n\n ```\n curl -O https://storage.googleapis.com/genai-toolbox/version/windows/amd64/toolbox\n ```\n\n Replace \u003cvar translate=\"no\"\u003eversion\u003c/var\u003e with the MCP Toolbox\n version number, for example `v0.13.0`.\n2. Make the binary executable.\n\n chmod +x toolbox\n\n3. Verify the installation.\n\n ./toolbox --version\n\nConfigure the MCP client \n\nClaude code\n\n1. Install [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview).\n2. Create the `.mcp.json` file in your project root, if it doesn't exist.\n3. Add the following configuration, replace the environment variables with your values, and save.\n\n\u003cbr /\u003e\n\n```\n {\n \"mcpServers\": {\n \"firestore\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"firestore\",\"--stdio\"],\n \"env\": {\n \"FIRESTORE_PROJECT\": \"PROJECT_ID\",\n \"FIRESTORE_DATABASE\": \"DATABASE_NAME\"\n }\n }\n }\n }\n```\n\n4. Restart Claude code to apply the new configuration.\n\nClaude desktop\n\n1. Open [Claude Desktop](https://claude.ai/download) and navigate to **Settings**.\n2. In the **Developer** tab, click **Edit Config** to open the configuration file.\n3. Add the following configuration, replace the environment variables with your values, and save.\n\n\u003cbr /\u003e\n\n```\n {\n \"mcpServers\": {\n \"firestore\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"firestore\",\"--stdio\"],\n \"env\": {\n \"FIRESTORE_PROJECT\": \"PROJECT_ID\",\n \"FIRESTORE_DATABASE\": \"DATABASE_NAME\"\n }\n }\n }\n }\n```\n\n4. Restart Claude Desktop.\n5. From the new chat screen, you should see a hammer (MCP) icon appear with the new MCP server available.\n\nCline\n\n1. Open the [Cline](https://github.com/cline/cline) extension in VS Code and tap **MCP Servers** icon.\n2. Click **Configure MCP Servers** to open the configuration file.\n3. Add the following configuration, replace the environment variables with your values, and save.\n\n\u003cbr /\u003e\n\n```\n {\n \"mcpServers\": {\n \"firestore\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"firestore\",\"--stdio\"],\n \"env\": {\n \"FIRESTORE_PROJECT\": \"PROJECT_ID\",\n \"FIRESTORE_DATABASE\": \"DATABASE_NAME\"\n }\n }\n }\n }\n```\n\nA green active status appears after the server connects successfully. \n\nCursor\n\n1. Create the `.cursor` directory in your project root if it doesn't exist.\n2. Create the `.cursor/mcp.json` file if it doesn't exist, and open it.\n3. Add the following configuration, replace the environment variables with your values, and save.\n\n```\n {\n \"mcpServers\": {\n \"firestore\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"firestore\",\"--stdio\"],\n \"env\": {\n \"FIRESTORE_PROJECT\": \"PROJECT_ID\",\n \"FIRESTORE_DATABASE\": \"DATABASE_NAME\"\n }\n }\n }\n }\n```\n\n4. Open [Cursor](https://www.cursor.com/) and navigate to **Settings \\\u003e Cursor Settings \\\u003e MCP**. A green active status appears when the server connects.\n\nVisual Studio Code (Copilot)\n\n1. Open [VS Code](https://code.visualstudio.com/docs/copilot/overview) and create `.vscode` directory in your project root if it does not exist.\n2. Create the `.vscode/mcp.json` file if it doesn't exist, and open it.\n3. Add the following configuration, replace the environment variables with your values, and save.\n\n```\n {\n \"servers\":{\n \"firestore\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"firestore\",\"--stdio\"],\n \"env\": {\n \"FIRESTORE_PROJECT\": \"PROJECT_ID\",\n \"FIRESTORE_DATABASE\": \"DATABASE_NAME\"\n }\n }\n }\n }\n```\n\nWindsurf\n\n1. Open [Windsurf](https://docs.codeium.com/windsurf) and navigate to Cascade assistant.\n2. Click the MCP icon, then click **Configure** to open the configuration file.\n3. Add the following configuration, replace the environment variables with your values, and save.\n\n```\n {\n \"mcpServers\": {\n \"firestore\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"firestore\",\"--stdio\"],\n \"env\": {\n \"FIRESTORE_PROJECT\": \"PROJECT_ID\",\n \"FIRESTORE_DATABASE\": \"DATABASE_NAME\"\n }\n }\n }\n }\n```\n\nGemini CLI\n\n1. Install the [Gemini CLI](https://github.com/google-gemini/gemini-cli?tab=readme-ov-file#quickstart).\n2. In your working directory, create a folder named `.gemini`. Within it, create a `settings.json` file.\n3. Add the following configuration, replace the environment variables with your values, and then save.\n\n```\n {\n \"mcpServers\": {\n \"firestore\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"firestore\",\"--stdio\"],\n \"env\": {\n \"FIRESTORE_PROJECT\": \"PROJECT_ID\",\n \"FIRESTORE_DATABASE\": \"DATABASE_NAME\"\n }\n }\n }\n }\n```\n\nGemini Code Assist\n\n1. Install the [Gemini Code Assist](https://marketplace.visualstudio.com/items?itemName=Google.geminicodeassist) extension in Visual Studio Code.\n2. Enable Agent Mode in Gemini Code Assist chat.\n3. In your working directory, create a folder named `.gemini`. Within it, create a `settings.json` file.\n4. Add the following configuration, replace the environment variables with your values, and then save.\n\n```\n {\n \"mcpServers\": {\n \"firestore\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"firestore\",\"--stdio\"],\n \"env\": {\n \"FIRESTORE_PROJECT\": \"PROJECT_ID\",\n \"FIRESTORE_DATABASE\": \"DATABASE_NAME\"\n }\n }\n }\n }\n```\n\nUse the tools\n\nYour AI tool is now connected to Firestore using MCP. Try asking your AI\nassistant to list collections, get documents, query collections, or manage\nsecurity rules.\n\nThe following tools are available to the LLM:\n\n- **firestore-add-documents**: Add document to a Firestore collection path.\n- **firestore-get-documents**: Gets multiple documents from Firestore by their paths.\n- **firestore-list-collections**: List Firestore collections for a given parent path.\n- **firestore-delete-documents**: Delete multiple documents from Firestore.\n- **firestore-query-collection**: Query documents from a collection with filtering, ordering, and limit options.\n- **firestore-get-rules**: Retrieves the active Firestore security rules for the current project.\n- **firestore-update-document**: Update an existing document in Firestore by its path.\n- **firestore-validate-rules**: Validates Firestore security rules syntax and errors.\n\n| **Note:** Prebuilt tools are pre-1.0, so expect some tool changes between versions. LLMs will adapt to the tools available, so this doesn't affect most users."]]