OWUI-Email-MCP
Enables drafting emails via Model Context Protocol in OpenWebUI using templates, generating short links for editable drafts without sending any emails.
README
OWUI-Email-MCP
Email drafts via MCP for OpenWebUI. Template-driven, plain text or HTML, nothing sent.
Email drafting for OpenWebUI over the Model Context Protocol. The model fills
a predefined template; the server stores the finished draft behind a short
link. With HTML_FORMAT=true the link downloads a ready-to-open .eml
file (HTML), otherwise it redirects straight to a mailto: draft (plain
text) — either way an editable draft in the user's own mail client. Nothing is
sent automatically, and the model never has to stream the whole email token
by token.
✨ Highlights
- Fast by design — the model outputs a ~10-token short link; the draft is built server-side and only lives behind that link
- Two formats, one switch —
HTML_FORMAT=true:.emldownload markedX-Unsent: 1that opens as an editable HTML draft (images, inline styles);HTML_FORMAT=false: instantmailto:redirect (plain text) - One click to the draft — either way the draft opens in the user's default mail client; links expire after a TTL
- Nothing is sent — the user's own mail client opens the draft; the user stays in control
- Multi-user by design — JWT auth against OpenWebUI's secret, per-user rate limiting
- Stateless-ish — drafts live in a TTL cache in memory (powered by cachetools); no database, no files
🚀 Setup
uv sync
cp .env.example .env
.env.example documents every setting; the ones you must set:
JWT_SECRET→ OpenWebUI'sWEBUI_SECRET_KEYPUBLIC_BASE_URL→ URL of this server as reachable from the user's browser (it is embedded in the short links), e.g.http://192.168.1.10:8000HTML_FORMAT→truefor HTML drafts via.emldownload,falsefor plain text via instantmailto:redirect
🏃 Run
uv run python main.py
The server listens on 0.0.0.0:8000:
| Endpoint | Auth | Purpose |
|---|---|---|
/mcp |
OpenWebUI JWT | MCP (streamable HTTP) for OpenWebUI's External Tools |
/m/{id} |
none | the draft: mailto: redirect (txt) or .eml download (html) |
/static/* |
none | static assets (e.g. the logo referenced by the email templates) |
In OpenWebUI: Admin Settings → External Tools → add server of type
MCP (Streamable HTTP) with URL http://<host>:8000/mcp and auth
Session. The model gets list_email_templates and compose_email and
is instructed to reply with the short link only.
🐳 Docker (optional)
Prebuilt images are published to ghcr.io on pushes to main (latest)
and on version tags (X.Y.Z):
docker run -d -p 8000:8000 \
--restart unless-stopped \
--env-file .env \
-v ./templates:/app/templates \
--name owui-email-mcp \
ghcr.io/th3r3alduk3/owui-email-mcp:latest
Or build the image locally: docker build -t owui-email-mcp . — the volume
mount keeps the templates editable without rebuilding the image.
🛠️ Tools
| Tool | Description |
|---|---|
compose_email |
fill a template, store the draft, return the short link |
list_email_templates |
list templates (name → template text) |
📝 Templates
Templates live in templates/ (name = filename without suffix) and
are read fresh on every call — edit them without restarting. HTML_FORMAT
selects which files are used:
HTML_FORMAT=false—*.txtfiles: first line = subject, blank line, then the body; the short link redirects to amailto:draftHTML_FORMAT=true—*.htmlfiles: the<title>is the subject; the short link downloads an.emldraft. Use inline styles only (a<style>block's CSS braces would clash withstr.format); images referenced assrc="/static/..."are rewritten to absolutePUBLIC_BASE_URLlinks so mail clients can load them{placeholders}are allowed anywhere and are filled viastr.formatwith the values from the compose call; literal braces are written{{and}}
⚠️ Limits
- Drafts are held in memory only and expire after
LINK_TTL(default 24 h); at mostMAX_STORED_EMAILSare kept. A restart clears all links. - The draft link is unauthenticated by design (the browser opening it has no OpenWebUI session): anyone with the unguessable link can read the draft until it expires. Don't put secrets in templates.
- MCP requests are rate-limited per user (
RATE_LIMIT_RPS/RATE_LIMIT_BURST), keyed on the JWT'sidclaim; tool errors never leak internals (mask_error_details). - The server speaks plain HTTP — put it behind a reverse proxy for TLS.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。