ClaudePost
A Model Context Protocol (MCP) server that provides a seamless email management interface through Claude. This integration allows you to handle emails directly through natural language conversations with Claude, supporting features like searching, reading, and sending emails securely.
Features & Demo
Email Search and Reading
- ๐ง Search emails by date range and keywords
- ๐ View daily email statistics
- ๐ Read full email content with threading support
Email Composition and Sending
- โ๏ธ Send emails with CC recipients support
- ๐ Secure email handling with TLS
Prerequisites
- Python 3.12 or higher
- A Gmail account (or other email provider)
- If using Gmail:
- Two-factor authentication enabled
- App-specific password generated
- Claude Desktop application
Setup
-
Install uv:
1# MacOS/Linux 2curl -LsSf https://astral.sh/uv/install.sh | sh 3 4# Remember to restart your terminal after installation
-
Clone and set up the project:
1# Clone the repository 2git clone https://github.com/ZilongXue/claude-post.git 3cd claude-post 4 5# Create and activate virtual environment 6uv venv 7source .venv/bin/activate # On Windows: .venv\Scripts\activate 8 9# Install dependencies 10uv pip install -e .
-
Create a
.env
file in the project root:1[email protected] 2EMAIL_PASSWORD=your-app-specific-password 3IMAP_SERVER=imap.gmail.com 4SMTP_SERVER=smtp.gmail.com 5SMTP_PORT=587
-
Configure Claude Desktop:
First, make sure you have Claude for Desktop installed. You can install the latest version here. If you already have Claude for Desktop, make sure it's updated to the latest version.
Open your Claude Desktop configuration file:
1# MacOS 2~/Library/Application Support/Claude/claude_desktop_config.json 3 4# Create the file if it doesn't exist 5mkdir -p ~/Library/Application\ Support/Claude 6touch ~/Library/Application\ Support/Claude/claude_desktop_config.json
Add the following configuration:
1{ 2 "mcpServers": { 3 "email": { 4 "command": "/Users/username/.local/bin/uv", 5 "args": [ 6 "--directory", 7 "/path/to/claude-post/src/email_client", 8 "run", 9 "email-client" 10 ] 11 } 12 } 13}
Replace
/Users/username
and/path/to/claude-post
with your actual paths.After updating the configuration, restart Claude Desktop for the changes to take effect.
Running the Server
The server runs automatically through Claude Desktop:
- The server will start when Claude launches if configured correctly
- No manual server management needed
- Server stops when Claude is closed
Usage Through Claude
You can interact with your emails using natural language commands. Here are some examples:
Search Emails
- "Show me emails from last week"
- "Find emails with subject containing 'meeting'"
- "Search for emails from [email protected] between 2024-01-01 and 2024-01-07"
- "Search sent emails from last month"
Read Email Content
- "Show me the content of email #12345"
- "What's the full message of the last email from HR?"
Email Statistics
- "How many emails did I receive today?"
- "Show me daily email counts for the past week"
Send Emails
- "I want to send an email to [email protected]"
- "Send a meeting confirmation to [email protected]"
Note: For security reasons, Claude will always show you the email details for confirmation before actually sending.
Project Structure
claude-post/
โโโ pyproject.toml
โโโ README.md
โโโ LICENSE
โโโ .env # Not included in repo
โโโ .python-version # Python version specification
โโโ src/
โโโ email_client/
โโโ __init__.py
โโโ __main__.py
โโโ server.py # Main implementation
Security Notes
- Use app-specific passwords instead of your main account password
- For Gmail users:
- Enable 2-Step Verification in your Google Account
- Generate an App Password for this application
- Use the App Password in your
.env
file
Logging
The application logs detailed information to email_client.log
. Check this file for debugging information and error messages.
License
This project is licensed under the MIT License - see the LICENSE file for details.