Firestore MCP服务

一个用于直接与Google Firestore交互的MCP(模型上下文协议)服务器,提供创建、读取、更新和删除Firestore文档的简洁接口。

  • by gitskyflux
  • JavaScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 gitskyflux/firestore-mcp

使用说明

Firestore MCP服务器

用于直接与Google Firestore交互的MCP(模型上下文协议)服务器。此服务器提供了一个干净的界面,用于通过Claude Desktop创建、读取、更新和删除Firestore文档。

特性

  • 在Firestore集合中创建文档
  • 从Firestore收藏中读取文档
  • 更新现有文档
  • 删除文档
  • 查询具有过滤、排序和限制的文档
  • 列出可用收藏

设置

  1. 安装依赖项:

    npm install
    
  2. 构建项目:

    npm run build
    
  3. 配置Claude桌面: 将以下内容添加到您的 claude_desktop_config.json:

    "firestore-mcp": {
      "command": "node",
      "args": [
        "/path/to/firestore-mcp/build/index.js"
      ],
      "env": {
        "GOOGLE_CLOUD_PROJECTS": "project-id"
      }
    }
    

    将args中的路径替换为index.js的实际路径。

    在GOOGLE_CLOUD_PROJECTS中定义一个逗号分隔的项目ID列表。 例子: google-project-id1,google-project-id2 第一个列出的项目是默认项目。

    应用程序希望在每个项目的keys文件夹中找到.json凭据文件。 示例:keys/google-project-id1.json,keys/googel-project-id2.json 确保云服务帐户具有与cloud Firestore交互的适当权限,例如。 Cloud Datastore Owner 或较低的权限。

可用工具

  • getDocument:从集合中按ID获取文档
  • 创建文档:在集合中创建新文档
  • 更新文档:更新现有文档
  • 删除文档:删除文档
  • query文档:使用筛选器、排序和限制查询文档
  • list收藏:列出所有可用收藏

Claude Desktop中的示例用法

以下是如何在Claude Desktop中使用每个工具的示例:

获取文档

Get the document with ID "user123" from the "users" collection

创建文档

Create a new document in the "users" collection with the following data:
{
  "name": "John Doe",
  "email": "john@example.com",
  "age": 30
}

更新文档

Update the document with ID "user123" in the "users" collection to change the age to 31

删除文档

Delete the document with ID "user123" from the "users" collection

查询文档

Find all users over 25 years old, ordered by name

列出收藏

List all available Firestore collections

发展

  • 观看模式: npm run dev