emails-mcp-server (0.1.0.dev3+g4b32399)

Published 2026-04-17 15:18:38 +08:00 by luofengyuan

Installation

pip install --index-url https://git.599520.xyz/api/packages/luofengyuan/pypi/simple/ --extra-index-url https://pypi.org/simple emails-mcp-server

About this package

Temporary email MCP server built with FastMCP

emails-mcp-server

临时邮箱 MCP 服务,基于 uv + FastMCP + src package layout。

首版范围(v1):

  • Provider(稳定六家):guerrilla / mailgw / mailtm / gptmail / nodeseek / outlook
  • 统一工具 + provider 原生工具
  • 会话句柄(session_id)驱动收件流程
  • stdio 与 streamable-http 双传输

1. 快速开始

uv sync --dev
cp .env.example .env
uv run emails-mcp-server --transport stdio

HTTP 模式:

uv run emails-mcp-server --transport streamable-http --host 0.0.0.0 --port 8000 --path /mcp

2. 统一 MCP 工具

  • email_available_providers
  • email_get_capabilities
  • email_create_inbox
  • email_list_messages
  • email_read_message
  • email_wait_for_messages
  • email_read_latest
  • email_close_session

关键行为

  • 默认通过 session_id 追踪 provider 的 token/cookie/session
  • include_raw=false(默认)不返回原始 HTTP 报文
  • include_raw=true 才返回排障证据(已对敏感头和敏感 body 字段脱敏)
  • 会话默认 TTL 30 分钟(EMAIL_MCP_SESSION_TTL_MINUTES 可调)

3. Provider 原生工具

每个 provider 都有三类原生工具(create/list/read):

  • Guerrilla: guerrilla_create_inbox, guerrilla_list_messages, guerrilla_read_message
  • Mail.gw: mailgw_create_inbox, mailgw_list_messages, mailgw_read_message
  • Mail.tm: mailtm_create_inbox, mailtm_list_messages, mailtm_read_message
  • GPTMail: gptmail_create_inbox, gptmail_list_messages, gptmail_read_message
  • NodeSeek: nodeseek_create_inbox, nodeseek_list_messages, nodeseek_read_message
  • Outlook: outlook_create_inbox, outlook_list_messages, outlook_read_message

NodeSeek 额外原生工具(核心管理动作):

  • nodeseek_list_mailboxes
  • nodeseek_check_mailbox_availability
  • nodeseek_delete_mailbox
  • nodeseek_get_raw_mail
  • nodeseek_delete_mail
  • nodeseek_mark_mail_read
  • nodeseek_toggle_mail_flag
  • nodeseek_move_mail_to_folder
  • nodeseek_send_mail

NodeSeek 的 nodeseek_create_inbox 必须传 address。

NodeSeek API Key 仅通过环境变量 EMAIL_MCP_NODESEEK_API_KEY 读取。

Outlook 额外原生工具(业务动作):

  • 分组与池管理:
    • outlook_create_group
    • outlook_delete_group
    • outlook_list_group_usage
    • outlook_add_mailbox
    • outlook_get_available_mailbox
    • outlook_get_mailbox_status
    • outlook_trigger_mailbox_validations
  • 邮件动作:
    • outlook_get_latest_mail
    • outlook_get_all_mails
    • outlook_clear_inbox
    • outlook_clear_junk
    • outlook_send_mail

provider 传参支持 outlook,并兼容别名 outllook。

删除分组时需传 business_id;可先通过 outlook_list_group_usage 获取对应 id。

NodeSeek 环境变量:

  • EMAIL_MCP_NODESEEK_BASE_URL(默认 https://seek.li/openapi/v1)
  • EMAIL_MCP_NODESEEK_API_KEY(必填)

Outlook 环境变量:

  • EMAIL_MCP_OUTLOOK_HELPER_BASE_URL
  • EMAIL_MCP_OUTLOOK_OAUTH2_BASE_URL
  • EMAIL_MCP_OUTLOOK_HELPER_API_KEY
  • EMAIL_MCP_OUTLOOK_PASSWORD(可选)
  • EMAIL_MCP_OUTLOOK_SEND_PASSWORD(可选)

4. 开发与测试

uv run ruff check .
uv run mypy src
uv run pytest -q
uv build

5. GitHub Actions -> Gitea

CI (.github/workflows/ci.yml)

  • push / pull_request 触发
  • 运行 lint + typecheck + tests + build

Release (.github/workflows/release-gitea.yml)

  • main 每次 push 自动触发(也支持手动触发)
  • 自动将版本改写为 0.1.0.dev<run_number> 形式后发布
  • 发布 wheel/sdist 到 Gitea PyPI
  • 镜像仓库分支 + tags 到 Gitea

需要的 GitHub Secrets(沿用既有命名)

  • GITEA_PYPI_PUBLISH_URL
  • GITEA_PYPI_CHECK_URL(可选)
  • GITEA_USERNAME
  • GITEA_PAT
  • GITEA_MIRROR_REPO_URL

6. 参考文档

Requirements

Requires Python: >=3.10
Details
PyPI
2026-04-17 15:18:38 +08:00
31
luofengyuan
58 KiB
Assets (2)
Versions (3) View all