Skip to main content
Glama
GPeteWarren

techtv-mail

by GPeteWarren

techtv-mail — 一个面向 pete@techtv.live 的 Cowork 连接器

这是一个小型 MCP 服务器,可让 Claude (Cowork) 通过你的 cPanel 托管的 pete@techtv.live 邮箱读取和发送邮件——其工作方式与你现有的 Microsoft 365 和 Gmail 账号相同,只是专门为这个邮箱构建,因为 Anthropic 没有针对通用 IMAP/cPanel 邮件提供预置连接器。

它向 Claude 暴露了四个工具:

  • list_folders — 查看存在哪些邮件文件夹

  • search_emails — 按发件人、主题、正文或时间新近度搜索某个文件夹

  • get_email — 获取一封邮件的完整文本/HTML

  • send_email — 以 pete@techtv.live 的身份发送邮件

1. 部署到始终在线的地方

这个服务需要运行在一台能够 24/7 通过公网访问的小型服务器上——它不能放在你自己的电脑上,也不能放在 Claude 会话中,因为这两者都会离线。对于这种规模很小的服务来说,最便宜、最简洁的选择是:

  • Railway (railway.app) — 免费/低价套餐,可直接从 zip 或 GitHub 仓库部署,并自动为你设置 PORT。

  • Render (render.com) — 类似,为小型服务提供免费套餐(免费套餐在空闲时会休眠,之后遇到第一个请求会多几秒延迟)。

  • 一台你已经有的小型 VPS(如果你更愿意自己运行)。

无论你选择哪一个,步骤都是一样的:

  1. 上传这个文件夹(或者把它推送到一个 GitHub 仓库,然后关联该仓库)。

  2. 设置让它先运行 npm install,然后运行 npm start(或 node server.js)。

  3. 在对应平台的控制台中设置下面这些环境变量——绝对不要把真实凭据写进代码里,也不要提交到 git 中。

  4. 部署完成后,平台会提供一个公共 URL,例如 https://techtv-mail-production.up.railway.app。

Related MCP server: IMAP MCP Server

2. 需要在服务器上设置的环境变量

变量

值

MAIL_HOST

mail.techtv.live

IMAP_PORT

993

SMTP_PORT

465

EMAIL_USER

pete@techtv.live

EMAIL_PASS

该邮箱的真实密码

ACCESS_TOKEN

一个很长的随机字符串——见下文

要生成一个好的 ACCESS_TOKEN,你可以在任何装有 Node 的机器上运行下面这段命令,或者直接用密码生成器生成一个至少 40 个字符的随机字符串:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

这个 token 会变成服务器 URL 的一部分,而且它是连接公共互联网和你的邮箱之间唯一的屏障,所以要把它当作密码一样对待——足够长、足够随机、绝不分享、绝不公开贴到任何地方。

3. 把它作为自定义连接器添加到 Cowork

部署完成之后,在 Claude 应用中:

  1. 转到 Customize > Connectors(或者在对话中点击“+” / 输入“/”,然后选择 “Manage connectors”)。

  2. 点击 + 进行浏览,然后选择 Add custom connector。

  3. 对于服务器 URL,请输入:

    https://<your-host-domain>/mcp/<ACCESS_TOKEN>

    (这两部分都来自你的部署——你所在平台给你的域名,以及你设置为环境变量的那个 token)。

  4. 将 OAuth Client ID/Secret 字段留空——这个服务器不使用 OAuth,URL 中的 token 就是访问控制手段。

  5. 保存/连接。之后,每当该连接器在某个对话中启用时,Claude 就应该会列出 list_folders、search_emails、get_email 和 send_email 作为可用的工具。

安全说明

  • 邮箱密码只存在于平台的托管环境中,绝不会出现在这段代码里,也绝不会输入到与 Claude 的对话中。

  • 任何人只要获得了完整的连接器 URL(包括其中的 token),就能针对这个邮箱使用这些工具,所以绝不要在公共场合粘贴这个 URL(比如共享文档、公共仓库、别人能看到的 Slack 频道)。如果你怀疑 URL 已经泄露,请生成一个新的 ACCESS_TOKEN,在平台上更新它,并在 Cowork 的连接器设置中重新输入新的 URL——旧的 URL 会立即失效。

  • 这个邮箱的真正密码也应该和平时一样只存放在你的密码管理器中;这个服务器只需要在部署时以环境变量的形式使用它一次。

本地测试(可选,部署之前)

你可以先在本地运行,以确认你的真实凭据有效:

npm install
MAIL_HOST=mail.techtv.live IMAP_PORT=993 SMTP_PORT=465 \
EMAIL_USER=pete@techtv.live EMAIL_PASS='<real password>' \
ACCESS_TOKEN=test123 PORT=3000 node server.js

然后在另一个终端中运行:

curl -s -X POST http://localhost:3000/mcp/test123 \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'

如果响应成功,会看到返回的 result 块包含了服务器信息——如果得到的是身份验证错误,请再次检查 EMAIL_PASS,并确认在 cPanel 中该邮箱的 IMAP/SMTP 访问没有被阻止。

Related MCP Connectors

  • Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.

  • Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.

  • Your agent needs a mailbox of its own — to receive, thread, draft and send, with attachments, without borrowing your personal inbox or your company's SMTP. **What you can ask for** • "Create an inbox for this agent and tell me its address." • "Read the new messages in this thread and draft a reply." • "Send this message with the attachment and wait for the response." • "Search this inbox for everything from that domain." • "Show delivery metrics and the events on this inbox." **How to use it** Point any MCP client at https://mcp.aisa.one/mail/mcp and sign in with OAuth — there is no key to create or paste. 49 tools: create and delete inboxes, list and read messages, raw message bodies, attachments, threads, drafts and draft attachments, send and reply, message search, inbox events, metrics, and list entries — reads and writes. **Why this rather than the source** A real inbox an agent owns, rather than an SMTP credential it borrows from a human. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Find the contact elsewhere in the catalogue, then write to them from here — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/sales/mcp finds the person to write to.

  • Email hosting from your AI: read and send mail, add domains, check DNS and manage mailboxes.

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
    1,133 npm
    103
    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.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables Claude to read, search, send, and manage email across multiple IMAP/SMTP accounts through OAuth 2.1-secured MCP tools.
    MIT