Skip to main content
Glama
Jardin456789

open-inbox-chatgpt

by Jardin456789

Open Inbox + ChatGPT

Self-host a small email inbox without paying for a Google or Microsoft Workspace account. The web app uses Next.js, Resend inbound/outbound email, and Neon Postgres. A separate private MCP server lets supported ChatGPT accounts search, read, send, and organize mail through their own connection.

This repository contains source code and setup skills, not a hosted email service or a pre-connected ChatGPT app. Each installation uses its own mailbox, database, credentials, and MCP tunnel. No personal messages or credentials are included.

What you can do

  • Receive email through a verified domain or a Resend-provided inbound address.

  • Read, search, reply, send, star, archive, trash, and restore messages in the web inbox.

  • Import an existing MBOX export into your own database.

  • Connect the private MCP server to ChatGPT through Secure MCP Tunnel, when your ChatGPT plan and permissions allow it. MCP tools can also read attachments up to 2 MB and send attachments up to 10 MB.

Related MCP server: Mail-MCP

Costs and ChatGPT access

The source code is free under MIT. Providers have their own quotas and may change them. A custom domain and hosting may cost money. Resend offers an inbound address on a Resend domain, so receiving mail can be tested without buying a domain; sending mail to arbitrary recipients requires a sending identity permitted by Resend. Review Resend pricing, Resend inbound, and the current limits of your database and host before relying on a free tier.

ChatGPT access depends on your plan. OpenAI currently documents Pro custom MCP apps as read/fetch only, while write/modify actions are in beta for Business and Enterprise/Edu. This repository cannot unlock write actions on an ineligible plan. See OpenAI's plan-specific developer-mode guide. You do not need a Google Workspace or Microsoft 365 subscription for this email app.

Secure MCP Tunnel is for each person's private connection. It cannot be used as the public endpoint for a universal OpenAI plugin submission. The included OpenAI plugin package is skills-only; it teaches setup and safe usage. To submit one shared MCP plugin to OpenAI's public directory, a separate multi-user HTTPS MCP service with authentication, domain verification, and OpenAI review would be required.

Quick start: web inbox

Requirements: Node.js 22.13+, pnpm, a Neon Postgres database, a Resend account, and a reachable HTTPS deployment for inbound webhooks.

  1. Clone this repository and run pnpm install.

  2. Copy .env.example to .env.local. Replace every example value. MAILBOX_EMAIL is the one address the MCP server may access. Use a long unique MAILBOX_PASSWORD.

  3. Run pnpm db:migrate, then pnpm dev to preview the web app.

  4. Deploy the app to a host that supports Next.js. Set the same secrets in the host's secret manager. Keep the web inbox behind its Basic Auth credentials.

  5. In Resend, configure receiving for your address and register a signed email.received webhook at https://YOUR-HOST/api/webhooks/resend. Set its signing secret as RESEND_WEBHOOK_SECRET.

  6. Send a message from an address you control to the new inbox, then verify it appears in the web UI. Send an outbound test only after Resend has verified your sender.

The webhook verifies its signature before storing received mail. The inbox returns 401 when its Basic Auth credentials are absent. The webhook path is exempt from Basic Auth because it uses signature verification.

Optional: import an existing mailbox

Export your own mailbox to MBOX and run:

pnpm email:import /private/path/messages.mbox you@example.com

The import writes message content and attachments to your Neon database. Keep MBOX files outside the repository and delete unneeded exports securely. Do not point the command at another person's mailbox without their authorization.

Connect to ChatGPT

The MCP server is in mcp/. It reads MAILBOX_EMAIL, DATABASE_URL, and RESEND_API_KEY from its process environment. It does not call an OpenAI model API. Its seven tools are mailbox_profile, search_emails, read_email, read_attachment, send_email, update_email, and delete_email_permanently.

  1. Run cd mcp && pnpm install.

  2. Test locally: node --env-file=../.env.local server.mjs (it waits for MCP input on stdio).

  3. Follow OpenAI's Secure MCP Tunnel guide to create your own tunnel and limited runtime key. Download tunnel-client from OpenAI; this repository does not bundle a binary or credentials. Use the profile template in mcp/tunnel.example.yaml and replace its placeholders privately.

  4. In ChatGPT developer mode, create a new MCP app using your tunnel. Scan and review the tools. Never choose another user's tunnel or paste your database URL into ChatGPT.

  5. Start a new ChatGPT conversation and select your app. Test mailbox_profile, search, and read before using any write tool.

Keep tunnel-client running on a machine with access to this MCP server. If that process stops, ChatGPT loses the connection. OpenAI's connection guide describes the current UI. Each ChatGPT account or workspace must create its own app connection.

Reusable OpenAI skills

plugins/open-inbox/ is a skills-only Agent Plugins package. Its setup skill walks through private deployment; its usage skill explains how to use a connected mailbox safely. The repository marketplace at .agents/plugins/marketplace.json makes it available to Codex from a cloned repository. The package deliberately contains no .app.json: that file would contain one person's private app ID and cannot be reused by everyone.

For a French walkthrough, see docs/FR.md. For security and disclosure instructions, see SECURITY.md.

Privacy boundary

Your mail is stored in your Neon database and processed by your Resend account. Connecting ChatGPT means that messages returned by MCP tools are sent to ChatGPT to answer your requests. Review provider privacy policies and use a private connection. The MCP server limits queries and changes to MAILBOX_EMAIL; sending and permanent deletion are labeled as consequential actions and should be confirmed for each specific message.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables secure mailbox access and email management via IMAP/SMTP, with tools for reading, searching, organizing, sending, and deleting emails, designed for local use and compatible with MCP clients like ChatGPT.
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Connects any IMAP/SMTP mailbox to AI agents via MCP, enabling email read, search, send, reply, and management through natural language.
    4 npm
    MIT
  • F
    license
    B
    quality
    B
    maintenance
    Enables external AI agents to read, send, and manage email over IMAP/SMTP via MCP, including inbox listing, search, drafts, scheduled/batch sending, and operations like reply, archive, and labels.
    30
    3
    -