Skip to main content
Glama
yahoo-mail-mcp

yahoo-mail-mcp

by Auda29
README.md
<img src="assets/icon.svg" width="64" height="64" alt="">

# yahoo-mail-mcp

Read and organize Yahoo Mail, save drafts, and send replies over IMAP and SMTP. The same mail service powers a local stdio MCP server, an authenticated Streamable HTTP server, and the `yahoo-mail-cli` command.

## Set up a Yahoo App Password

1. Sign in to [Yahoo Account Security](https://login.yahoo.com/account/security).
2. Under **External connections**, choose **Create app password**, name the app, and generate the password. [Yahoo's app password instructions](https://my.help.yahoo.com/kb/account/access-yahoo-mail-third-party-apps-sln15241.html)
3. Copy [.env.example](.env.example) to `.env`. Set `YAHOO_EMAIL` to your full Yahoo address and `YAHOO_APP_PASSWORD` to the generated password. Keep `.env` private.

Yahoo controls app password availability by account. If the option is missing, see [Yahoo's app password help](https://my.help.yahoo.com/kb/account/access-yahoo-mail-third-party-apps-sln15241.html).

## Quickstart

Install Node.js 20.19 or later, then run these commands from the checkout.

```sh
npm install
npm run build
npm link
yahoo-mail-cli doctor
```

`npm link` adds both commands to the npm bin directory. You can also run `node dist/cli.js doctor` directly. `doctor` checks both IMAP and SMTP.

The server and CLI load `.env` from the working directory when the process environment supplies none of `YAHOO_EMAIL`, `YAHOO_APP_PASSWORD`, or `YAHOO_MCP_AUTH_TOKEN`. Use `--env-file /absolute/path/to/.env` or `YAHOO_ENV_FILE` to choose a file explicitly. Inherited environment values take precedence over values in the file.

The rolling `latest` release tracks `master` and provides a prebuilt npm tarball (`npm install -g ./yahoo-mail-mcp-<version>.tgz`), ZIP and tar.gz skill archives, and `SHA256SUMS.txt`. Version tags such as `v0.1.0` have their own GitHub releases. [Rolling GitHub release](https://github.com/Auda29/yahoo-mail-mcp/releases/tag/latest)

For Docker, pull `ghcr.io/auda29/yahoo-mail-mcp:latest` for the rolling `master` build on Linux amd64 or arm64. Versioned builds use tags such as `:0.1.0` or `:0.1.0-rc.1`. [Docker setup examples](examples/environments.md#remote-or-docker-streamable-http)

## Permission modes

Set `YAHOO_MAIL_MODE` or pass `--mode` to either executable.

| Mode | Allowed actions |
| --- | --- |
| `read-only` (default) | Verify credentials, list folders, search, read messages and threads, and download attachments. |
| `draft-only` | Everything above, plus draft messages and replies, mark messages, and move messages to folders outside Trash. |
| `full` | Everything above, plus send email or replies, move messages to Trash, and delete messages. |

Replies default to drafts in both write-capable modes. Deletion in full mode moves messages to Trash unless you explicitly request permanent deletion.

## MCP tools

Launch a stdio server with `node dist/index.js --env-file /absolute/path/to/.env`. Its stdout carries the MCP protocol. The `yahoo-mail://status` resource reports the mode, credential availability, server hosts, and size limits.

| Tool | Minimum mode | What it does |
| --- | --- | --- |
| `verify_connection` | `read-only` | Check IMAP and SMTP and report the active mode. |
| `list_folders` | `read-only` | List folder paths and optional counts. |
| `search_messages` | `read-only` | Search a folder and page through matching message summaries. |
| `get_message` | `read-only` | Get a message by folder and UID without marking it as read. |
| `get_thread` | `read-only` | Find related messages and optionally search Sent. |
| `download_attachment` | `read-only` | Save an attachment in the server's `YAHOO_ATTACHMENT_DIR` or set `returnBase64: true` to return its bytes. |
| `create_draft` | `draft-only` | Save a message in Drafts. |
| `mark_messages` | `draft-only` | Set read and starred flags. |
| `move_messages` | `draft-only` | Move UIDs to another folder. Moving to Trash requires full mode. |
| `reply_email` | `draft-only` | Draft a threaded reply. Full mode also permits `asDraft: false` for an immediate send. |
| `delete_messages` | `full` | Move messages to Trash or permanently expunge them with `permanent: true`. |
| `send_email` | `full` | Send a message immediately. |

Message reads and attachment downloads check the raw message size before retrieving the body. The limit is at least 15 MiB and grows with `YAHOO_MAX_ATTACHMENT_BYTES` to allow for Base64 encoding, line breaks, and 1 MiB of message overhead. Thread reads share the same limit across the selected message and its replies. They skip candidates that exceed the remaining budget.

## Streamable HTTP

Set `YAHOO_MCP_AUTH_TOKEN` to a random token with at least 16 characters, then run `node dist/index.js --transport http`. The default URL is `http://127.0.0.1:3333/mcp`. Clients supply `Authorization: Bearer <token>` on every MCP POST request. The server validates loopback Host headers, limits JSON requests to 4 MiB, and serves a credential-free `GET /health`.

The server accepts native clients that omit the `Origin` header. To allow browser requests, set `YAHOO_MCP_ALLOWED_ORIGINS` to a comma-separated list such as `https://client.example.org,http://localhost:5173`. With an empty list, a loopback listener accepts `http://localhost`, `http://127.0.0.1`, and `http://[::1]` with optional ports. On a non-loopback listener, including Docker's `0.0.0.0`, every supplied origin requires an explicit allowlist entry.

The stateless MCP endpoint accepts POST requests and browser OPTIONS preflights at `/mcp`. For remote access, put it behind an HTTPS reverse proxy or private tunnel so the token and mailbox data travel over an encrypted connection. HTTP attachment downloads use the server's `YAHOO_ATTACHMENT_DIR`. Use a dedicated private directory whose parent directories untrusted local processes cannot replace. Set `returnBase64: true` to return up to 2 MiB of encoded data.

## CLI and agent skill

```sh
yahoo-mail-cli folders --counts
yahoo-mail-cli search --folder INBOX --subject "Invoice" --unseen --limit 10
yahoo-mail-cli read 123 --folder INBOX
yahoo-mail-cli --mode draft-only reply 123 --text "Thanks for the update."
```

Commands write JSON to stdout and diagnostics to stderr. The local CLI accepts an explicit `attachment --out-dir DIR` override. Use `yahoo-mail-cli --help` or the [CLI command reference](skills/yahoo-mail/references/cli-fallback.md) for all options.

Copy the entire [`skills/yahoo-mail`](skills/yahoo-mail/) directory to a skill directory supported by your agent. The skill uses MCP first and falls back to the CLI. See the [environment setup examples](examples/environments.md) for client configurations, skill destinations, and Docker commands.

Created in [T3 Code](https://t3.codes).