MCP Email Server
Allows reading, sending, and managing emails via Gmail's POP3 and SMTP servers using app passwords for secure access.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Email Server
A Model Context Protocol (MCP) server for email operations (POP3/SMTP with TLS). Allows an LLM like Claude to read, send, and manage emails.
Quick Start
Option 1: uvx (recommended)
No clone, no install — runs directly from GitHub:
uvx git+https://github.com/ptbsare/email-mcp-server \
--email-user you@example.com \
--email-pass yourpassword \
--pop3-server pop.example.com \
--smtp-server smtp.example.comFirst run caches the package; subsequent launches are instant.
Option 2: Clone + run locally
git clone https://github.com/ptbsare/email-mcp-server
cd email-mcp-server
uv pip install -e .
uv run main.py --email-user you@example.com --email-pass yourpassword \
--pop3-server pop.example.com --smtp-server smtp.example.comOption 3: .env file
Create a .env file in the working directory:
EMAIL_USER=you@example.com
EMAIL_PASS=yourpassword
POP3_SERVER=pop.example.com
SMTP_SERVER=smtp.example.comThen simply:
uvx git+https://github.com/ptbsare/email-mcp-server
# or
uv run main.pyRelated MCP server: mcp-imap
Configuration
Config Priority (highest → lowest)
CLI arguments — override everything
Environment variables — override
.envfile.envfile — fallback defaults
All Config Options
CLI Argument | Env Variable | Required | Default | Description |
|
| ✅ | — | Email address |
|
| ✅ | — | Email password / app password |
|
| ✅ | — | POP3 server hostname |
|
|
| POP3 SSL port | |
|
| ✅ | — | SMTP server hostname |
|
|
| SMTP port (auto | |
|
|
| Use SMTP_SSL (port 465) instead of STARTTLS | |
|
|
| Logging: |
Examples: Mixing Config Sources
# CLI args only (no .env needed):
uv run main.py --email-user me@gmail.com --email-pass xxx \
--pop3-server pop.gmail.com --smtp-server smtp.gmail.com
# .env file for credentials, CLI for servers:
# .env: EMAIL_USER=me@gmail.com / EMAIL_PASS=xxx
uv run main.py --pop3-server pop.gmail.com --smtp-server smtp.gmail.com
# Env vars override .env:
EMAIL_USER=other@gmail.com uv run main.py --pop3-server pop.gmail.com ...Using with Claude Desktop
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
With env vars (in config):
{
"mcpServers": {
"email-mcp-server": {
"command": "uvx",
"args": ["git+https://github.com/ptbsare/email-mcp-server"],
"env": {
"EMAIL_USER": "your-email@example.com",
"EMAIL_PASS": "your-app-password",
"POP3_SERVER": "pop.example.com",
"SMTP_SERVER": "smtp.example.com"
}
}
}
}With CLI args (in config):
{
"mcpServers": {
"email-mcp-server": {
"command": "uvx",
"args": [
"git+https://github.com/ptbsare/email-mcp-server",
"--email-user", "your-email@example.com",
"--email-pass", "your-app-password",
"--pop3-server", "pop.example.com",
"--smtp-server", "smtp.example.com"
]
}
}
}Tip: The
envsection and CLI args can be used together. CLI args always take priority.
Features
Poll Emails: List inbox email headers with configurable limit (
pollEmails)Fetch Full Emails: Get complete email content by ID, with automatic attachment extraction (
getEmailsById)Delete Emails: Remove emails by ID (
deleteEmailsById)Send Emails: Send plain text (
sendTextEmail) or HTML (sendHtmlEmail) emails with optional file attachmentsSecure Connections: POP3 over SSL (port 995), SMTP with STARTTLS (port 587) or direct SSL (port 465)
Attachment Support: Send local files as attachments; received attachments are auto-saved to
/tmp/email_mcp_attachments/<email_id>/
Tools
pollEmails(limit=50)
List recent email headers (no body). Returns newest first. Use this first to get IDs for getEmailsById/deleteEmailsById.
Parameter | Type | Default | Description |
|
|
| Max emails to return, newest first |
Returns: [{"id": int, "Subject": str, "From": str, "Date": str, "Message-ID": str}]
pollEmails(limit=10) # 10 most recent
pollEmails() # default 50getEmailsById(ids)
Fetch full email content (headers + body) by IDs from pollEmails. Attachments auto-saved to /tmp/email_mcp_attachments/<id>/.
Parameter | Type | Required | Description |
|
| ✅ | Email IDs from |
Returns: [{"id": int, "headers": dict, "body": str, "attachments": [{"filename": str, "local_path": str, "size": int, "content_type": str}]}]
getEmailsById(ids=[1, 3, 5])deleteEmailsById(ids)
Permanently delete emails by IDs. Irreversible. Call pollEmails first.
Parameter | Type | Required | Description |
|
| ✅ | Email IDs from |
Returns: {"deleted": [int], "failed": {"id": "error msg"}}
deleteEmailsById(ids=[1, 2, 3])sendTextEmail(toAddresses, subject, body, attachments=None)
Send a plain text email. Attachments: list of local file paths like ["/tmp/file.pdf"].
Parameter | Type | Required | Default | Description |
|
| ✅ | — | Recipients. Example: |
|
| ✅ | — | Subject line |
|
| ✅ | — | Plain text body |
|
|
| Local file paths. Example: |
Returns: {"status": "success"}
sendTextEmail(
toAddresses=["alice@example.com"],
subject="Hello",
body="Hi Alice!",
attachments=["/tmp/report.pdf"]
)sendHtmlEmail(toAddresses, subject, body, attachments=None)
Send an HTML email. Attachments: list of local file paths like ["/tmp/file.png"].
Parameter | Type | Required | Default | Description |
|
| ✅ | — | Recipients. Example: |
|
| ✅ | — | Subject line |
|
| ✅ | — | HTML content. Example: |
|
|
| Local file paths. Example: |
Returns: {"status": "success"}
sendHtmlEmail(
toAddresses=["alice@example.com"],
subject="Report",
body="<h1>Report</h1><p>Sales up <b>20%</b>.</p>",
attachments=["/tmp/chart.png"]
)Development Setup
Prerequisites
Python 3.12+
Steps
git clone https://github.com/ptbsare/email-mcp-server
cd email-mcp-server
uv pip install -e .
uv run main.py --helpImportant Notes
App Passwords: If your email provider uses 2FA, generate an App Password for
EMAIL_PASSEmail IDs: POP3 IDs are session-specific. Call
pollEmails()beforegetEmailsById()ordeleteEmailsById()Attachment Storage: Received attachments are saved to
/tmp/email_mcp_attachments/<email_id>/Security: Never commit your
.envfile — it's already in.gitignoreConfig Priority: CLI args > environment variables >
.envfile
Project Structure
email-mcp-server/
├── main.py # MCP server entry point (all logic)
├── pyproject.toml # Package config & dependencies
├── uv.lock # Dependency lock file
├── .env # Credentials (create your own)
├── .gitignore
└── README.mdLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Email inboxes for AI agents: read, search, reply, send, bulk send and read attachments.
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables AI agents to send and receive emails via POP3 and SMTP, with tools for polling, reading, deleting, and sending emails.51-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with email accounts via IMAP and SMTP, supporting mailbox listing, email search, retrieval, sending, and management.MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to send, read, and manage emails via SMTP and IMAP, with support for attachments, threads, and mailbox organization.1627 npm1MIT
- FlicenseBqualityCmaintenanceEnables AI models to send, receive, search, and manage emails via SMTP/IMAP, including support for attachments, contacts, and advanced search.18-