mcp-email-search-server
Enables AI agents to search and retrieve emails from Yahoo accounts using keywords, folder, date range, and attachment filters.
README
Email Search MCP Server
A Model Context Protocol (MCP) server that enables AI agents to search and retrieve emails Yahoo accounts using keywords and time filters.
Features
- 🔍 Email Search: Yahoo Mail support with comprehensive search capabilities
- 📁 Folder Search: Search specific folders (INBOX, Sent, Drafts) or all folders
- 📅 Date range filtering: Search emails within specific time periods
- 🔑 Keyword search: Search in subject, body, and sender fields
- 📎 Attachment filtering: Find emails with or without attachments
- 🔐 Secure authentication: App Passwords for Yahoo
- 🛡️ Privacy-focused: All processing happens locally
Tools Available
search_emails
Search emails from Yahoo accounts using keywords and filters.
Parameters:
keywords(string): Keywords to search for in email content, subject, or senderprovider(string): Email provider to search - "yahoo"date_from(string, optional): Start date in YYYY-MM-DD formatdate_to(string, optional): End date in YYYY-MM-DD formatmax_results(int): Maximum results to return, 1-50 (default: 10)include_attachments(bool): Whether to include emails with attachments (default: false)folder(string): Email folder to search - "INBOX", "Sent", "Drafts", or "ALL" for all folders (default: "INBOX")
get_email_details
Get detailed content of a specific email by ID.
Parameters:
email_id(string): The unique ID of the email to retrieveprovider(string): Email provider - "yahoo"folder(string, optional): Email folder to search in (default: "INBOX")
list_email_folders
List all available email folders in your Yahoo account.
Returns: List of folder names that can be used in search operations.
check_email_config
Check the configuration status of email accounts and required environment variables.
Setup Instructions
1. Installation
git clone <repository-url>
cd mcp_email_search
pip install -e .
2. Yahoo Setup (App Password)
- Go to Yahoo Account Security
- Turn on 2-step verification if not already enabled
- Generate an app password:
- Click "Generate app password"
- Select "Other app" and name it (e.g., "MCP Email Search")
- Copy the generated password
3. Environment Configuration
Create a .env file in the project root:
cp .env.example .env
Edit .env with your credentials:
# Yahoo credentials
YAHOO_EMAIL=your_yahoo_email@yahoo.com
YAHOO_APP_PASSWORD=your_yahoo_app_password_here
5. Claude Desktop Configuration
Add to your Claude Desktop config file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"email-search": {
"command": "python",
"args": ["-m", "mcp_email_search.server"],
"cwd": "/absolute/path/to/mcp_email_search"
}
}
}
Alternatively, if you installed the package:
{
"mcpServers": {
"email-search": {
"command": "mcp-email-search"
}
}
}
Usage Examples
Once configured with Claude Desktop, you can use natural language commands:
Basic Search
- "Search for emails about 'meeting' from last week"
- "Find emails from john@company.com in December 2024"
- "Show me emails with attachments containing 'invoice'"
Folder-Specific Search
- "Search my Sent folder for emails about 'project alpha'"
- "Find emails in my Archive folder from this month"
- "Search my Drafts folder for unsent emails"
- "Look for emails across all my folders containing 'important'"
Folder Management
- "List my email folders"
- "What folders are available in my Yahoo account?"
Email Details
- "Get details of that email from Yahoo with ID xyz123"
- "Show me the full content of the email in my Sent folder with ID abc456"
Folder Search Features
Available Folder Options
- INBOX (default): Your main inbox folder
- Sent: Emails you've sent
- Drafts: Draft emails
- Archive: Archived emails
- Trash: Deleted emails
- Custom folders: Any custom folders you've created
- ALL: Search across all available folders
Folder Search Examples
# Search specific folder
search_emails(keywords="meeting", folder="Sent")
# Search all folders
search_emails(keywords="important", folder="ALL", max_results=20)
# List available folders
list_email_folders()
Performance Notes
- Searching specific folders is faster than searching ALL folders
- When searching ALL folders, results are limited per folder to maintain performance
- Most recent emails are prioritized in search results
Security & Privacy
- Local Processing: All email processing happens locally on your machine
- Secure Authentication: Uses industry-standard app passwords
- Read-Only Access: Only requests read permissions to your email accounts
- No Data Storage: Emails are not stored or cached by the server
- Minimal Permissions: Only accesses what's necessary for search functionality
Troubleshooting
Connection Issues
-
Run the configuration check:
python -m mcp_email_search.server # Then in Claude: "Check email configuration" -
Verify credentials are correctly set in
.env -
For Yahoo: Verify app password is correct and 2-factor authentication is enabled
Common Errors
- "Yahoo credentials not configured": Set YAHOO_EMAIL and YAHOO_APP_PASSWORD
- "Failed to connect to Yahoo": Check internet connection and credential validity
Development
# Install in development mode
pip install -e .[dev]
# Run the server directly
python -m mcp_email_search.server
# Test with MCP Inspector
npx @modelcontextprotocol/inspector python -m mcp_email_search.server
# Format code
black mcp_email_search/
isort mcp_email_search/
# Type checking
mypy mcp_email_search/
License
MIT License - see LICENSE file for details.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。