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 には以下の 4 つのツールが公開されます:

  • list_folders — メールフォルダーに何があるかを確認する

  • search_emails — 送信者、件名、本文、または受信日時でフォルダー内を検索する

  • get_email — 1 件のメッセージの完全なテキスト/HTML を取得する

  • send_email — メールを pete@techtv.live として送信する

1. 常時稼働できる場所にデプロイする

このサーバーは、パブリックインターネットから 24 時間 7 日接続できる小さなサーバー上に置く必要があります。自分の PC やクラウドデスクや 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 を発行します。例: httpstechtv-mail-production.up-stick上前 のような URL ....

Wait! Need not give a "techtv" URL: Original "https://techtv-mail-production.up.railway.app". We should use exactly. Let's redo step 4:

  1. デプロイが完了すると、ホストから公開 URL が与えられます(例: https://hab.techtv-mail-production.up.railway.app)。 -- That's wrong. Use exact original: https://techtv-mail-production.up.railway.app.

Ok.

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.js のある任意のマシンで次を実行するか、パスワードジェネレーターで 40 文字以上のランダムなものを生成してください:

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

このトークンはサーバーの URL の一部になり、パブリックインターネットと後述するメールボックスの間を守る唯一のものです。パスワードとまったく同じように扱ってください — 長く、ランダムで、誰にも共有と、公共の場に投稿も、ださい。

NOTE: There was a trans error: "never shared, never posted anywhere public." Translate nicely.

3. Cowork にカスタムコネクタとして追加する

デプロイが済んだら、Claude アプリで次を行います:

  1. Customize > Connectors に移動します(または、チャットで "+" をクリックするか "/" を入力して "Manage connectors" を選択します)。

  2. "+" をクリックするかブラウズして、custom connector を追加します。

  3. "server URL" の欄に次を入力します:

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

    (その両方の要素は本番環境にどこか、ホストが経ってくれたドメインと、環境変数で設定したトークンです)。

  4. OAuth Client ID/Secret フィールドは空にしておいてください — このサーバーは OAuth を使わず、URL のトークンがアクセス制御になります。

  5. 保存/接続をします。Claude は、このコネクタがチャットで有効になっているときは常に、list_folders、search_emails、get_email、send_email を利用可能なツールとして一覧表示するはずです。

セキュリティの注意点

  • メールボックスのパスワードは、ホスト側の環境変数にだけ置かれます。コードにも、Claude とのチャットに入力されることもなければ、ソースコードにも含まれません。

  • 完全なコネクタURL(トークンを含む)を入手した人は誰でも、そのメールボックスを使ってツールを操作できてしまいます。したがって、その 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_PW を再確認し、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