MCP Google Sheets 集成工具

MCP Google Sheets 集成工具

该工具通过 MCP 服务器连接 Google Drive 和 Google Sheets,实现创建和修改电子表格的功能。

快速入门

mcp-google-sheets 是一个 Python 工具,用于通过 MCP 客户端与 Google Sheets API 进行交互。

  1. Google Cloud 设置

    • 创建 Google Cloud 项目并启用 Google Sheets APIGoogle Drive API
    • 推荐使用服务账号进行身份验证
  2. 安装 uv 工具

    # macOS/Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
    # Windows
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
    
  3. 设置环境变量

    • 使用服务账号时:
      export SERVICE_ACCOUNT_PATH="/path/to/service-account-key.json"
      export DRIVE_FOLDER_ID="your_drive_folder_id"
      
    • 使用 OAuth 时:
      export CREDENTIALS_PATH="/path/to/credentials.json"
      export TOKEN_PATH="/path/to/token.json"
      
  4. 运行服务器

    uvx mcp-google-sheets
    
  5. 连接客户端

    • 配置支持的 MCP 客户端(如 Claude Desktop)以连接到服务器。

更多详细信息,请参考 README 文档。