mcp-gsuite MCP server

mcp-gsuite MCP server

与Google Gsuite产品交互的MCP Server。

smithery 徽章

MCP-Gsuite 是一个用于与 Google Gmail 和日历交互的服务器。

功能概述

  • Gmail: 查询邮件、读取邮件内容、创建草稿、回复邮件、处理附件
  • 日历: 查看日程、创建事件、管理多个日历
  • 多账户: 支持管理多个 Google 账户

安装步骤

最简方式 (推荐)

使用 Smithery 自动安装:

npx -y @smithery/cli install mcp-gsuite --client claude

手动安装 (需要三个配置文件)

  1. 创建 OAuth 凭据

    • 访问 Google Cloud 控制台
    • 创建项目并启用 Gmail API 和 Google 日历 API
    • 创建 OAuth 客户端 ID (应用类型选择"桌面应用")
    • 添加重定向 URI: http://localhost:4100/code
  2. 创建 .gauth.json 文件

    {
        "web": {
            "client_id": "你的客户端ID",
            "client_secret": "你的客户端密钥",
            "redirect_uris": ["http://localhost:4100/code"],
            "auth_uri": "https://accounts.google.com/o/oauth2/auth",
            "token_uri": "https://oauth2.googleapis.com/token"
        }
    }
    
  3. 创建 .accounts.json 文件

    {
        "accounts": [
            {
                "email": "your.email@gmail.com",
                "account_type": "personal",
                "extra_info": "可选备注信息"
            }
        ]
    }
    
  4. 配置 Claude Desktop

    在 MacOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json
    在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

    添加以下内容:

    {
      "mcpServers": {
        "mcp-gsuite": {
          "command": "uvx",
          "args": [
            "mcp-gsuite"
          ]
        }
      }
    }
    

使用示例

你可以尝试以下提示:

  • "检索我最新的未读消息"
  • "搜索来自 Scrum Master 的邮件"
  • "明天我的日程安排是什么?"
  • "下周与 Tim 安排一个 2 小时的会议"

高级配置

要使用自定义路径:

uvx mcp-gsuite --accounts-file /path/to/.accounts.json --credentials-dir /path/to/credentials

调试

使用 MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-gsuite run mcp-gsuite

查看日志:

tail -n 20 -f ~/Library/Logs/Claude/mcp-server-mcp-gsuite.log

首次使用时,将打开浏览器进行 Google 授权。授权后,凭据将保存在本地,后续使用无需重新授权。