mirror of
https://github.com/beilunyang/moemail.git
synced 2026-06-24 00:44:39 +08:00
Extract the HTTP client and config into a new @moemail/core package shared by the CLI and a new @moemail/mcp server, so both frontends talk to the same MoeMail API through one code path. - core: api client (now throws typed ConfigError/AuthError/PermissionError/ QuotaError instead of process.exit), config, msToIso, and a transport- agnostic pollForNewMessage helper. - cli: consume @moemail/core; route command errors through a shared fail() that preserves exit codes (config/auth = 2, else = 1). Bump to 1.0.0. - mcp: new stdio MCP server exposing 8 tools (create/list/read/wait/send/ delete); wait_for_email is bounded and returns a timeout status to retry. Configured via MOEMAIL_API_KEY / MOEMAIL_API_URL env. Release 1.0.0. Docs: - Fix packages/cli/README.md (config set, send --content not --body, full flag table). - Add MCP section to both root READMEs; complete the CLI command list (send, list, message-level delete). - SKILL.md: --json works before or after the subcommand. - Ignore bun.lock in package gitignores. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1.7 KiB
1.7 KiB
@moemail/mcp
MCP (Model Context Protocol) server for MoeMail — gives any MCP-capable agent (Claude Desktop, Cursor, Cline, …) native tools for temporary email: create a mailbox, wait for a verification email, read it, send, and clean up.
It shares the same HTTP client and config as @moemail/cli via @moemail/core, so
it talks to the exact same MoeMail API (authenticated with an X-API-Key).
Tools
| Tool | Description |
|---|---|
create_email |
Create a temporary mailbox (expiry: 1h / 24h / 3d / permanent) |
list_emails |
List mailboxes owned by the API key |
list_messages |
List messages in a mailbox |
read_message |
Read full text/HTML of a message |
wait_for_email |
Poll for a new message (bounded, max 90s; returns status: "timeout" to retry) |
send_email |
Send from a temporary address (needs send permission) |
delete_email |
Delete a mailbox |
delete_message |
Delete a single message |
Configuration
The server reads credentials from environment variables:
MOEMAIL_API_KEY(required) — your MoeMail API keyMOEMAIL_API_URL(optional) — defaults tohttps://moemail.app
Usage
Add to your MCP client config (e.g. Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"moemail": {
"command": "npx",
"args": ["-y", "@moemail/mcp"],
"env": {
"MOEMAIL_API_KEY": "mk_xxx",
"MOEMAIL_API_URL": "https://moemail.app"
}
}
}
}
Notes
- API keys authenticate against
/api/emails*and/api/config*— the same surface the CLI uses. - Authentication, permission, and rate-limit failures from the server are surfaced as descriptive tool errors rather than generic failures.