@kazuph/mcp-gmail-gas

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Allows Claude Desktop to interact with Gmail accounts through Google Apps Script, enabling capabilities like searching emails, retrieving email content and details, and downloading attachments.

  • Uses Google Apps Script as the backend service to interface with Gmail, requiring users to deploy a script to their Google account that provides the necessary API endpoints for Gmail interaction.

MCP Gmail

用于 Gmail 集成的模型上下文协议服务器。这允许 Claude Desktop(或任何 MCP 客户端)通过 Google Apps Script 与您的 Gmail 帐户进行交互。

快速入门(针对用户)

先决条件

  • Node.js 18+(通过brew install node安装)
  • Gmail 帐户
  • Google Apps 脚本部署
  • Claude Desktop(从https://claude.ai/desktop安装)

配置

  1. 部署 Google Apps 脚本
  • 访问Google Apps Script并创建一个新项目
  • 复制code.gs的全部内容并将其粘贴到脚本编辑器中
  • 点击“部署”>“新部署”
  • 选择“Web 应用”作为部署类型
  • 配置以下设置:
    • 执行身份:我
    • 谁有访问权限:任何人
    • 点击“部署”
  • 出现提示时,请查看并授权该应用访问您的 Gmail 帐户
  • 复制部署 URL 并生成随机 API 密钥以确保安全

注意:该脚本需要 Gmail 访问权限。首次部署并运行该脚本时,Google 会要求您审核并授予这些权限。请确保:

  1. 点击“审核权限”
  2. 选择您的Google帐户
  3. 如果看到警告,请点击“高级”
  4. 点击“转到[您的项目名称](不安全)”
  5. 点击“允许”授予必要的 Gmail 权限
  6. 打开您的 Claude Desktop 配置文件: ~/Library/Application Support/Claude/claude_desktop_config.json

您可以通过 Claude 桌面菜单找到它:

  1. 打开 Claude 桌面
  2. 在 Mac 菜单栏上单击 Claude
  3. 点击“设置”
  4. 点击“开发者”
  5. 将以下内容添加到您的配置中:
{ "tools": { "gmail": { "command": "npx", "args": ["-y", "@kazuph/mcp-gmail-gas"], "env": { "GAS_ENDPOINT": "YOUR_DEPLOYMENT_URL", "VALID_API_KEY": "YOUR_API_KEY" } } } }

注意:请将YOUR_DEPLOYMENT_URLYOUR_API_KEY替换为您的实际值。

对于开发人员

先决条件

  • Node.js 18+(通过brew install node安装)
  • Gmail 帐户
  • Google Apps脚本
  • Claude Desktop(从https://claude.ai/desktop安装)
  • tsx(通过npm install -g tsx

安装

git clone https://github.com/kazuph/mcp-gmail-gas.git cd mcp-gmail-gas npm install npm run build

开发配置

  1. 确保 Claude Desktop 已安装并正在运行。
  2. 如果还没有安装 tsx,请全局安装:
npm install -g tsx # or pnpm add -g tsx
  1. 修改位于以下位置的 Claude Desktop 配置: ~/Library/Application Support/Claude/claude_desktop_config.json

将以下内容添加到您的 MCP 客户端的配置中:

{ "tools": { "gmail": { "args": ["tsx", "/path/to/mcp-gmail-gas/index.ts"], "env": { "GAS_ENDPOINT": "YOUR_DEPLOYMENT_URL", "VALID_API_KEY": "YOUR_API_KEY" } } } }

可用工具

  • gmail_search_messages :使用 Gmail 搜索查询语法搜索电子邮件(例如“subject:Meeting newer_than:1d”)
  • gmail_get_message :获取特定电子邮件的完整内容和详细信息
  • gmail_download_attachment :从特定电子邮件下载附件

安全说明

请始终对您的VALID_API_KEY保密,切勿将其提交到版本控制中。此密钥有助于确保只有授权的客户端才能通过 Google Apps 脚本部署访问您的 Gmail。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

用于 Gmail 集成的模型上下文协议服务器。这允许 Claude Desktop(或任何 MCP 客户端)通过 Google Apps Script 与您的 Gmail 帐户进行交互。

  1. Quick Start (For Users)
    1. Prerequisites
    2. Configuration
  2. For Developers
    1. Prerequisites
    2. Installation
    3. Development Configuration
  3. Available Tools
    1. Security Note
      ID: 7awla69pjq