Yahoo Mail MCP Server
A Model Context Protocol (MCP) server that enables LLMs to interact with Yahoo Mail. This server allows tools like Claude Desktop to read, search, and send emails directly through your Yahoo account using secure OAuth2 authentication.
Features (Planned)
- Read Emails: Fetch recent messages from your inbox.
- Search Emails: Search for specific messages using keywords, senders, or dates.
- Send Emails: Compose and send emails using Yahoo's SMTP servers.
Prerequisites
- Node.js: Version 20 or higher.
- Yahoo Developer App: You must create an app in the Yahoo Developer Portal to obtain OAuth2 credentials.
Creating a Yahoo App for OAuth2
- Go to the Yahoo Developer Portal.
- Create a new app.
- Set the API Permissions to include
Mail(Read and Write). - Set the Redirect URI to
https://localhost/callback(or your preferred URI). - Note your Client ID and Client Secret.
Setup
Clone the repository:
git clone <repository-url> cd yahoo-mail-mcpInstall dependencies:
npm installConfigure Environment Variables:Create a
.envfile in the root directory and add your Yahoo credentials:[email protected] YAHOO_CLIENT_ID=your-client-id YAHOO_CLIENT_SECRET=your-client-secret YAHOO_REDIRECT_URI=https://localhost/callback
Authentication
The first time you run the server, it will trigger an OAuth2 flow:
- A browser window will open asking you to log in to Yahoo.
- After authorizing, you will be redirected to your
REDIRECT_URI. - The page might fail to load, but that's fineβcopy the
codeparameter from the address bar. - Paste the code back into your terminal.
- The server will exchange the code for tokens and save them securely in
.tokens.json.
Usage
Development
To run the server in development mode with vite-node:
npm run dev
Build
To build the project for production:
npm run build
Integration with Claude Desktop
To use this server with Claude Desktop, add it to your claude_desktop_config.json:
{
"mcpServers": {
"yahoo-mail": {
"command": "node",
"args": ["/path/to/yahoo-mail-mcp/dist/index.js"]
}
}
}
Project Structure
src/index.ts: Entry point for the MCP server.src/server.ts: MCP server initialization and tool registration.src/auth/: OAuth2 flow and token management.src/tools/: Implementation of individual email tools.src/lib/: Helper libraries for IMAP and SMTP connections.
License
ISC