Email Alert MCP Server
Allows reading, filtering, sending emails, and checking unread count through a Gmail account using SMTP/IMAP.
Click on "Install 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 Alert MCP ServerHow many unread emails do I have?"
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.
๐ง Email Alert MCP Server
An MCP (Model Context Protocol) server that exposes email operations as tools for AI agents. This allows Claude or other LLM-based agents to naturally read, filter, send emails, and check unread counts through the MCP protocol.
๐ฏ Features
Read Emails: Fetch recent emails from your inbox
Filter Emails: Search emails by sender, subject, or unread status
Send Emails: Compose and send emails through your account
Unread Count: Check how many unread messages you have
Works with Gmail: Uses SMTP/IMAP for universal compatibility
Related MCP server: Gmail MCP Server
๐ ๏ธ Prerequisites
Python 3.10 or higher
Gmail account with App Password enabled (see setup below)
Claude Desktop or any MCP-compatible client
๐ฆ Installation
1. Clone or Navigate to the Project
cd "C:\Users\tejas\OneDrive\Desktop\Email MCP server"2. Create Virtual Environment (if not already created)
python -m venv venv3. Activate Virtual Environment
Windows:
venv\Scripts\activateMac/Linux:
source venv/bin/activate4. Install Dependencies
pip install -r requirements.txt๐ Gmail Setup (App Password)
For security, Gmail requires an App Password instead of your regular password when using SMTP/IMAP.
Steps to Get Gmail App Password:
Go to your Google Account: https://myaccount.google.com/
Navigate to Security โ 2-Step Verification (enable if not already enabled)
Scroll down to App passwords
Click Select app โ Choose "Mail"
Click Select device โ Choose "Other" โ Name it "MCP Server"
Click Generate
Copy the 16-character password (e.g.,
abcd efgh ijkl mnop)Update your
.envfile with this App Password
Update .env File
Your .env file should look like this:
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-16-char-app-password
IMAP_SERVER=imap.gmail.com
SMTP_SERVER=smtp.gmail.com
IMAP_PORT=993
SMTP_PORT=587
OPENAI_API_KEY=your-openai-api-key (optional)๐ Running the Server
Test Locally
python server.pyThe server will start and listen for MCP protocol messages via stdin/stdout.
๐ง Connecting to Claude Desktop
To use this MCP server with Claude Desktop, you need to add it to your Claude Desktop configuration.
1. Find Your Claude Config File
Mac:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json2. Add MCP Server Configuration
Edit the config file and add (see claude_desktop_config.example.json for reference):
{
"mcpServers": {
"email-alert": {
"command": "python",
"args": [
"/absolute/path/to/your/project/server.py"
],
"env": {
"PYTHONPATH": "/absolute/path/to/your/project"
}
}
}
}Windows Example:
{
"mcpServers": {
"email-alert": {
"command": "C:\\Users\\YourName\\path\\to\\venv\\Scripts\\python.exe",
"args": [
"C:\\Users\\YourName\\path\\to\\Email MCP server\\server.py"
]
}
}
}Mac/Linux Example:
{
"mcpServers": {
"email-alert": {
"command": "/usr/bin/python3",
"args": [
"/home/username/Email-MCP-server/server.py"
]
}
}
}Note: Replace paths with your actual project location.
3. Restart Claude Desktop
Close and reopen Claude Desktop to load the new MCP server.
๐งช Testing the Tools
Once connected to Claude Desktop, you can test the email tools with natural language:
Examples:
Check Unread Emails:
"How many unread emails do I have?"Read Recent Emails:
"Show me my 5 most recent emails"Filter by Sender:
"Show me all emails from john@example.com"Search by Subject:
"Find emails with 'meeting' in the subject"Send an Email:
"Send an email to sangeeta@example.com with subject 'Meeting Reminder' and tell her about the 4 PM meeting"๐ง Available MCP Tools
1. read_emails
Read recent emails from inbox or specified folder.
Parameters:
count(number, optional): Number of emails to retrieve (default: 10)folder(string, optional): Email folder (default: "INBOX")
2. filter_emails
Search and filter emails by criteria.
Parameters:
sender(string, optional): Filter by sender email addresssubject(string, optional): Filter by subject (substring match)is_unread(boolean, optional): Filter by unread statusfolder(string, optional): Email folder (default: "INBOX")
3. send_email
Send an email to a recipient.
Parameters:
to(string, required): Recipient email addresssubject(string, required): Email subject linebody(string, required): Email body contentcc(string, optional): CC recipient email address
4. get_unread_count
Get count of unread emails.
Parameters:
folder(string, optional): Email folder (default: "INBOX")
๐๏ธ Project Structure
Email MCP server/
โโโ server.py # Main MCP server
โโโ email_client.py # Email operations (SMTP/IMAP)
โโโ requirements.txt # Python dependencies
โโโ .env # Environment variables (NOT in git)
โโโ .env.example # Example environment file
โโโ .gitignore # Git ignore rules
โโโ README.md # This file๐ Security Notes
โ ๏ธ Important:
Never commit
.envfile - It contains sensitive credentialsUse App Passwords - Never use your main Gmail password
Restrict Access - Keep your MCP server local and trusted
Monitor Usage - Review sent emails periodically
๐ค Pushing to GitHub
โ Safe to Push:
server.py- Your MCP server codeemail_client.py- Email operationstest_email.py- Testing scriptrequirements.txt- Dependencies listREADME.md- Documentation.env.example- Template (NO real credentials)claude_desktop_config.example.json- Config template.gitignore- Git ignore rules
โ NEVER Push:
.env- Contains your email password! (Auto-ignored)claude_desktop_config.json- Has your specific paths (Auto-ignored)venv/- Virtual environment folder (Auto-ignored)__pycache__/- Python cache (Auto-ignored)
The .gitignore file is already configured to protect sensitive files.
๐ Troubleshooting
"Authentication failed" Error
Make sure you're using a Gmail App Password, not your regular password
Verify 2-Step Verification is enabled on your Google account
Check that
EMAIL_USERandEMAIL_PASSin.envare correct
"Connection refused" Error
Check your internet connection
Verify firewall isn't blocking SMTP (port 587) or IMAP (port 993)
Ensure Gmail hasn't flagged your account for suspicious activity
"MCP server not showing in Claude Desktop"
Verify the path in
claude_desktop_config.jsonis correctCheck that Python is in your system PATH
Restart Claude Desktop after config changes
Check Claude Desktop logs for errors
๐ Learn More
๐ License
MIT License - Feel free to use and modify!
๐ค Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
Built with โค๏ธ using the Model Context Protocol
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tejaskumbhar288/email-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server