Firebase数据库CLI工具

一个集成Gemini CLI和Firebase Firestore的演示工具,用于通过命令行界面进行数据库操作。

  • by MalikAqsa-cloud
  • 本地部署
  • 更新于
在 GitHub 查看 MalikAqsa-cloud/MCP-Configuration-with-Firebase

使用说明

🚀 Gemini CLI+Firebase MCP演示-完成设置

📋 概述

这是演示Gemini CLI与MCP(模型上下文协议)与Firebase Firestore集成的完整设置。您的屏幕录制演示已准备就绪!


✅ 已经做了什么

  1. 虚拟环境:创建并激活于 /home/admin1/MCP_ Firebase/venv
  2. 已安装依赖项:
    • Firebase管理SDK✅
    • MCP包✅
    • Gemini CLI✅
  3. Firebase连接:已测试并正常工作✅
  4. MCP配置:创建于 ~/.config/mcp/config.json ✅
  5. 服务账号:准备就绪 /home/admin1/MCP_ Firebase/test-mcp-84832-firebase-adminsdk-fbsvc-a26c094e84.json ✅

🔑 缺失:Gemini API代币

您需要获得Gemini API代币 发件人:https://aistudio.google.com/app/apikey

选项1:创建配置文件

mkdir -p ~/.config
echo 'token = "YOUR_GEMINI_API_TOKEN_HERE"' > ~/.config/gemini-cli.toml

选项2:在命令中使用令牌

添加 -t "YOUR_TOKEN" 所有gemini cli命令


🎬 准备录制命令

1.环境设置

cd "/home/admin1/MCP_ Firebase"
source venv/bin/activate

2.验证

gemini-cli -t "YOUR_TOKEN" -h
python -c "import firebase_admin; print('Firebase ready')"
cat ~/.config/mcp/config.json

3.演示查询(5+个操作)

查询1:列出文档

gemini-cli -t "YOUR_TOKEN" "List all documents from the 'users' collection in Firebase"

查询2:获取单个文档

gemini-cli -t "YOUR_TOKEN" "Get the document with ID 'user123' from the 'users' collection"

查询3:插入文档

gemini-cli -t "YOUR_TOKEN" "Insert a new document into the 'users' collection with the following data: name='John Doe', email='john@example.com', age=30, city='New York'"

查询4:更新文档

gemini-cli -t "YOUR_TOKEN" "Update the 'age' field to 31 for the document with ID 'user123' in the 'users' collection"

查询5:删除单据

gemini-cli -t "YOUR_TOKEN" "Delete the document with ID 'user123' from the 'users' collection"

查询6:复杂查询(奖金)

gemini-cli -t "YOUR_TOKEN" "Find all users in the 'users' collection where age is greater than 25 and city is 'New York'"

📁 已创建的文件

  • SETUP_GUIDE.md -分步设置说明
  • MCP_CONFIG.md -MCP配置详细信息
  • DEMO_QUERIES.md -所有带解释的演示查询
  • DEMO_SCRIPT.md -完整的录制脚本
  • GEMINI_CONFIG.md -Gemini API代币设置
  • ~/.config/mcp/config.json -MCP配置文件

🎯 项目详细信息

  • 项目ID: test-mcp-84832
  • 服务账号: firebase-adminsdk-fbsvc@test-mcp-84832.iam.gserviceaccount.com
  • 环境:Ubuntu Linux,Python 3.12
  • 虚拟环境: /home/admin1/MCP_ Firebase/venv

🚨 重要提示

  1. 获取Gemini API代币 录制前
  2. 先测试一个查询 确保一切正常
  3. 保持命令复制粘贴友好 对于演示
  4. 优雅地处理错误 如果发生
  5. 解释每个步骤 录制期间

🎬 录制提示

  • 从环境设置开始
  • 显示正在键入的每个命令
  • 解释每个查询的作用
  • 突出重要结果
  • 保持步伐平稳清晰
  • 以收益摘要结束

✅ 你准备好了!

一切都已设置好,可以进行演示录制。只需获得Gemini API代币,您就可以立即开始录制!

下一步:从获取Gemini API代币https://aistudio.google.com/app/apikey