Email Agent
Turns Claude Desktop into an email assistant that connects to Gmail, reads your inbox, classifies emails, drafts replies in your voice, and sends them with your approval.
README
Email Agent
An MCP server that turns Claude Desktop into your email assistant. It connects to Gmail, reads your inbox, classifies emails, drafts replies in your voice, and sends them with your approval.
What it does
- Fetches your unread emails and sorts them into groups: spam, notifications, simple replies, drafts, and escalations
- Auto-trashes spam and auto-archives notifications from senders you configure
- Drafts replies in your writing style using a customizable knowledge base
- Sends approved replies and archives handled emails
- All actions require your approval before anything is sent
Prerequisites
- Python 3.10+ (check with
python3 --version) - A Gmail account
- Claude Desktop (download here)
Setup
1. Set up Google Cloud credentials
This is the longest step, but you only do it once.
- Go to Google Cloud Console
- Click Select a project at the top, then New Project. Name it anything (e.g. "Email Agent") and click Create
- Make sure your new project is selected, then:
- Go to APIs & Services > Library in the left sidebar
- Search for Gmail API and click Enable
- Set up the consent screen:
- Go to APIs & Services > OAuth consent screen
- Choose External and click Create
- Fill in "App name" (e.g. "Email Agent") and your email for support/developer contact
- Click through the Scopes page (no changes needed)
- On the Test users page, click Add users and add your Gmail address
- Click Save and Continue
- Create your credentials:
- Go to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Choose Desktop app as the application type
- Click Create, then Download JSON
- Save the file somewhere you can find it (your Downloads folder is fine)
2. Run the setup wizard
cd email-agent
python3 setup_wizard.py
The wizard will:
- Install Python dependencies
- Ask you to paste the path to the JSON file you downloaded
- Open your browser to sign in with Google
- Ask for your name, sign-off style, and spam/notification senders
- Print the config snippet for Claude Desktop
3. Add to Claude Desktop
Copy the config snippet the wizard prints and add it to your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
The snippet looks like this (the wizard fills in the correct paths for you):
{
"mcpServers": {
"email-agent": {
"command": "/path/to/python3",
"args": ["/path/to/mcp_server.py"]
}
}
}
If you already have other MCP servers, just add the "email-agent" entry inside your existing "mcpServers" object.
4. Use it
Restart Claude Desktop, then say:
- "Process my emails" -- full workflow: fetch, classify, draft replies, send
- "Check my inbox" -- just see what's unread
- "Send an email to ..." -- compose and send a new email
Configuration
Edit ~/.email-agent/config.yaml to customize:
| Setting | What it does |
|---|---|
auto_trash_senders |
Emails from these senders/domains go straight to trash |
auto_archive_senders |
Emails from these senders/domains get archived silently |
cc_rules |
Auto-CC someone when certain keywords appear in an email |
escalation_keywords |
Emails with these keywords are shown to you instead of auto-drafted |
category_keywords |
Custom categories for organizing draft replies |
For auto_trash_senders and auto_archive_senders, you can use full email addresses (noreply@linkedin.com) or just domains (linkedin.com).
Knowledge Base
Put .md files in ~/.email-agent/knowledge_base/ to teach the agent your style and context:
| File | Purpose |
|---|---|
tone.md |
How you write (included by default) |
corrections.md |
Learned corrections from edited drafts (auto-populated) |
faq.md |
Common questions and your preferred answers |
templates.md |
Reply templates by category |
Troubleshooting
"Run setup_wizard.py first" -- You need to run the setup wizard before the MCP server will work. It creates the credentials and config files.
OAuth error / "Access blocked" -- Make sure you added your Gmail address as a test user in the Google Cloud Console (step 1.4 above).
"Python 3.10+ required" -- Your system Python is too old. Install a newer version via python.org, Homebrew (brew install python), or conda.
MCP server not showing up in Claude Desktop -- Make sure the command path in your config points to the Python that has the dependencies installed. The setup wizard prints the correct path for you.
Token expired -- Restart the MCP server (restart Claude Desktop). If that doesn't work, delete ~/.email-agent/token.json and run the wizard again.
Requirements
- Python 3.10+
- A Gmail account
- Claude Desktop
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。