Gmail MCP Server 51aa3bad

MCP运维云端

提供方 enoch-sit

运维云端 stdio · 本地进程 OAuth 授权 社区 / 第三方 Claude DesktopClaude
查看接入方式

一个全面的Gmail模型上下文协议(MCP)服务器,提供17种工具,包括交互式CLI设置向导、基于浏览器的Web UI向导和完整的Docker支持。

一句话选型结论

按资料字段整理

Gmail MCP Server 51aa3bad 属于运维云端类 MCP 服务器,stdio · 本地进程,OAuth 授权,可直接接入 Claude Desktop、Claude,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类运维云端 传输方式stdio · 本地进程 鉴权OAuth 授权 部署方式本地部署
GitHub 星标 0 仓库热度,无公开仓库时显示未标注
工具数 17 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

运维云端
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量17暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

电子邮件管理TypeScript本地部署GmailAPI隐私保护Docker支持自动化工具

安装与配置

stdio · 本地进程 OAuth 授权
客户端在本机拉起子进程,数据不出本机
docker run -i \

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Docker,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后客户端会列出约 17 个工具,随便调一个只读工具确认能返回结果。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
云资源查询

查实例、存储、账单等云上资源状态。

部署与发布

把部署、重启、回滚这类操作接进对话。

监控与告警

拉取监控指标,异常时让模型帮你判断。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 资料标注 17 个工具,覆盖面较广,能满足多种调用。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude Desktop、Claude,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 使用前要准备好OAuth 授权对应的凭据,并按最小权限配置。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在运维云端场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop、Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Gmail MCP Server 51aa3bad当前 17 stdio · 本地进程 本地部署 有 2026-05-17
lobehub 未标注 stdio · 本地进程 本地部署 有 2026-04-11
TrendRadar 未标注 stdio · 本地进程 本地部署 有 2026-04-13
Ui Tars Desktop 8a825770 未标注 stdio · 本地进程 本地部署 有 2026-05-17
ruflo 未标注 stdio · 本地进程 本地部署 有 2026-04-13
FastGPT 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

运维云端
字段来自项目仓库与公开索引,中文说明由本站标注
提供方enoch-sit上游标注的维护方 enoch-sit
分类运维云端本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式OAuth 授权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · Docker本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

8.3 KB
来自项目仓库与上游目录的原文,未做删改

Gmail MCP Server

A comprehensive Model Context Protocol (MCP) server for Gmail, with 17 tools, an interactive CLI setup wizard, a browser-based Web UI wizard, and full Docker support.


Features

Tool Description
list_emails List emails from inbox or any label with optional query filter
read_email Read full email content (headers + decoded body)
search_emails Search using Gmail query syntax
list_attachments_with_safety List message attachments with policy-based safety checks
validate_attachment Validate one attachment against local file safety policy
download_attachment_safe Download attachment only if it passes safety policy checks
redact_text_local Redact sensitive text through local privacy pipeline
read_email_with_privacy Read one email with privacy-redacted subject/snippet/body
send_email Send plain-text or HTML emails
create_draft Create email drafts without sending
reply_to_email Reply to an email thread (preserves threading headers)
delete_email Trash or permanently delete an email
mark_as_read Mark email as read
mark_as_unread Mark email as unread
set_labels Add/remove labels on an email
get_labels List all Gmail labels with message counts
get_profile Get authenticated user profile info

Attachment safety policy defaults are defined in src/config/attachment-policy.json.
Privacy policy defaults are defined in src/config/privacy-policy.json.

Optional local privacy stack (vLLM + privacy orchestrator) can be started with Docker profiles:```bash
docker compose --profile privacy up --build


The privacy profile also enables optional persistent services:
- **Redis** (`redis:6379`) — token store for session-aware PII re-identification (future feature)
- **SQLite** (`audit.db`) — audit log of all PII detections and redactions for compliance

See ARCHITECTURE.md for database design details.

---

## Prerequisites

- **Node.js 20+** (for local setup)
- **Docker** (for containerised setup)
- A **Google Cloud project** with Gmail API enabled and an OAuth2 Client ID (Desktop app type)

### Google Cloud Setup (one-time)

1. Go to https://console.cloud.google.com/
2. Create or select a project
3. **APIs & Services → Library** → search "Gmail API" → **Enable**
4. **APIs & Services → Credentials → Create Credentials → OAuth 2.0 Client ID**
   - Application type: **Desktop app**
   - Add Authorized redirect URIs:
     - `http://localhost:3333/oauth/callback` ← for CLI wizard
     - `http://localhost:3000/oauth/callback` ← for Web UI wizard
5. Note your **Client ID** and **Client Secret** (or download `credentials.json`)

---

## Quick Start

### Option A — CLI Wizard (recommended for developers)```bash
# 1. Install dependencies and build
npm install
npm run build

# 2. Run the interactive CLI setup wizard
npm run setup:cli

# 3. Start the MCP server
npm start

The CLI wizard will:
- Guide you through credential input (file / paste JSON / manual entry)
- Let you choose Gmail permission scopes
- Open your browser for Google sign-in
- Automatically capture the OAuth callback and save tokens
- Validate the connection and print your email + next steps


Option B — Web UI Wizard (browser-based)```bash

1. Install dependencies and build

npm install
npm run build

2. Start the setup wizard UI

npm run setup:ui

3. Open http://localhost:3000 in your browser

Complete the 4-step wizard, then start the server:

npm start


The Web UI provides a guided 4-step flow:
1. Enter OAuth2 credentials
2. Select permission scopes
3. Click **Authorize Gmail Access** → completes Google sign-in flow
4. Success page with connection stats and next steps

---

### Option C — Manual `.env` (CI / Docker production)```bash
# Copy and fill in the template
cp .env.example .env
# Edit .env: set GMAIL_CLIENT_ID, GMAIL_CLIENT_SECRET, GMAIL_REFRESH_TOKEN

