Back to Directory/Communication

MCP Emails

Never-stored live email: read, send, organize, schedule and auto-triage Gmail or any IMAP mailbox.

CommunicationTypeScriptv1.0.5

MCPEmails

Give your AI agent an inbox. A hosted Model Context Protocol server that lets Claude, Cursor, or any MCP‑compatible client read, search, send, organize, and schedule email through your existing mailboxes — without ever storing your mail.

Glama quality grade npm version MCP registry License: AGPL-3.0

Connect a mailbox once, paste one URL into your agent, and it can work your inbox live. Email is fetched on demand and never retained; credentials are encrypted at rest and decrypted only at call time inside an isolated edge function.

🔗 mcpemails.com · 📚 Docs · 💳 Pricing


Contents


How it works

  1. Connect a mailbox. Sign in at mcpemails.com and connect Gmail (one‑click OAuth) or any IMAP/SMTP account (app password). Credentials are encrypted with AES‑256‑GCM before they touch the database.
  2. Get access. OAuth‑capable clients (claude.ai, Claude Desktop, Cursor) connect in one click via OAuth 2.0 + PKCE. Everything else uses a scoped API key (mcpe_…).
  3. Point your client at the server. The MCP endpoint is a single URL:
    https://mcpemails.com/api/mcp
    
  4. Your agent works the inbox. It calls tools like inbox_list, email_read (action: "search"), email_compose (action: "send"), and schedule (action: "create"). Each request fetches live from your provider — nothing is mirrored or cached server‑side.

Permissions are scoped per key, so you can hand an agent read:email only, or grant it send and folder management without ever exposing delete.

Quick start (connecting an agent)

Claude Desktop / Cursor (OAuth): add a remote MCP server pointing at https://mcpemails.com/api/mcp and approve the consent screen. Pick the scopes the agent should have.

API key (any MCP client): create a key in the dashboard, choose its scopes and (optionally) restrict it to specific inboxes, then send it as a bearer token:

// Example MCP client config
{
  "mcpServers": {
    "mcpemails": {
      "url": "https://mcpemails.com/api/mcp",
      "headers": { "Authorization": "Bearer mcpe_your_key_here" }
    }
  }
}

The protocol is JSON‑RPC 2.0 over HTTP (MCP 2025-06-18, Streamable transport). Start every session with inbox_list — it returns the inboxes the key can reach, their per‑provider capabilities, and a versioned compatibility profile. The profile marks normalized operations as exact, different, or unavailable, so agents can preserve provider differences rather than silently weakening a request.

Setup guides

Copy‑paste instructions per client, including where each one keeps its config file: mcpemails.com/docs/clients.

Claude · Claude Code · ChatGPT · Cursor · VS Code · Cline · Windsurf · Gemini CLI · Zed · JetBrains · Raycast · Warp · curl

Capabilities

  • Live, never stored — email is read straight from your provider on each call; no message bodies are persisted.
  • Multi‑provider — Gmail via OAuth, plus any IMAP/SMTP mailbox (Fastmail, iCloud, Yahoo, Zoho, Yandex, self‑hosted…) via app password.
  • No relay — outbound mail is sent through your provider's SMTP/API, from your real address.
  • Granular scopes — eight permission scopes, grantable independently per API key and per inbox.
  • Batch & search‑and‑act — read, move, delete, or flag up to hundreds of messages in one call, including "search then move/delete" combinators.
  • Drafts & scheduling — compose drafts and queue messages for future send (server‑side dispatch).
  • Provider‑agnostic search — Gmail syntax, IMAP SEARCH, and JMAP are normalized behind one email_read (action: "search") interface.
  • Team‑ready: workspaces, members, roles, SSO, and an audit log on the Team plan.

Tools

