Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menghubungkan IDE Anda ke Firestore menggunakan MCP Toolbox
Halaman ini menjelaskan cara menggunakan MCP Toolbox untuk database guna menghubungkan instance Firestore Anda ke lingkungan pengembangan terintegrasi (IDE) dan alat developer yang mendukung Model Context Protocol (MCP). Gunakan alat ini untuk menjalankan kueri dan berinteraksi dengan database Anda. Panduan ini ditujukan bagi developer yang menggunakan IDE dan alat developer yang ada untuk bekerja dengan Firestore.
Model Context Protocol (MCP) adalah protokol terbuka untuk menghubungkan model bahasa besar (LLM) ke sumber data seperti Firestore. Halaman ini menjelaskan cara menggunakan MCP Toolbox for Databases untuk mengekspos alat bantuan developer ke instance Firestore menggunakan IDE berikut:
Jalankan gcloud auth application-default login untuk melakukan autentikasi
Menginstal Toolbox MCP
Download MCP Toolbox versi terbaru sebagai biner. Pilih biner yang sesuai dengan sistem operasi (OS) dan arsitektur CPU Anda. Anda harus menggunakan MCP Toolbox versi V0.13.0 atau yang lebih baru.
Alat AI Anda kini terhubung ke Firestore menggunakan MCP. Coba minta asisten AI Anda untuk mencantumkan koleksi, mendapatkan dokumen, membuat kueri koleksi, atau mengelola aturan keamanan.
Alat berikut tersedia untuk LLM:
firestore-add-documents: Menambahkan dokumen ke jalur koleksi Firestore.
firestore-get-documents: Mendapatkan beberapa dokumen dari Firestore berdasarkan jalur dokumennya.
firestore-list-collections: Mencantumkan koleksi Firestore untuk jalur induk tertentu.
firestore-delete-documents: Menghapus beberapa dokumen dari Firestore.
firestore-query-collection: Membuat kueri dokumen dari koleksi dengan opsi pemfilteran, pengurutan, dan batas.
firestore-get-rules: Mengambil aturan keamanan Firestore yang aktif untuk project saat ini.
firestore-update-document: Memperbarui dokumen yang ada di Firestore berdasarkan jalurnya.
firestore-validate-rules: Memvalidasi sintaksis dan error aturan keamanan Firestore.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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."]]