Back to MCP directory
publicPublicdnsLocal runtime

gmail-mcp-server-3

Google Workspace MCP服务器是一个提供Gmail和日历API交互工具的服务,支持通过MCP接口编程管理邮件和日历事件。

article

README

🚀 谷歌工作区 MCP 服务器

谷歌工作区 MCP 服务器是一个基于 Model Context Protocol (MCP) 的工具,它提供了与 Gmail 和日历 API 交互的能力。借助 MCP 接口,用户可以对电子邮件和日历事件进行编程管理,极大地提高了工作效率。

🚀 快速开始

要使用谷歌工作区 MCP 服务器,你需要完成一系列的准备和设置工作。具体步骤如下:

  1. Node.js:确保安装 Node.js 版本 14 或更高。
  2. Google Cloud Console
    • 创建项目并启用 Gmail API 和 Calendar API。
    • 为项目创建 OAuth 客户端 ID,获取 client_idclient_secretrefresh_token
  3. 环境变量:在服务器环境中设置以下变量:
    CLIENT_ID=your_client_id
    CLIENT_SECRET=your_client_secret
    REFRESH_TOKEN=your_refresh_token
    
  4. 克隆仓库
    git clone https://github.com/yourusername/google-workspace-mcp.git
    cd google-workspace-mcp
    
  5. 安装依赖项
    npm install
    
  6. 创建凭证文件
    • 在项目根目录下创建 credentials.json 文件,内容如下:
      {
        "client_id": "your_client_id",
        "client_secret": "your_client_secret",
        "refresh_token": "your_refresh_token"
      }
      
  7. 运行服务器
    node index.js
    

✨ 主要特性

邮件工具

  • list_emails:列出收件箱中的近期邮件,支持可选过滤功能
  • search_emails:使用 Gmail 查询语法进行高级邮件搜索
  • send_email:发送新邮件,支持 CC 和 BCC
  • modify_email:修改邮件标签(存档、删除、标记为已读/未读)

日历工具

  • list_events:列出 upcoming 日历事件,支持日期范围过滤
  • create_event:创建新的日历事件,支持与会者
  • update_event:更新现有日历事件
  • delete_event:删除日历事件

💻 使用示例

基础用法

邮件操作

  1. 列出邮件
    {
      "action": "list_emails",
      "params": {
        "limit": 10,
        "folder": "inbox"
      }
    }
    
  2. 发送邮件
    {
      "action": "send_email",
      "params": {
        "to": "recipient@example.com",
        "subject": "Test Email",
        "body": "This is a test email."
      }
    }
    

日历操作

  1. 创建事件
    {
      "action": "create_event",
      "params": {
        "summary": "会议提醒",
        "location": "会议室 101",
        "description": "每周同步",
        "start": "2024-01-24T10:00:00Z",
        "end": "2024-01-24T11:00:00Z",
        "attendees": ["colleague@example.com"]
      }
    }
    
  2. 更新事件
    {
      "action": "update_event",
      "params": {
        "event_id": "event_id_to_update",
        "summary": "更新的会议标题",
        "location": "线上会议"
      }
    }
    

📚 详细文档

故障排除

  1. 身份验证问题

    • 确保所有必需的 OAuth 作用域已授予
    • 验证客户端 ID 和密钥是否正确
    • 检查刷新令牌是否有效
  2. API 错误

    • 查看 Google Cloud Console 中的 API 配额和限制
    • 确保项目启用了相关 API
    • 确认请求参数与要求格式一致

📄 许可证

本项目在 MIT License 下开源。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client