17 tools you call directly. Most are resource-oriented and take an action argument that selects the specific operation (and, for actions that need different privileges, the required scope):

  • inbox_list - Lists the inboxes the key can reach, with each one's provider capabilities.
  • email_read - Lists, reads and searches messages, in batches, plus attachments, extracted attachment text and the original .eml.
  • email_organize - Moves, copies, flags and archives messages you name by id, singly or in batches.
  • email_search_and_move - Moves every message matching a search into a folder. Its own tool, and the destructive one, because a wrong filter relocates a whole inbox.
  • email_delete - Trashes or permanently deletes messages, singly, in batches, or by search.
  • email_compose - Sends, replies and forwards through your own provider, from your real address.
  • folder_list - Lists folders (labels on Gmail) with their provider-native IDs and message counts. Read-only.
  • folder - Creates, renames and deletes folders (labels on Gmail).
  • draft_list - Lists the drafts saved in the inbox, with their draft ids. Read-only.
  • draft - Creates, updates, sends and deletes drafts, including provider-native replies.
  • schedule_list - Lists what is queued for future delivery. Read-only.
  • schedule - Queues a message for future delivery, and cancels one that is queued.
  • signature_get - Reads the signature and sender name configured for an inbox. Read-only.
  • signature_set - Sets the signature appended to outbound mail, and the sender name.
  • automation_read - Lists triage rules, reads one, shows run history, and dry-runs a filter. Read-only.
  • automation - Creates, updates, enables, disables and deletes unattended triage rules, with no model in the loop.
  • contact_search - Looks up contacts by scanning recent mail live, with no stored address book.
ToolActionsScope(s)
inbox_list(single action)read:email
email_readlist, read, read_batch, search, attachment, extract, originalread:email (search also accepts search:email)
email_organizemove, move_batch, copy, copy_batch, flag, archivemanage:folders
email_search_and_move(single action)manage:folders
email_deletedelete, delete_batch, search_and_deletedelete:email
email_composesend, reply, forwardsend:email
folder_list(single action)read:email
foldercreate, rename, deletemanage:folders
draft_list(single action)manage:drafts
draftcreate, reply, update, send, deletemanage:drafts (create/reply/update/delete), read:email (reply also), send:email (send)
schedule_list(single action)schedule:email
schedulecreate, cancelschedule:email
signature_get(single action)read:email
signature_set(single action)send:email
automation_readlist, get, runs, previewmanage:automations
automationcreate, update, enable, disable, deletemanage:automations
contact_search(single action)manage:contacts (also accepts read:email)

A full-scope key sees 22 tools in tools/list: the 16 above plus six app-only tools (approval_review, approval_decide, approval_update, approval_schedule, bulk_execute, bulk_cancel). Those carry _meta.ui.visibility: ["app"] and drive the review card an MCP client renders for a held send or a previewed bulk operation, rather than being composed by hand.

