Email connectivity for AI agents — MCP server for Claude Code, Gemini CLI, Cursor, and more
- ✓Open-source license (Apache-2.0)
- ✓Actively maintained (<30d)
- ✓Clear description
claude mcp add email-agent-mcp -- npx -y email-agent-mcp{
"mcpServers": {
"email-agent-mcp": {
"command": "npx",
"args": ["-y", "email-agent-mcp"],
"env": {
"OPENCLAW_HOOKS_TOKEN": "<openclaw_hooks_token>"
}
}
}
}OPENCLAW_HOOKS_TOKENMCP Servers overview
# Agent Email
[](https://www.npmjs.com/package/email-agent-mcp)
[](https://npmjs.org/package/email-agent-mcp)
[](https://opensource.org/licenses/Apache-2.0)
[](https://github.com/UseJunior/email-agent-mcp/actions/workflows/ci.yml)
[](https://app.codecov.io/gh/UseJunior/email-agent-mcp)
[](https://github.com/UseJunior/email-agent-mcp/stargazers)
[](https://vitest.dev/)
[](./scripts/check-spec-coverage.mjs)
[](https://socket.dev/npm/package/email-agent-mcp)
[](https://www.npmjs.com/package/email-agent-mcp)
[English](./README.md) | [Español](./README.es.md) | [简体中文](./README.zh.md) | [Português (Brasil)](./README.pt-br.md) | [Deutsch](./README.de.md)
**email-agent-mcp** by [UseJunior](https://usejunior.com?utm_source=github&utm_medium=readme&utm_campaign=email-agent-mcp) -- local email connectivity for AI agents.
Agent Email is an open-source TypeScript MCP server that lets Claude Code, Cursor, Gemini CLI, OpenClaw, and other MCP-compatible runtimes read email, search threads, draft replies, label messages, change read state, move messages, and send mail through your own mailbox. Microsoft 365 / Outlook and Gmail are supported today. Security-first defaults mean agents cannot send email until you explicitly configure an allowlist.
## Quick Start
```bash
npx -y email-agent-mcp
```
The interactive setup wizard walks you through OAuth configuration and mailbox selection.
## What Works Today
- Microsoft 365 / Outlook mailbox access through MCP stdio
- `list_emails`, `read_email`, `search_emails`, and `get_thread`
- `create_draft`, `update_draft`, `send_draft`, `send_email`, and `reply_to_email`
- `label_email`, `mark_read`, and `move_to_folder`
- send allowlists, delete disabled by default, and sanitized errors
The current launch-prep pass was validated against a real Outlook mailbox for read, draft, send, categorize, move, and read-state flows.
## Why This Exists
AI agents need to read, reply to, and act on email, but email APIs are complex. OAuth flows, Graph delta queries, Gmail push subscriptions, HTML-to-markdown conversion, threading semantics -- each provider has its own quirks.
Agent Email wraps this complexity into deterministic MCP tools with security guardrails:
- send and receive allowlists that control who agents can contact
- delete disabled by default (requires explicit opt-in)
- error sanitization that strips API keys, file paths, and stack traces
- body file sandboxing with path traversal protection
## Use with Claude Code
Add to `~/.claude/settings.json` or your project `.claude/settings.json`:
```json
{
"mcpServers": {
"email-agent-mcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "email-agent-mcp"]
}
}
}
```
## Use with Cursor
```json
// .cursor/mcp.json
{
"mcpServers": {
"email-agent-mcp": {
"command": "npx",
"args": ["-y", "email-agent-mcp"]
}
}
}
```
## Use with Gemini CLI
```bash
gemini extensions install https://github.com/UseJunior/email-agent-mcp
```
## Use with OpenClaw
Add an `mcp` block to `~/.openclaw/openclaw.json`:
```json5
{
// ... existing config ...
mcp: {
servers: {
email: {
command: "npx",
args: ["tsx", "/path/to/email-agent-mcp/packages/email-mcp/src/serve-entry.ts"],
transport: "stdio"
}
}
}
}
```
> **Version note**: The `mcp` config key requires OpenClaw app >= 2026.3.24. If the CLI is older than the app, it may reject this key during validation even though the gateway accepts it. Update the CLI with `npm install openclaw@latest` in your NemoClaw directory, or restart the gateway directly with `launchctl kickstart -k gui/501/ai.openclaw.gateway`.
### Email watcher
The watcher polls your mailbox and sends wake signals to OpenClaw when new email arrives:
```bash
# Set the hooks token (must match hooks.token in openclaw.json)
export OPENCLAW_HOOKS_TOKEN="your-hooks-token"
# Start the watcher (defaults to http://localhost:18789/hooks/wake)
npm run dev:watch
```
The watcher requires at least one configured mailbox. Run `npx email-agent-mcp` or `npm run dev:configure` first to complete the OAuth flow.
## Launch Prep Smoke Test
Before recording a demo, run the live smoke script against a real mailbox and a safe send allowlist. The script exercises:
- `get_mailbox_status`
- `list_emails` + `read_email`
- `mark_read` unread -> read -> unread
- `label_email` on a safe inbox candidate
- `create_draft`
- draft-only `reply_to_email`
- optional `send_email`
Example:
```bash
EMAIL_AGENT_MCP_HOME=/tmp/email-agent-mcp-live \
AGENT_EMAIL_SEND_ALLOWLIST=/tmp/email-agent-mcp-live/send-allowlist.json \
npm run launch:prep:smoke -- --live-write --send-to beta@usejunior.com
```
Default safe-candidate selection looks for `notifications@github.com` in the inbox so you can rehearse the recording flow on a public-safe message instead of customer mail.
If your mailbox status name is not an email address, pass `--reply-sender <email>` or set `EMAIL_AGENT_MCP_REPLY_SENDER` so the script can find a self-sent message for the draft-reply check.
## Tool Reference
Agent Email exposes 26 MCP tools:
| Tool | Description | Type |
|------|-------------|------|
| `list_emails` | List recent emails with filtering | read |
| `read_email` | Read full email content as markdown | read |
| `search_emails` | Full-text search across mailboxes | read |
| `list_mailboxes` | Enumerate configured mailboxes, their status, and the default | read |
| `get_mailbox_status` | Connection status and warnings | read |
| `get_thread` | Full conversation context | read |
| `list_attachments` | List attachment metadata for an email | read |
| `download_attachment` | Download a file attachment as base64 | read |
| `send_email` | Send new email (allowlist-gated) | write |
| `reply_to_email` | Reply within thread (allowlist-gated on send) | write |
| `create_draft` | Create email draft | write |
| `update_draft` | Update draft content | write |
| `send_draft` | Send a saved draft | write |
| `list_scheduled_sends` | List pending provider-held scheduled sends (Microsoft 365) | read |
| `cancel_scheduled_send` | Cancel a pending scheduled send (Microsoft 365) | destructive |
| `label_email` | Apply labels/categories | write |
| `flag_email` | Flag/unflag emails | write |
| `mark_read` | Mark as read/unread | write |
| `move_to_folder` | Move between folders | write |
| `delete_email` | Delete (requires operator env + caller flag) | destructive |
| `list_folders` | Recursively list folders and computed paths (Microsoft 365) | read |
| `create_folder` | Create a custom child folder (Microsoft 365) | write |
| `delete_folder` | Delete a custom folder (requires operator env + caller flag); system folders are protected (Microsoft 365) | destructive |
| `list_inbox_rules` | List server-side inbox rules (Microsoft 365) | read |
| `create_inbox_rule` | Create a persistent safe inbox rule; forwarding, redirection, deletion, and discarding to Deleted Items are blocked (Microsoft 365) | write |
| `delete_inbox_rule` | Delete a server-side inbox rule (requires operator env + caller flag) (Microsoft 365) | destructive |
Folder and inbox-rule management requires Microsoft Graph `MailboxSettings.ReadWrite` consent. Existing Microsoft mailbox connections must re-consent after upgrading. Gmail uses labels rather than hierarchical folders/server-side Exchange rules, so these six tools return `NOT_SUPPORTED` for Gmail mailboxes.
### Scheduled send
`send_email` and `send_draft` accept `scheduled_send_at`, an ISO 8601 future
timestamp with an explicit timezone. Microsoft 365 holds the message
server-side, so delivery survives this process exiting. Use the returned
`messageId` with `cancel_scheduled_send` while it is pending, or inspect pending
items with `list_scheduled_sends`.
Microsoft Graph changes the message ID when the held draft moves to Sent Items,
so the returned ID is a pre-delivery management handle, not a permanent sent
message ID. Gmail's public API does not expose scheduled send; all scheduled
send surfaces return `NOT_SUPPORTED` for Gmail while immediate sends remain
unchanged.
### Outbound attachments
`send_email`, `reply_to_email`, `create_draft`, and `update_draft` accept an
optional `attachments` array. Each entry takes a sandboxed file `path` (read
relative to `EMAIL_MCP_SAFE_DIR`, default the process working directory) or
inline `base64`, plus optional `filename` / `mimeType` overrides:
```json
{
"to": "alice@example.com",
"subject": "Signed agreement",
"body": "Attached as requested.",
"attachments": [
{ "path": "./out/agreement.pdf" },
{ "base64": "iVBORw0KGgo...", "filename": "screenshot.png" }
]
}
```
Files are capped at 25MB each; Microsoft Graph additionally caps inline sends
at ~3MB total (larger files need an upload session — not yet supported). For
`update_draft`, omitting `attachments` preserves the draft's existing files;
passing an array (even empty) replaces them.
## Provider Support
| Provider | Status | Package |
|----------|--------|---------|
| Microsoft 365 (Graph API) | Fully supported | `@usejunior/provider-microsoft` |
| Gmail | Supported via interactive CLI OAuth (default client or What people ask about email-agent-mcp
What is UseJunior/email-agent-mcp?
+
UseJunior/email-agent-mcp is mcp servers for the Claude AI ecosystem. Email connectivity for AI agents — MCP server for Claude Code, Gemini CLI, Cursor, and more It has 3 GitHub stars and was last updated today.
How do I install email-agent-mcp?
+
You can install email-agent-mcp by cloning the repository (https://github.com/UseJunior/email-agent-mcp) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is UseJunior/email-agent-mcp safe to use?
+
Our security agent has analyzed UseJunior/email-agent-mcp and assigned a Trust Score of 79/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.
Who maintains UseJunior/email-agent-mcp?
+
UseJunior/email-agent-mcp is maintained by UseJunior. The last recorded GitHub activity is from today, with 9 open issues.
Are there alternatives to email-agent-mcp?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy email-agent-mcp to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/usejunior-email-agent-mcp)<a href="https://claudewave.com/repo/usejunior-email-agent-mcp"><img src="https://claudewave.com/api/badge/usejunior-email-agent-mcp" alt="Featured on ClaudeWave: UseJunior/email-agent-mcp" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
The fastest path to AI-powered full stack observability, even for lean teams.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!