Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Conecta tu IDE a Firestore con MCP Toolbox
En esta página, se describe cómo usar MCP Toolbox para bases de datos y conectar tu instancia de Firestore a entornos de desarrollo integrados (IDE) y herramientas para desarrolladores que admitan el Protocolo de contexto del modelo (MCP). Usa estas herramientas para ejecutar consultas y interactuar con tu base de datos. Esta guía está dirigida a los desarrolladores que usan sus IDE y herramientas para desarrolladores existentes para trabajar con Firestore.
El Protocolo de contexto del modelo (MCP) es un protocolo abierto para conectar modelos de lenguaje grandes (LLM) a fuentes de datos como Firestore. En esta página, se describe cómo usar la caja de herramientas de MCP para bases de datos y exponer tus herramientas de asistencia para desarrolladores a una instancia de Firestore con los siguientes IDEs:
Ejecuta gcloud auth application-default login para autenticarte
Instala MCP Toolbox
Descarga la versión más reciente de MCP Toolbox como un archivo binario. Selecciona el objeto binario correspondiente a tu sistema operativo (SO) y a la arquitectura de CPU. Debes usar la versión V0.13.0 o una posterior de MCP Toolbox.
Tu herramienta de IA ahora está conectada a Firestore a través de MCP. Intenta pedirle a tu asistente de IA que enumere colecciones, obtenga documentos, consulte colecciones o administre reglas de seguridad.
Las siguientes herramientas están disponibles para el LLM:
firestore-add-documents: Agrega un documento a una ruta de acceso de la colección de Firestore.
firestore-get-documents: Obtiene varios documentos de Firestore por sus rutas.
firestore-list-collections: Enumera las colecciones de Firestore para una ruta principal determinada.
firestore-delete-documents: Borra varios documentos de Firestore.
firestore-query-collection: Consulta documentos de una colección con opciones de filtrado, ordenamiento y límite.
firestore-get-rules: Recupera las reglas de seguridad activas de Firestore para el proyecto actual.
firestore-update-document: Actualiza un documento existente en Firestore por su ruta de acceso.
firestore-validate-rules: Valida la sintaxis y los errores de las reglas de seguridad de Firestore.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 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."]]