npm install
npm run build
npm start

Docker

Build the image```bash

docker build -t gmail-mcp-server .


### Run the MCP server (with env vars)```bash
# Copy .env.example → .env and fill in credentials
cp .env.example .env

docker compose up

Or pass credentials inline:```bash
docker run -i \
-e GMAIL_CLIENT_ID=your-client-id \
-e GMAIL_CLIENT_SECRET=your-secret \
-e GMAIL_REFRESH_TOKEN=your-refresh-token \
gmail-mcp-server


### Run the Web UI Setup Wizard via Docker```bash
docker compose -f docker-compose.setup.yml up

Then open http://localhost:3000 — credentials are written back to ./credentials/ on the host via volume mount.

Mount credentials files instead of env vars```bash

docker run -i \
-v ./credentials:/app/credentials:ro \
gmail-mcp-server


---

## Environment Variables

| Variable | Required | Description |
|---|---|---|
| `GMAIL_CLIENT_ID` | Yes* | Google OAuth2 Client ID |
| `GMAIL_CLIENT_SECRET` | Yes* | Google OAuth2 Client Secret |
| `GMAIL_REFRESH_TOKEN` | Yes* | Long-lived refresh token (from setup wizard) |
| `GMAIL_REDIRECT_URI` | No | Override redirect URI (default: `http://localhost:3000/oauth/callback`) |
| `PORT` | No | Web UI setup server port (default: `3000`) |

\* Required when using env vars. Alternatively, use `credentials/credentials.json` + `credentials/token.json` (written by the setup wizards).

---

## Add to MCP Client (e.g. Claude Desktop)

Edit your MCP client config:```json
{
  "mcpServers": {
    "gmail": {
      "command": "node",
      "args": ["/absolute/path/to/gmail-mcp-server/dist/index.js"]
    }
  }
}

Or use Docker:```json
{
"mcpServers": {
"gmail": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "GMAIL_CLIENT_ID=...",
"-e", "GMAIL_CLIENT_SECRET=...",
"-e", "GMAIL_REFRESH_TOKEN=...",
"gmail-mcp-server"
]
}
}
}


---

## Project Structure```
├── src/
│   ├── index.ts                  # MCP server entry point
│   ├── gmail/
│   │   ├── auth.ts               # OAuth2 credential + token management
│   │   └── client.ts             # Gmail API client factory (singleton)
│   ├── tools/
│   │   ├── emails.ts             # list_emails, read_email, search_emails
│   │   ├── compose.ts            # send_email, create_draft, reply_to_email
│   │   ├── manage.ts             # delete_email, mark_as_read/unread, set_labels
│   │   └── meta.ts               # get_labels, get_profile
│   └── setup/
│       ├── oauth.ts              # Shared OAuth2 URL generation + token exchange
│       ├── cli.ts                # Interactive CLI setup wizard
│       └── ui-server.ts          # Express Web UI setup server
├── public/
│   └── setup/
│       └── index.html            # 4-step Web UI wizard (vanilla HTML/CSS/JS)
├── credentials/                  # Runtime secrets — gitignored
│   └── .gitkeep
├── Dockerfile                    # Multi-stage build (build + runtime)
├── docker-compose.yml            # MCP server runtime
├── docker-compose.setup.yml      # Web UI setup wizard runtime
├── .env.example                  # Environment variable template
└── tsconfig.json

Security Notes

  • credentials/ is gitignored — never commit credentials.json or token.json
  • Credentials are not baked into the Docker image — always injected via env vars or volume mounts
  • The Web UI server and CLI callback server bind to 127.0.0.1 only (not publicly accessible)
  • The runtime Docker container runs as a non-root user (mcp)

Troubleshooting

Problem Solution
No Gmail credentials found Run npm run setup:cli or npm run setup:ui
No Gmail token found Re-run the setup wizard to re-authorize
invalid_client from Google Check that Client ID and Secret are correct
redirect_uri_mismatch Ensure the redirect URI is added in Google Cloud Console exactly as shown in the wizard
Port 3333 in use Kill the process using port 3333, or temporarily change CLI_PORT in src/setup/cli.ts
Token expired / invalid_grant Re-run the setup wizard to get a fresh refresh token
Docker: credentials not found Mount ./credentials:/app/credentials or set env vars

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
Gmail MCP Server 51aa3bad 怎么安装?

在客户端按下面的安装命令接入:docker run -i \。装完在客户端配置里引用同一个包或端点。

Gmail MCP Server 51aa3bad 怎么在 Claude Desktop、Claude 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Gmail MCP Server 51aa3bad 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Gmail MCP Server 51aa3bad 需要 API Key 吗?

资料标注需要OAuth 授权认证,使用前准备好对应凭据,并按最小权限配置。

Gmail MCP Server 51aa3bad 支持哪些客户端?

资料标注支持 Claude Desktop、Claude;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Gmail MCP Server 51aa3bad 能提供哪些能力?

资料显示约 17 个工具;能力标签包括 隐私保护、TypeScript、Claude、Docker支持。具体工具清单以官方文档为准。

Gmail MCP Server 51aa3bad 需要什么运行环境?

运行时为 Docker;属于本地进程,需要在本机装好运行环境。

Gmail MCP Server 51aa3bad 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。