How It Works
Architecture
email-connector is an MCP (Model Context Protocol) server that bridges Claude AI to your email inbox via IMAP and SMTP. MCP is Anthropic’s open standard for connecting AI models to external tools and data sources.Data Flow
Reading email
Sending email
Security Model
Email credentials go through multiple layers of protection:- App passwords only — your main account password is never used or requested
- AES-256-GCM encryption at rest — credentials are encrypted before storage
- Decrypted in memory only — credentials exist in plaintext only during an active IMAP/SMTP session
- Never logged — credentials never appear in application logs or error output
- Session-isolated — each tool call opens and closes its own IMAP connection
MCP Transport
email-connector uses Streamable HTTP — the current recommended MCP transport per Anthropic’s specification. SSE-only transport is deprecated.| Endpoint | Method | Purpose |
|---|---|---|
/mcp | POST | Initialize or continue an MCP session |
/mcp | GET | SSE upgrade for streaming responses |
/mcp | DELETE | Close a session |
/oauth/* | GET/POST | OAuth 2.0 authorization server |
/health | GET | Public health check |
Available Tools
| Tool | Description |
|---|---|
get_recent_emails | Fetch recent emails from any folder |
search_emails | Search by sender, subject, date, or keyword |
get_email | Get full content of a specific email |
list_mailboxes | List all mailbox folders |
list_providers | List supported email providers |
draft_email | Compose a draft without sending |
send_email | Send an email via SMTP |
mark_as_read | Mark a message as read |
move_email | Move a message to another folder |
Session Management
MCP sessions are identified by theMcp-Session-Id header. Sessions time out after 30 minutes of inactivity. When a session expires, Claude transparently creates a new one on the next request.
The session store is in-memory by default. For multi-process deployments, replace the Map with Redis (see Self-Hosting).