mail-mcp-oauth
mail-mcp-oauth
Claude.ai용 자체 호스팅 OAuth 2.1 지원 IMAP/SMTP MCP 서버입니다. maxx3250/claude-mail-mcp의 포크로, OAuth 2.1 + Dynamic Client Registration + PKCE 계층이 내장되어 있으며, Render에서 단일 무상태(stateless) 프로세스로 실행되도록 조정되었습니다 (VPS 불필요, nginx 불필요, systemd 불필요, 영구 디스크 불필요).
멀티 계정: 하나의 배포로 여러 사서함(Gmail, 사용자 지정 도메인 등)을 지원하며,
각 사서함은 IMAP/SMTP로 접근할 수 있습니다. 모든 MCP 도구는 선택적 account
매개변수를 받아 어떤 사서함을 대상으로 작업할지 결정합니다.
업스트림과의 변경 사항
OAuth 2.1 내장 (src/oauth.ts):
/register(DCR),/authorize(PKCE + 단일 사용자 로그인 폼),/token. 별도의 OAuth shim 프로세스는 없습니다. 업스트림은 이러한 shim을 언급하지만 공개하지 않았으므로, 이 포크는 동일한 Express 앱 안에서 직접 구현합니다.설계상 무상태: access/refresh 토큰은 서명된 JWT입니다(DB 없음). 등록된 OAuth 클라이언트와 진행 중인 인증 코드는 메모리에 저장됩니다. 재시작 시 Claude.ai가 자동으로 다시 등록하며, 이는 Claude.ai의 MCP 클라이언트가 이미 처리하는 동작입니다.
환경 변수에서 계정 읽기: Render의 파일 시스템은 일시적이므로 디스크의 파일 대신
ACCOUNTS_JSON을 사용합니다. 파일 기반ACCOUNTS_FILE은 로컬/VPS에서 계속 사용할 수 있습니다.CalDAV/calendar 도구 제거 — 이 배포에는 필요하지 않으며, 의존성 표면을 줄입니다(
tdav,ical.js).
Related MCP server: IMAP MCP Server
Architecture
Claude.ai (web)
│ HTTPS + OAuth 2.1 (DCR, PKCE, JWT)
▼
Render (TLS terminated automatically, custom domain mcp-mail.<domain>)
▼
this process (single Node service)
├── /.well-known/oauth-authorization-server, /register, /authorize, /token (src/oauth.ts)
├── /mcp (Bearer-gated MCP Streamable HTTP transport)
│ ├── ImapClient ──▶ imapflow ──▶ IMAP server (993/143) per account
│ └── SmtpClient ──▶ nodemailer ──▶ SMTP server (465/587) per account
└── /healthLocal setup
npm install
cp .env.example .env
# fill in PUBLIC_URL, ACCOUNTS_JSON (see docs/ACCOUNTS.md), OAUTH_USER,
# OAUTH_PASS, and JWT_SECRET (openssl rand -hex 32)
npm run devRender에 배포
전체 단계별 가이드는 docs/DEPLOY_RENDER.md를 참고하세요. (GitHub push, Render web service, custom domain, Netcup DNS, Claude.ai 연결).
Accounts
accounts.json 스키마와 제공자별 설정은 docs/ACCOUNTS.md를
확인하세요. (Gmail 앱 비밀번호, Netcup Webhosting IMAP/SMTP, 그리고
Hotmail/Outlook.com이 별도의 OAuth2 흐름이 필요한 이유).
Claude에 제공되는 도구
도구 | 목적 |
| 설정된 사서함 목록 표시 (name, label, default, From) — 자격 증명은 표시하지 않음 |
| IMAP 사서함 열거 |
| 폴더에서 가장 최근 N개의 메시지 |
| 서버 측 IMAP 검색 |
| 전체 본문 + 인덱스 + 첨부 메타데이터 |
| SMTP로 전송(선택적으로 보낸 편지함에 복사) |
| RFC-822 작성 및 Drafts에 APPEND |
|
|
| 폴더 간 이동 |
| 메시지 삭제 (복구 불가 작업 — 휴지통으로 이동을 권장) |
License
MIT — LICENSE 참조. Original work by Markus Stöger (maxx3250/claude-mail-mcp).
Related MCP Connectors
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
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.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables Claude to interact with email accounts via IMAP and SMTP, providing tools for searching, reading, sending, and managing emails across multiple providers.401,013 npm115MIT
- FlicenseNot gradedqualityDmaintenanceEnables Claude to read, search, send, and manage emails across multiple IMAP/SMTP accounts via a single deployment.-
- FlicenseNot gradedqualityBmaintenanceEnables Claude to read, search, draft, send, flag, and move email across multiple IMAP/SMTP mailboxes while keeping credentials local.-
- AlicenseBqualityCmaintenanceEnables email management through IMAP/SMTP, including reading, sending, replying, starring, deleting, labeling emails, handling attachments, and filtering by Gmail smart categories. Works with MCP-compatible clients like Claude Desktop and Claude Code using App Password authentication.1943 npmMIT