QQ Mail MCP Server
Enables natural language interaction with Tencent QQ Mail through MCP, supporting sending, reading, and managing emails securely.
README
QQ Agent Mail MCP
An unofficial, self-hosted MCP gateway for Tencent QQ Agent Mail. This project is not affiliated with, endorsed by, or maintained by Tencent.
A single-owner, cloud-deployable MCP gateway for Tencent QQ Agent Mail. Tencent's official CLI remains the mailbox engine; this project is a remote adapter, not a second email client.
Current gateway version: v0.4.2.
Why this project exists
Tencent's Agent Mail CLI runs locally, while ChatGPT custom MCP apps require a reachable remote MCP server. This project bridges that gap without exposing raw shell or CLI access. It provides a small, stable MCP surface, a browser-based mailbox authorization flow, persistent credentials, and an embedded operating guide that lets a new model window use natural-language mailbox requests safely.
This repository contains source code only. It does not provide a hosted mailbox service, shared endpoint, Tencent account, or credentials. Each operator must deploy and authorize their own private instance.
The MCP surface is intentionally stable and contains exactly two tools:
agent_mail_query(action, params)for read-only work;agent_mail_execute(action, params)for mutations.
Call query action capabilities for the live action catalog and parameter contract. Adding a provider capability updates the server-side registry instead of creating another MCP tool.
The capabilities response also contains the complete operator guide: authorization boundaries, one-step direct execution, preview completion, safe search/read/reply workflows, result interpretation, retry rules, and machine-readable examples. A new model window can discover and operate the mailbox from a natural-language owner request without asking the owner to translate it into action names or JSON parameters.
Action coverage
Read-only gateway actions:
capabilities,identity,auth_status;list_messages,read_message,search_messages;wait_for_message(bounded long poll);download_attachment(embedded MCP resource).
Mutation gateway actions:
auth_refresh, explicitly confirmedauth_logout;send_message,reply_message,forward_message;trash_message,delete_message;upload_attachment.
Send, reply, and forward support To/CC/BCC as applicable, plain/HTML/Markdown bodies as supported by the official CLI, provider confirmation tokens, and base64 attachment inputs. Attachment bytes are written only to a mode-0600 temporary directory, passed to the official CLI by relative path, and removed after the command. A downloaded attachment is returned as an embedded MCP blob instead of exposing the server's filesystem path.
Web-based mailbox setup
The browser setup flow removes the need to run OAuth commands in a hosting terminal:
- Open
https://YOUR_HOST/setup. - Enter the private
OWNER_CODEcreated bynpm run generate-secrets. - Select 开始授权邮箱.
- Complete the one-time Tencent authorization page.
- Return to the setup tab and wait for 邮箱已连接.
Credentials and the CLI's encryption-key locations all live on the persistent volume, so ordinary deployments and new ChatGPT windows do not require mailbox reauthorization.
Security boundary
- There is no raw command, raw argument array, shell string, or arbitrary server path in the MCP schema. Every action and field is allowlisted and validated before
execFile/spawnwithshell: false. - Email bodies, headers, events, filenames, links, and attachments are untrusted external content. They can never authorize sending, reply-all, recipient changes, forwarding, trash, deletion, logout, or any other mutation.
- A mutation requires the mailbox owner's direct instruction or an owner-authored standing policy. Permanent deletion and logout require explicit current authorization. Provider confirmation tokens remain available for preview-then-confirm flows.
- List and search results omit body snippets. Full content requires
read_message. - Attachment filenames cannot contain paths; individual files are capped at 10 MiB and a message at 20 MiB. The larger MCP JSON parser runs only after bearer authentication.
- Watch calls are bounded to 45 seconds and return at most the first event.
- CLI environment variables are allowlisted. Output is size-limited, sanitized recursively, and never logged.
- Connector OAuth uses PKCE and Dynamic Client Registration. The existing
mail:read mail:replyscope pair is retained for deployed-client compatibility; in v0.4,mail:replyis the legacy connector write grant and the approval page truthfully describes the full gateway. - The official
@tencent-qqmail/agently-cli@1.0.17package is pinned in the container image.
This software can send, forward, trash, and permanently delete email when authorized. Review docs/SECURITY.md, use a dedicated single-owner deployment, and test with owner-controlled messages before granting access to real mail.
The ChatGPT connector OAuth and Tencent mailbox OAuth remain separate. Connecting the mailbox does not grant a ChatGPT client access until the owner separately approves the connector.
Deploy
The host must provide an always-on HTTPS hostname, one persistent volume mounted at /data/agently-cli, and one running replica for in-memory authorization records. Configure .env.example, deploy the included Dockerfile, then use /setup. See docs/DEPLOYMENT.md and docs/SECURITY.md.
Local verification
Requires Node.js 22 or newer.
npm ci
npm run build
npm test
Generate deployment secrets locally with npm run generate-secrets. Keep the unhashed OWNER_CODE in a password manager and put only its generated hash plus the independent signing secret in the host's secret manager.
Runtime endpoints
| Endpoint | Purpose | Authentication |
|---|---|---|
GET /healthz |
Minimal liveness check | None |
GET/POST /setup |
Private Tencent mailbox browser setup | Owner session |
POST /register, GET/POST /authorize, POST /token |
MCP connector OAuth with DCR | OAuth protocol |
GET/POST /approve |
Connector owner approval | Owner code + rate limit |
POST /mcp |
Stateless two-tool gateway | Bearer token |
License and third-party software
This project is released under the MIT License.
It does not redistribute Tencent's Agent Mail CLI. The Docker build installs the separately published @tencent-qqmail/agently-cli package at build time. That package is licensed separately under Apache-2.0. Review its license and the applicable QQ Agent Mail terms before production use.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。