Notes:

  • Tools accept either an explicit inbox_id (UUID) or an inbox email address; single‑inbox keys auto‑resolve the target.
  • Batch actions cap at 50 (email_read's read_batch) to 500 (move/delete/flag) messages per call.
  • For a targeted mutation, first use email_read with action: "search", then pass the returned message_id or message_ids to email_organize or email_delete. Search fields are accepted only by email_search_and_move and email_delete's search_and_delete action.
  • contact_search scans recent mail live, so there is no stored address book.
  • email_read's original action returns one complete provider-stored MIME message as a portable .eml file (up to 25 MB). It is read-only and never marks the message as read.
  • draft's send action requires send:email, not manage:drafts, so a key that can only manage drafts can't use them to bypass the send‑mail consent.
  • draft's reply action creates an unsent, provider-native reply in the source conversation. It needs both manage:drafts and read:email, and defaults to replying only to the sender.
  • The read-only halves (folder_list, draft_list, schedule_list, signature_get, automation_read) were split out of their write tools on 2026-09-09, so a read-only key is never shown a write tool. The old combined shapes (folder action: "list", draft action: "list", schedule action: "list", signature action: "get"/"set", automation action: "list"/"get"/"runs"/"preview") are still accepted on the wire for already-connected clients, but are no longer advertised.
  • automation manages unattended scheduled triage rules: a stored search plus one fixed action, evaluated on a cadence with no model in the loop. There is no delete-mail action, a forward always waits for human approval, and draft_reply only ever writes a draft. See docs/automations-trust-boundary.md.
  • tools/list only returns the tools your key (or OAuth token) is actually scoped for.

OAuth scopes

ScopeGrants
read:emailList inboxes & folders; list, read, and search messages; read an inbox's signature; look up contacts
search:emailNarrower alternative that grants only email_read's search action
send:emailSend, reply and forward; set the signature and sender name; also required to send a draft
manage:foldersCreate/rename/delete folders; move, copy, flag and archive messages
delete:emailTrash or permanently expunge messages
manage:draftsCreate, edit, and delete drafts (sending one also requires send:email)
manage:contactsLive contact lookup from recent mail
schedule:emailQueue messages for future delivery
manage:automationsCreate and manage unattended scheduled triage rules (no delete action; forwards stay approval-gated)

Supported providers

ProviderConnect viaRead/SearchSendFoldersPermanent deleteDrafts
Gmail / Google WorkspaceOAuth 2.0✅✅LabelsTrash only✅
FastmailApp password (IMAP/SMTP)✅✅✅✅✅
iCloud, Yahoo, Zoho, YandexApp password (IMAP/SMTP)✅✅✅✅✅
Any IMAP/SMTP mailboxApp password✅✅✅✅✅
Outlook / Microsoft 365OAuth 2.0🚧 built, gated pending verification

Outlook OAuth is implemented end‑to‑end but currently gated behind Microsoft publisher verification; it is hidden from the connect UI until it ships.

Pricing

The value metric is connected inboxes. Free connects one mailbox, Personal connects up to three, Pro connects every mailbox you own, and Team adds people, roles, and a separate workspace per client. Annual billing saves about 20%.

FreePersonalProTeam
Price$0$5/mo · $48/yr ($4/mo)$15/mo · $144/yr ($12/mo)$79/mo · $756/yr ($63/mo)
Connected inboxes13UnlimitedUnlimited
API keysUnlimitedUnlimitedUnlimitedUnlimited
Members1 (owner only)1 (owner only)1 (owner only)Unlimited, with roles
Fair‑use rate limit60 req/min120 req/min300 req/min1,000 req/min
Team roles & workspacesNoNoNo✅
SSO (SAML/OIDC) + audit logNoNoNo✅
SupportCommunityEmailEmailPriority

Per‑API‑key limits also apply (100 req/min · 1,000/hr · 10,000/day). Rate limits are retryable: they come back as JSON-RPC error -32003 with data.retry_after in seconds.

Every workspace additionally has a fair-use ceiling on billable actions per billing period. It is an abuse guard, not a plan feature: it sits far above any observed real usage, is never shown to customers, and cannot be bought past. Hitting it is not retryable and not a JSON-RPC error: it comes back as a normal tool result with isError: true and a _meta["com.mcpemails/usage_limit"] block, and clears at reset_at.

Internal plan ids predate the names: solo is sold as Pro and pro is sold as Team. The newer personal id is the only one that matches its display name, Personal. Every user who existed before the 2026-08-19 repricing keeps unlimited inboxes for free, permanently. See apps/web/src/lib/stripe/plans.ts.

Architecture

flowchart LR
    Agent["MCP client<br/>(Claude, Cursor, …)"] -->|"JSON-RPC / OAuth or API key"| Web

    subgraph Vercel["Vercel — Next.js 16"]
      Web["/api/mcp route<br/>+ marketing site + dashboard"]
    end

    subgraph Supabase
      Edge["mcp-server<br/>edge function (Deno)"]
      DB[("Postgres<br/>RLS + encrypted creds")]
      Cron["token-refresh<br/>edge functions"]
    end

    Web -->|proxies| Edge
    Edge -->|decrypt creds, fetch live| Providers["Email providers<br/>Gmail API · IMAP/SMTP"]
    Edge --> DB
    Cron --> DB
    Web --> Stripe[("Stripe<br/>billing")]
  • /api/mcp is a thin Next.js route handler that proxies to the Supabase edge function mcp-server — the real MCP implementation, where credentials are decrypted and provider calls are made.
  • The Postgres database stores workspaces, members, inboxes (encrypted tokens/passwords), hashed API keys, OAuth clients, scheduled sends, and an activity log — all guarded by Row‑Level Security.
  • Cron edge functions refresh Gmail/Outlook OAuth tokens before expiry.

Stack: Next.js 16 (App Router) · React 19 · next‑intl 4 · Supabase (Auth, Postgres, Edge Functions) · Stripe · Resend · TypeScript. Email parsing/sanitization via mailparser, jsdom, and isomorphic-dompurify.

Repository layout

.
├── apps/
│   └── web/                     # Next.js 16 app (marketing, dashboard, /api/mcp proxy)
│       ├── app/                 # App Router routes ([locale], dashboard, api, auth)
│       ├── components/          # marketing/ + dashboard/ React components
│       ├── messages/            # next-intl translations (en, nb, es, fr, zh)
│       ├── src/lib/             # stripe/, supabase/, blog/, crypto helpers
│       └── proxy.ts             # middleware: i18n + Supabase session + CDN cache
├── supabase/
│   ├── functions/
│   │   ├── mcp-server/          # the MCP server (tools, auth, scopes)
│   │   ├── gmail-token-refresh/
│   │   └── outlook-token-refresh/
│   └── migrations/              # SQL migrations (schema + RLS)
└── package.json                 # npm workspaces (apps/*)

Local development

Prerequisites: Node.js 20+, npm, and the Supabase CLI (for migrations and edge functions).

# 1. Install (npm workspaces — run from the repo root)
npm install

# 2. Configure environment
cp .env.example apps/web/.env.local
#   then fill in the values (see below) and generate the two secrets:
openssl rand -hex 32   # ENCRYPTION_KEY
openssl rand -hex 32   # CSRF_SECRET

# 3. Run the web app (http://localhost:3000)
npm run dev

# 4. Production build
npm run build

next.config.js validates required env vars at build/start and rejects weak ENCRYPTION_KEY values, so a misconfigured environment fails fast instead of at runtime.

Environment variables

Copy .env.example and fill in real values. Required in every environment:

VariablePurpose
NEXT_PUBLIC_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEYSupabase client (public)
SUPABASE_SERVICE_ROLE_KEYServer‑side admin key (bypasses RLS) — secret
NEXT_PUBLIC_APP_URLCanonical base URL; drives OAuth redirect URIs
GOOGLE_SITE_VERIFICATION (optional)Google Search Console HTML-tag verification token; set only in production
ENCRYPTION_KEY64‑hex AES‑256‑GCM key for credentials at rest — secret
CSRF_SECRET64‑hex HMAC key for CSRF tokens (distinct from above) — secret

Feature‑dependent:

Variable(s)Needed for
GMAIL_CLIENT_ID / GMAIL_CLIENT_SECRETGmail OAuth (gmail.readonly, gmail.send, gmail.modify)
OUTLOOK_CLIENT_ID / OUTLOOK_CLIENT_SECRET / OUTLOOK_TENANT_IDOutlook OAuth (Mail.Read, Mail.Send, Mail.ReadWrite, offline_access)
NEXT_PUBLIC_OAUTH_VERIFICATION_PENDINGShows the unverified‑app warning until Google/Microsoft verification completes
STRIPE_SECRET_KEY / STRIPE_WEBHOOK_SECRET / NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYBilling
STRIPE_PRICE_PERSONAL_MONTHLY / _YEARLY, STRIPE_PRICE_SOLO_MONTHLY / _YEARLY, STRIPE_PRICE_PRO_MONTHLY / _YEARLYPlan price IDs (personal = Personal, solo = Pro, pro = Team)

Fastmail and other IMAP providers connect via app password and need no OAuth credentials.

Database & migrations

Schema and Row‑Level Security policies live in supabase/migrations/. Core tables: workspaces, workspace_members, inboxes (encrypted credentials, soft‑deleted), api_keys (hashed, scoped, inbox‑restricted), oauth_clients, scheduled_sends, workspace_invites, and a month‑partitioned activity_log.

# Apply migrations to the linked project
npx supabase db push

# Generate TypeScript types from the live schema
npx supabase gen types typescript --linked > apps/web/src/types/database.ts

The Supabase CLI is the source of truth for DB changes in this project.

Deployment

Web app → Vercel (project mcp-emails-web):

vercel --prod --yes

Security headers and function timeouts are defined in vercel.json. The marketing routes are served with a CDN‑cacheable Cache-Control (set in proxy.ts) so crawlers and repeat visitors hit the edge cache; the dashboard, auth, and API routes stay no-store.

MCP server → Supabase edge function:

npx supabase functions deploy mcp-server --project-ref <your-project-ref> --no-verify-jwt

Self-hosting

Don't want to trust the hosted service with your mail? Run the same MCP server on your own machine. self-host/ ships a containerized stack (Postgres + PostgREST + the Deno server, no Supabase/Stripe/dashboard), so your credentials are encrypted with a key only you hold and decrypted only inside your own container.

cd self-host
make setup      # generate secrets (.env)
make up         # build + start the stack
export IMAP_PASSWORD='your-app-password'
make provision EMAIL=you@example.com IMAP_HOST=imap.fastmail.com SMTP_HOST=smtp.fastmail.com SERVICE=fastmail
make key NAME="my agent"   # mint an mcpe_ key, then point your client at http://localhost:8787

It is IMAP/SMTP-first (Fastmail, iCloud, Yahoo, Zoho, Yandex, generic) via app password; Gmail/Outlook OAuth and the web dashboard remain hosted-only. The container runs supabase/functions/mcp-server/ unmodified; see self-host/README.md for the full guide.

Internationalization

Built with next‑intl (localePrefix: 'as-needed', localeDetection: false for stable canonical URLs). English is served at /; other locales carry a prefix (/nb, /es, /fr, /zh). Translations live under apps/web/messages/.

Supported locales: English, Norwegian Bokmål, Spanish, French, Chinese (Simplified).

Security model

  • Credentials encrypted at rest with AES‑256‑GCM; decrypted only inside the edge function at call time.
  • No message storage — email bodies and attachments are fetched live and never persisted. Attachment text extraction runs transiently in the request and returns no raw attachment bytes.
  • API keys are hashed (only a prefix is stored for display) and scoped per permission and per inbox, with optional expiry.
  • OAuth 2.0 + PKCE for client authorization; Dynamic Client Registration (RFC 7591) for MCP clients.
  • Row‑Level Security isolates every workspace's data at the database layer.
  • Strict CSP, HSTS, X-Frame-Options: DENY, and related headers on every response.

License

MCP Emails is open source under the GNU Affero General Public License v3.0 (AGPL‑3.0). The hosted service at mcpemails.com runs the same server you can self-host, so you can read the code, verify it, and run it yourself. See /security for the trust model.


Send and receive email from any agent. © MCPEmails, AGPL‑3.0.

Installation

Source-derived launch command. Check the maintainer’s required arguments and credentials before running:

bash
npx -y mcpemails

Set up in your AI client

Merge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.

json
{
  "mcpServers": {
    "com-mcpemails-emails": {
      "command": "npx",
      "args": [
        "-y",
        "mcpemails"
      ]
    }
  }
}

Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.

Claude Desktop setup reference

Package

mcpemailsnpm

Compatible MCP Clients

MCP Emails works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.

  • Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.
  • Cursor~/.cursor/mcp.jsonRestart Cursor for changes to take effect.
  • VS Code.vscode/mcp.jsonReload VS Code window for changes to take effect.
  • Windsurf~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect.
  • Claude Code.mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.

Learn More