a

adexltd

@adexltd/mcp-google-suite
Hosted
0 Stars 312 次浏览 adexltd 更新于 2026-08-23

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "mcp-google-suite": {
      "args": [
        "-m",
        "mcp_google_suite"
      ],
      "command": "python",
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "~/.google/server-creds.json",
        "GOOGLE_OAUTH_CREDENTIALS": "~/.google/oauth.keys.json"
      }
    }
  }
}

可用工具 (8 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

drive_search_files

Search for files in Google Drive

该工具无需必填参数,直接调用即可

drive_create_folder

Create a new folder in Google Drive

该工具无需必填参数,直接调用即可

docs_create

Create a new Google Doc

该工具无需必填参数,直接调用即可

docs_get_content

Get the contents of a Google Doc

该工具无需必填参数,直接调用即可

docs_update_content

Update the content of a Google Doc

该工具无需必填参数,直接调用即可

sheets_create

Create a new Google Sheet

该工具无需必填参数,直接调用即可

sheets_get_values

Get values from a Google Sheet range

该工具无需必填参数,直接调用即可

sheets_update_values

Update values in a Google Sheet range

该工具无需必填参数,直接调用即可

服务介绍

MCP Google Workspace 服务器

CI
codecov
PyPI version

一个模型上下文协议(MCP)服务器,使AI代理能够与Google Workspace(Drive、Docs和Sheets)服务进行交互。

🌟 特性

  • Google Drive:搜索文件、创建文件夹
  • Google Docs:创建、读取、更新文档
  • Google Sheets:创建电子表格、读写单元格值
  • 多种传输模式:标准输入输出(默认)、SSE、WebSocket
  • 支持MCP兼容的客户端(如Cursor等)

📋 安装

使用uv(推荐)

bash
uvx mcp-google-suite

使用pip

bash
pip install mcp-google-suite

开发环境设置

bash

克隆并安装

git clone git@github.com:adexltd/mcp-google-suite.git && cd mcp-google-suite
uv venv && source .venv/bin/activate # 或者在Windows上使用.venvScriptsactivate
uv pip install -e .

🔧 配置

配置MCP客户端

将以下内容添加到您的客户端设置中(例如Cursor, Claude):

使用uvx(推荐):
json
{
"mcpServers": {
"mcp-google-suite": {
"command": "uvx",
"args": ["mcp-google-suite"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "~/.google/server-creds.json",
"GOOGLE_OAUTH_CREDENTIALS": "~/.google/oauth.keys.json"
}
}
}
}

使用pip安装:
json
{
"mcpServers": {
"mcp-google-suite": {
"command": "python",
"args": ["-m", "mcp_google_suite"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "~/.google/server-creds.json",
"GOOGLE_OAUTH_CREDENTIALS": "~/.google/oauth.keys.json"
}
}
}
}

Google OAuth 设置

  1. 访问 Google Cloud Console
  2. 启用Drive、Docs和Sheets API
  3. 创建OAuth 2.0凭据
  4. 保存为 ~/.google/oauth.keys.json
  5. 运行 mcp-google auth 进行身份验证

可用工具

Drive 操作

  • drive_search_files: 在Google Drive中搜索文件
    • query (字符串, 必需): 搜索查询
    • page_size (整数, 可选): 返回的结果数量
  • drive_create_folder: 创建新文件夹
    • name (字符串, 必需): 文件夹名称
    • parent_id (字符串, 可选): 父文件夹ID

Docs 操作

  • docs_create: 创建新文档
    • title (字符串, 必需): 文档标题
    • content (字符串, 可选): 初始内容
  • docs_get_content: 获取文档内容
    • document_id (字符串, 必需): 文档ID
  • docs_update_content: 更新文档内容
    • document_id (字符串, 必需): 文档ID
    • content (字符串, 必需): 新内容

Sheets 操作

  • sheets_create: 创建新电子表格
    • title (字符串, 必需): 电子表格标题
    • sheets (数组, 可选): 工作表名称
  • sheets_get_values: 获取单元格值
    • spreadsheet_id (字符串, 必需): 电子表格ID
    • range (字符串, 必需): A1表示法范围
  • sheets_update_values: 更新单元格值
    • spreadsheet_id (字符串, 必需): 电子表格ID
    • range (字符串, 必需): A1表示法范围
    • values (二维数组, 必需): 值数组

🛠️ 开发

bash

安装开发依赖

uv pip install -e ".[dev]"

设置pre-commit钩子

pre-commit install

运行测试

pytest

格式化代码

black . && ruff check --fix .

🔍 调试

使用MCP Inspector进行交互式测试:

bash

使用uvx

npx @modelcontextprotocol/inspector uvx mcp-google

对于开发

cd path/to/mcp-google-suite
npx @modelcontextprotocol/inspector uv run mcp-google## 📚 资源

🤝 贡献

请阅读 CONTRIBUTING.md 以了解我们的行为准则以及提交拉取请求的流程。

🔒 安全

有关报告漏洞和最佳实践的信息,请参阅 SECURITY.md

📄 许可证

MIT 许可证 - 详情请参阅 LICENSE 文件。

相关 MCP 服务