Email MCP Server
Provides tools for reading, searching, and sending emails via IMAP and SMTP, including capabilities to fetch unread messages, search by sender or subject, and manage Gmail folders.
Enables interaction with Google's Gmail service, allowing for automated email management, folder navigation, and message composition.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Email MCP ServerFind any unread emails from Jane regarding the project update"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gmail MCP Server

An MCP (Model Context Protocol) server for reading and sending Gmail via IMAP/SMTP. Exposes Gmail operations as MCP tools usable by Claude and other AI models, and includes a web UI for managing your inbox directly in the browser.
Features
List Emails: Retrieve emails from any Gmail folder
Get Unread Emails: Fetch only unread messages
Search Emails: Search with IMAP search criteria (by sender, date, subject, etc.)
Get Emails from Sender: Retrieve all emails from a specific sender
Get Emails by Subject: Search by subject text
Send Emails: Compose and send emails via SMTP
List Folders: View all available Gmail folders
Get Email Details: Fetch complete details of a specific email
Related MCP server: Email MCP Server
Prerequisites
Docker installed on your system
A Gmail account with IMAP enabled and an App Password generated
Quick Start
1. Enable Gmail IMAP and generate an App Password
Enable 2-Factor Authentication: https://myaccount.google.com/security
Generate an App Password for Mail: https://myaccount.google.com/apppasswords
Note your Gmail address and the generated app password — you'll need them below
2. Clone and configure
git clone https://github.com/chinmay4382/gmail-mcp-server.git
cd gmail-mcp-server
cp .env.example .envEdit .env with your credentials:
EMAIL_ADDRESS=your_email@gmail.com
EMAIL_PASSWORD=your_app_password
IMAP_SERVER=imap.gmail.com
SMTP_SERVER=smtp.gmail.com
ANTHROPIC_API_KEY=your_anthropic_api_key3. Run with Docker
Option A — Web UI (browser app):
docker compose up email-uiThen open http://localhost:8000 in your browser.
Option B — MCP server (for Claude Desktop / MCP clients):
docker compose up email-mcp-serverAvailable MCP Tools
list_emails
List emails from a folder.
Parameters:
max_results(int, default: 10): Number of emails to retrieveunread_only(bool, default: false): Only return unread emailsfolder(string, default: "INBOX"): Gmail folder name
get_unread_emails
Get unread emails from a folder.
Parameters:
max_results(int, default: 10): Number of unread emails to retrievefolder(string, default: "INBOX"): Gmail folder name
get_emails_from_sender
Get emails from a specific sender.
Parameters:
sender(string): Email address of the sendermax_results(int, default: 10): Number of emails to retrievefolder(string, default: "INBOX"): Gmail folder name
search_emails
Search emails using IMAP search criteria.
Parameters:
query(string): IMAP search querymax_results(int, default: 10): Maximum results to returnfolder(string, default: "INBOX"): Gmail folder to search
Query examples:
UNSEEN— Unread messagesFROM "user@example.com"— Emails from a specific senderSUBJECT "invoice"— Emails with "invoice" in subjectFLAGGED— Starred emailsSINCE "1-Jan-2024"— Emails since a dateUNSEEN FROM "user@example.com"— Combine criteria
get_emails_by_subject
Get emails by subject text.
Parameters:
subject(string): Subject text to search formax_results(int, default: 10): Maximum emails to retrievefolder(string, default: "INBOX"): Gmail folder to search
send_email
Send an email.
Parameters:
recipient(string): Recipient email addresssubject(string): Email subjectbody(string): Email body texthtml(bool, default: false): If true, body is treated as HTML
get_email_details
Get full details of a specific email.
Parameters:
message_id(string): Email ID from IMAP
list_folders
List all available Gmail folders.
Configuration
Variable | Required | Default | Description |
| Yes | — | Your Gmail address |
| Yes | — | Gmail App Password |
| No |
| IMAP server |
| No |
| SMTP server |
| Yes (Web UI) | — | API key for AI chat |
Troubleshooting
"Authentication failed"
Make sure you're using a Gmail App Password, not your regular Gmail password
Confirm IMAP is enabled in Gmail Settings → See all settings → Forwarding and POP/IMAP
"Connection refused"
Verify IMAP is enabled in your Gmail account settings
Check that your firewall doesn't block port 993 (IMAP) or 587 (SMTP)
"No module named 'mcp'"
Rebuild the Docker image:
docker compose build
File Structure
gmail-mcp-server/
├── gmail_mcp_server.py # MCP server entry point
├── gmail_client.py # IMAP/SMTP client wrapper
├── api_server.py # FastAPI REST server for the web UI
├── ui/
│ ├── index.html # Web UI markup
│ ├── app.js # Web UI JavaScript
│ └── styles.css # Web UI styles
├── Dockerfile # Docker build configuration
├── docker-compose.yml # Docker Compose services
├── requirements.txt # Python dependencies
├── .env.example # Example environment variables
└── mcp-config.json # MCP configuration exampleSecurity Notes
Never commit your
.envfile — it contains live credentialsAlways use a Gmail App Password, not your account password
The App Password grants access only to IMAP/SMTP, not your full Google account
License
MIT License
This server cannot be deployed
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Email inboxes for AI agents: send, receive, reply, search, and manage threaded email over MCP.
Your agent needs a mailbox of its own — to receive, thread, draft and send, with attachments, without borrowing your personal inbox or your company's SMTP. **What you can ask for** • "Create an inbox for this agent and tell me its address." • "Read the new messages in this thread and draft a reply." • "Send this message with the attachment and wait for the response." • "Search this inbox for everything from that domain." • "Show delivery metrics and the events on this inbox." **How to use it** Point any MCP client at https://mcp.aisa.one/mail/mcp and sign in with OAuth — there is no key to create or paste. 49 tools: create and delete inboxes, list and read messages, raw message bodies, attachments, threads, drafts and draft attachments, send and reply, message search, inbox events, metrics, and list entries — reads and writes. **Why this rather than the source** A real inbox an agent owns, rather than an SMTP credential it borrows from a human. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Find the contact elsewhere in the catalogue, then write to them from here — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/sales/mcp finds the person to write to.
Hosted email MCP for AI agents with inboxes, send/receive, memory, recovery, and credits.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA generic IMAP and SMTP MCP server that enables AI agents to interact with email accounts for reading, searching, and sending messages. It provides high-level tools for managing email workflows like daily digests and folder organization across any standard email provider.1MIT
- AlicenseAqualityDmaintenanceAn MCP server providing comprehensive email capabilities via IMAP and SMTP, enabling AI assistants to read, search, send, manage, schedule, and analyze emails across multiple accounts.491,160 npm108LGPL 3.0
- AlicenseBqualityBmaintenanceAn MCP server that exposes IMAP operations as tools for AI assistants, enabling email management including listing mailboxes, reading, searching, moving, flagging emails, and creating drafts.723 npmMIT
- AlicenseAqualityBmaintenanceAn MCP server providing comprehensive email capabilities via IMAP and SMTP, enabling AI assistants to read, search, send, manage, schedule, and analyze emails across multiple accounts.491,160 npmLGPL 3.0