email-mcp
MCP server that sends outbound emails with automatic single-thread mapping in Gmail, enabling reply-style conversations within a single thread.
README
email-mcp
MCP server that turns the existing email_bridge.py workflow into one outbound email tool with automatic single-thread mapping.
Tool
send- Sends an email in the mapped Gmail thread.
- First call creates the thread.
- Later calls keep replying in that same thread.
Automatic Thread Mapping
Mapping key selection order:
- explicit
context_idargument CODEX_THREAD_IDenv varCODEX_SESSION_IDenv var- fallback: process-scoped key (
proc-<pid>-<random>)
Behavior:
- One mapping key -> one Gmail thread.
- Mapping is stored in
~/.codex/email-bridge/mcp-state/thread-map.json. - For non-Codex clients, pass
context_idin tool calls if you want separate Gmail threads per chat/session. - Optional override: set
EMAIL_MCP_PROCESS_SESSION_KEYto force a fixed fallback key.
Prerequisites
This server includes a local bridge script at bridge/email_bridge.py (used as fallback when direct SMTP mode is unavailable).
Configure the same mailbox env vars used by that script:
CODEX_EMAIL_ADDRESSCODEX_EMAIL_PASSWORDCODEX_EMAIL_TO(or passtoin tool calls)- optional SMTP/IMAP host/port vars from the email-bridge docs
Install
cd email-mcp
npm install
Add To Your App (MCP)
This is a local stdio MCP server.
- command:
node - args:
["/absolute/path/to/email-mcp/index.js"] - env: mailbox credentials + optional tuning flags
Recommended env vars:
CODEX_EMAIL_ADDRESSCODEX_EMAIL_PASSWORDCODEX_EMAIL_TOEMAIL_MCP_PREWARM=trueEMAIL_MCP_BRIDGE_SCRIPT=/absolute/path/to/email-mcp/bridge/email_bridge.pyEMAIL_MCP_PYTHON=python3
Codex (~/.codex/config.toml)
Add this in ~/.codex/config.toml:
[mcp_servers.email]
command = "node"
args = ["/absolute/path/to/email-mcp/index.js"]
tool_timeout_sec = 3600
[mcp_servers.email.env]
CODEX_EMAIL_ADDRESS = "your_email@gmail.com"
CODEX_EMAIL_PASSWORD = "your_app_password"
CODEX_EMAIL_TO = "recipient@example.com"
EMAIL_MCP_PREWARM = "true"
EMAIL_MCP_BRIDGE_SCRIPT = "/absolute/path/to/email-mcp/bridge/email_bridge.py"
EMAIL_MCP_PYTHON = "python3"
tool_timeout_sec can stay high if you want one shared default, but this send-only server does not need long blocking timeouts.
Cursor (~/.cursor/mcp.json or project .cursor/mcp.json)
Add:
{
"mcpServers": {
"email-mcp": {
"command": "node",
"args": ["/absolute/path/to/email-mcp/index.js"],
"env": {
"CODEX_EMAIL_ADDRESS": "your_email@gmail.com",
"CODEX_EMAIL_PASSWORD": "your_app_password",
"CODEX_EMAIL_TO": "recipient@example.com",
"EMAIL_MCP_PREWARM": "true"
}
}
}
}
Then restart Cursor.
Claude Code
Use MCP add with stdio:
claude mcp add --transport stdio \
--env CODEX_EMAIL_ADDRESS=your_email@gmail.com \
--env CODEX_EMAIL_PASSWORD=your_app_password \
--env CODEX_EMAIL_TO=recipient@example.com \
--env EMAIL_MCP_PREWARM=true \
email-mcp -- node /absolute/path/to/email-mcp/index.js
If your Claude client uses JSON mcpServers config instead, use the same block shown in the Cursor example.
Notes
- This MCP server only sends email.
- Incoming replies should be handled outside MCP by a watcher or intake flow, for example
bridge/email_bridge.py watch --once,bridge/email_bridge.py wait, or your higher-level helper scripts. - For stable Gmail threading, each mapped session uses one canonical subject base; later
subjectinputs are ignored for that session. senduses a pooled SMTP transport when SMTP env vars are present, which reduces repeated send overhead.- Startup prewarm is enabled by default (
EMAIL_MCP_PREWARM=true) and warms the SMTP path in the background.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。