Firestore高级MCP是一款强大的工具,支持对文档进行增删改查,提供自动索引和查询优化,还能实现实时数据同步,确保数据一致性。
npm install firebase @types/firebase firebase-admin
git clone https://github.com/FirebaseExtended/firestore-mcp.git
cd firestore-mcp
npm install
在项目根目录创建 config.js 文件:
const firebaseConfig = {
apiKey: 'your-api-key',
authDomain: 'your-project-id.firebaseapp.com',
projectId: 'your-project-id',
storageBucket: 'your-storage-bucket.appspot.com',
messagingSenderId: 'your-messaging-sender-id',
appId: 'your-app-id'
};
initializeApp(firebaseConfig);
设置以下环境变量:
FIREBASE_API_KEYFIREBASE_AUTH_DOMAINFIREBASE_PROJECT_IDFIREBASE_STORAGE_BUCKETFIREBASE_MESSAGING_SENDER_IDFIREBASE_APP_IDnode index.js
npx firebase-mcp
const { initializeApp } = require('firebase-admin/app');
const { getFirestore } = require('firebase-admin/firestore');
const app = initializeApp();
const db = getFirestore(app);
在 claude-config.json 文件中添加:
{
"firestore": {
"apiKey": "your-api-key",
"authDomain": "your-project-id.firebaseapp.com",
"projectId": "your-project-id"
}
}
npm install firebase @types/firebase firebase-admin
git clone https://github.com/FirebaseExtended/firestore-mcp.git
cd firestore-mcp
npm install
{
"collection": "users",
"id": "user123"
}
{
"collection": "orders",
"data": {
"product": "Laptop",
"price": 999.99,
"fields": [
{
"fieldPath": "user",
"type": "reference",
"value": "users/user123"
}
]
}
}
{
"collection": "temporaryData",
"id": "session123",
"expiresIn": 86400000,
"fieldName": "expires_at"
}
{
"collection": "products",
"filters": [
{
"field": "category",
"operator": "==",
"value": "electronics"
},
{
"field": "price",
"operator": "<",
"value": 1000
}
],
"orderBy": {
"field": "price",
"direction": "asc"
},
"limit": 10
}
如需了解更多信息,请参考:
此项目使用 MIT 许可证,查看文件 LICENSE 以获取详细信息。
感谢以下组织和项目的贡献:
欢迎任何贡献!请随时通过 GitHub 提交拉取请求或问题,以改进此项目。