Firestore MCP 服务器
一个用于直接与 Google Firestore 交互的 MCP(模型上下文协议)服务器。该服务器提供了一个简洁的界面,用于通过 Claude Desktop 创建、读取、更新和删除 Firestore 文档。
特征
- 在 Firestore 集合中创建文档
- 从 Firestore 集合中读取文档
- 更新现有文档
- 删除文档
- 使用筛选、排序和限制来查询文档
- 列出可用的集合
设置
- 安装依赖项:
- 构建项目:
- 配置 Claude Desktop :将以下内容添加到您的
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/google-project-id2.json。请确保云服务帐户具有与 Cloud Firestore 交互的适当权限,例如Cloud Datastore Owner
或更低权限。
可用工具
- getDocument :从集合中根据 ID 获取文档
- createDocument :在集合中创建新文档
- updateDocument :更新现有文档
- deleteDocument :删除文档
- queryDocuments :使用过滤器、排序和限制查询文档
- listCollections :列出所有可用的集合
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
发展