Google Sheets MCP 服务器

Google Sheets MCP 服务器

用于 Google Sheets 的模型上下文协议 (MCP) 服务器,支持桌面应用直接操作表格。

快速入门

  1. 克隆仓库并进入目录: git clone https://github.com/yourusername/google-sheets-mcp-server.git cd google-sheets-mcp-server

  2. 创建虚拟环境并激活: python -m venv .venv source .venv/bin/activate (Windows 使用 .venv\Scripts\activate)

  3. 安装依赖: uv pip install -e .

  4. 配置 Google Cloud 凭证:

    • Google Cloud Console 中启用 Google Sheets API 和 Drive API。
    • 下载 OAuth 2.0 凭证文件保存为 ~/.config/google_sheets_mcp/google-sheets-mcp.json
  5. 启动服务器完成身份验证: python google_sheets.py --credentials-path ~/.config/google_sheets_mcp/google-sheets-mcp.json

  6. 配置 Claude Desktop 设置文件 claude_desktop_config.json: { "mcpServers": { "google_sheets": { "command": "/path/to/your/.venv/bin/python", "args": [ "/path/to/your/google_sheets.py", "--credentials-path", "/Users/yourusername/.config/google_sheets_mcp/google-sheets-mcp.json", "--log-level", "DEBUG" ] } } }

  7. 使用服务器创建、读取和管理 Google Sheets。