Skip to main content
Glama
Manjit73

spacemail-mcp

by Manjit73

spacemail-mcp

这是一个 MCP 服务器,让 Claude 可以访问一个或多个 Spacemail(Spaceship 企业邮箱)邮箱。

为什么这样设计

Spaceship 在 docs.spaceship.dev 提供公共 API,涵盖域名(domains)、DNS 和 SellerHub。它没有邮箱端点,所以没有可封装进邮件的功能。Spacemail 本身提供标准的 IMAP 和 SMTP,并且默认为启用状态,因此本服务器直接使用这些协议:

协议

主机

端口

加密

IMAP

mail.spacemail.com

993

SSL

SMTP

mail.spacemail.com

465

SSL

用户名是完整的 Spacemail 地址,密码就是该邮箱自身的密码。

Related MCP server: IMAP MCP Server

工具

工具

说明

list_accounts

列出已配置的邮箱,以及哪个是默认邮箱。

test_connection

校验凭据。可测试单个邮箱,或者一次测试全部。

list_folders

列出所有文件夹,并显示邮件数量和未读数量。

search_messages

按收件人、发件人、主题、正文、日期、已读/未读筛选,最新在前。

read_message

读取单封邮件:邮件头、纯文本正文、附件列表。

set_read_state

将邮件标记为已读或未读。

move_message

在文件夹之间移动邮件,包括移至 Trash。

save_draft

构思并保存到草稿箱(Drafts),但不发送。

send_message

通过 SMTP 发送邮件。默认关闭,除非按账户显式开启。

每个工具都接受一个可选的 account 参数。如果只配置一个邮箱,该参数会被忽略;如果配置多个邮箱,省略该参数则使用默认邮箱。search_messages 还支持 account: "*",可以在一次调用中搜索全部邮箱。

这里有刻意的两个省略:

  • 没有永久删除。 任何工具最多只能把邮件移到 Trash,而你可以通过把它移回来撤销。

  • 发送是每个账号选择启用(opt-in)的。 除非 allowSend 在该特定邮箱上为 true,否则 send_message 会拒绝发送。请保持 allowSend 关闭,并使用 save_draft,这样发送这个动作由人工完成。

设置

1. 安装

需要 Node.js 18 或更高版本。

cd path/to/spacemail-mcp
npm install

2. 创建 accounts.json

accounts.example.json 复制为 accounts.json 并填写。该文件已被 gitignore 忽略。

{
  "accounts": [
    {
      "label": "personal",
      "user": "you@example.com",
      "password": "the-mailbox-password",
      "default": true,
      "fromName": "Your Name"
    },
    {
      "label": "work",
      "user": "hello@example.org",
      "password": "the-other-password"
    }
  ]
}

每个账号的字段: label(在对话中你怎么称呼它), userpassword,以及可选参数 defaultfromNameallowSendimapHostimapPortsmtpHostsmtpPort

label 必须唯一。如果省略 label,它会根据地址自动生成,因此对于不同域名中相同的本地部分(比如 info@a.cominfo@b.com),两者都会变成 info,服务器将拒绝启动。请为它们设置明确的 label

密码来自 Spacemail Manager:找到订阅,点击邮箱旁边的三个点,然后选择 IMAP/POP3/SMTP。如果你不再有密码,可以在那里重新设置。

3. 在 Claude 桌面应用程序中注册

转到设置,然后“开发者”,然后“编辑配置”,它会打开 %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "spacemail": {
      "command": "node",
      "args": ["C:\\path\\to\\spacemail-mcp\\index.js"],
      "env": {
        "SPACEMAIL_CONFIG": "C:\\path\\to\\spacemail-mcp\\accounts.json"
      }
    }
  }
}

在 JSON 中,反斜杠需要写成两个(双写)。之后请从系统托盘彻底退出并重新启动应用。

或者使用 Claude Code CLI:

claude mcp add --transport stdio spacemail ^
  --env SPACEMAIL_CONFIG="C:\path\to\spacemail-mcp\accounts.json" ^
  -- node "C:\path\to\spacemail-mcp\index.js"

4. 验证

让 Claude 调用 test_connection,不指定任何账户。它会测试每个邮箱,并独立报告每个是成功(ok)还是失败(failed),所以某个邮箱的密码错误不会掩盖其他邮箱的情况。

提供凭据的其他方式

按以下顺序检查,先找到的优先。

1. 配置文件(推荐用于配置两个或更多邮箱)

SPACEMAIL_CONFIG 指向上面的 JSON 文件。

2. 编号的环境变量

SPACEMAIL_1_USERSPACEMAIL_1_PASSWORDSPACEMAIL_1_LABELSPACEMAIL_1_DEFAULTSPACEMAIL_1_ALLOW_SENDSPACEMAIL_1_FROM_NAME,然后 SPACEMAIL_2_* 依此类推,最多 20 个。

3. 单一账户

SPACEMAIL_USERSPACEMAIL_PASSWORDpassword,以及可选的 SPACEMAIL_IMAP_HOSTSPACEMAIL_IMAP_PORTSPACEMAIL_SMTP_HOSTSPACEMAIL_SMTP_PORTSPACEMAIL_ALLOW_SENDSPACEMAIL_FROM_NAME★.

故障排查

服务器无法启动。 它退出时会在 stdout 上输出一条明确的错误消息:配置文件不可读、缺少密码、label重复,或者完全没有配置任何邮箱。直接在文件夹中运行 node index.js 即可看到该消息。

某个邮箱失败,其他邮箱正常。 不带任何参数运行 test_connection。每个账户会分别报告。常见原因是用户名不是完整的邮箱地址,或者 Spacemail Manager 中该邮箱的 IMAP 已关闭。

服务器在 Claude 中显示为已断开。 MCP 子进程启动时的环境与本机终端不同,因此 node 可能不在 PATH 中。请使用绝对路径指向 node.exe,可通过 where node 获取。

search_messages 搜索不到任何内容。 文件夹路径是区分大小写且可能各不相同。请先运行 list_folders,使用它返回的准确的 path 值。

发送被拒绝。 allowSend 必须在该特定账户中为 true。此外,Spacemail 也会按套餐限制出站邮件的数量。

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Enables Claude to interact with email accounts via IMAP and SMTP, providing tools for searching, reading, sending, and managing emails across multiple providers.
    40
    417
    76
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables Claude to read, search, send, and manage emails across multiple IMAP/SMTP accounts via a single deployment.
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables Claude to read, search, draft, send, flag, and move email across multiple IMAP/SMTP mailboxes while keeping credentials local.
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables Claude to read and manage your Gmail account, including listing, searching, sending, drafting, replying to, archiving, labeling, and trashing emails via the Gmail API.

View all related MCP servers

Related MCP Connectors

  • Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.

  • Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…

  • Give an AI agent its own email address: send, reply, read, and wait for mail.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Manjit73/spacemail-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server