Skip to main content
Glama
AnyMail Connect

AnyMail Connect

by pythc

Many email connections converging into one integration layer

Connect personal and enterprise mailboxes through one authorization and workflow boundary. Native Gmail and Microsoft Graph adapters preserve provider capabilities; IMAP/SMTP, JMAP and administrator-approved EWS extend coverage.

Development release. A backend service, with no bundled mailbox dashboard or embedded MCP app. Small browser endpoints handle provider OAuth, authenticated source viewing and human approval of an exact email. Provider support is capability-based, not a promise of universal Gmail/Outlook feature parity.

One boundary, multiple providers

flowchart LR
    Client["MCP / HTTP client"] --> API["Identity · account policy · tools"]
    API --> Core["Mail domain · drafts · send ledger"]
    Core --> Native["Gmail / People · Microsoft Graph"]
    Core --> Protocol["IMAP / SMTP · JMAP · EWS"]
    Core <--> DB[("PostgreSQL")]
    Worker["Sync / submission worker"] <--> DB
    Worker --> Native
    Worker --> Protocol

Adapter

Mailbox coverage

Authorization / boundary

Gmail + People

Personal Gmail, Gmail-enabled Workspace

User OAuth; app and organization policies apply

Microsoft Graph

Outlook.com, Microsoft 365, delegated shared mailboxes

Delegated OAuth; tenant consent and mailbox grants apply

IMAP + SMTP

Providers and self-hosted servers exposing these protocols

TLS and provider-approved credentials; extension support varies

JMAP

JMAP-enabled services

Session URL and API token; explicit cross-origin policy

EWS

Administrator-approved on-premises Exchange

HTTPS endpoint with Basic/Bearer; no NTLM or autodiscovery

Optional CardDAV adds a configured address book to a connection. Provider notes distinguish implemented behavior from deployment-specific acceptance.

Related MCP server: multi-gmail-mcp

Designed around authority and state

  • A consistent integration surface. Streamable HTTP MCP and an HTTP tool gateway share schemas, account policy, source citations and authenticated attachment resources.

  • Provider semantics stay visible. Search coverage, folders versus labels, native drafts, contacts and shared-mailbox permissions retain their original constraints.

  • Explicit access. OIDC identity, tenant/account isolation, independent read/write/send scopes, expiring same-tenant grants and revocation.

  • Durable mail workflows. Revisioned drafts, exact-content approval, persisted idempotency and scheduled submission. Uncertain submissions stop for reconciliation.

  • An independent worker. Checkpointed sync, periodic reconciliation, IMAP IDLE, authenticated Gmail/Graph notifications, native-draft conflict handling and retention.

  • Bounded attachment processing. Authenticated bytes, limited extraction, opt-in offline OCR and explicitly selected private text indexes.

Try it locally

Start with the synthetic mailbox quickstart: prebuilt image, generated credentials, local OIDC and an explicit approval workflow. No real mailbox or cloud account is required. Submission is simulated. See releases for exact image digests and verification.

node scripts/demo.mjs init
docker compose --env-file .artifacts/demo/compose.env -f examples/demo/compose.yaml up -d --wait
node scripts/demo.mjs walk

Deploy for real mail

You need Node.js 24+, PostgreSQL and an OIDC provider. Mailbox-provider OAuth is configured separately from the identity provider used to access AnyMail.

git clone https://github.com/pythc/anymail-connect.git
cd anymail-connect
cp .env.example .env

Configure secrets, identity and provider credentials using the deployment guide, then:

docker compose build
docker compose up -d

Endpoint

Purpose

/mcp

Authenticated Streamable HTTP MCP

/api/call/:tool

HTTP gateway to the same tool registry

/.well-known/oauth-protected-resource

Resource and authorization-server discovery

/connect

Sign in and authorize a Gmail or Microsoft mailbox

/healthz

Process liveness, not provider readiness

The root endpoint returns service metadata as JSON. Connect other supported providers through POST /api/accounts/connect; use your client for mail operations. HTTP and MCP examples →

Sending is a state transition

draft → prepare exact revision → user reviews approval_url → durable queue → provider submission
                                                                            ↳ unknown: reconcile

Approval binds the actor, mailbox, recipients, body and attachment identity. A tool cannot approve its own send request. A provider acceptance response is not a delivery receipt, and an unknown submission is never automatically replayed.

Develop and operate

npm ci
npm run check
npm run build

Regression tests and synthetic protocol fixtures belong in source control. Credentials, real-account acceptance data, personal task lists, build output and generated test reports do not. See contributing for the test layers and repository boundaries.

Read next

Covers

Architecture

Domain boundaries, authority, storage and worker behavior

Deployment

OIDC, containers, network policy and MCP registration

Provider configuration

Gmail, Microsoft, protocol and enterprise constraints

API reference

Tools, HTTP calls, files and approval

Operations

Backups, upgrades, rollback, key rotation and retention

Security policy

Review scope, untrusted content and disclosure

Join the project

Read the adapter guide, check compatibility evidence, or pick a small good first issue. Questions belong in Discussions; public plans live in Issues and milestones. Please follow the code of conduct and use private security reporting for vulnerabilities.

License

Apache-2.0. Dependencies retain their own licenses. This project is not affiliated with OpenAI, Google or Microsoft.

Cover artwork generated with OpenAI image generation.

Related MCP Connectors

  • Hosted email MCP for your own Gmail, Outlook.com, Microsoft 365, iCloud or IMAP inbox: read, search, draft, reply in thread, forward and file mail. It moves or flags up to 500 messages in one call, and a send leaves exactly one copy in Sent. A calendar is a separate connection, and connecting one adds diary and scheduling tools.

  • 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.

  • Hosted MCP server for your Gmail, Outlook and IMAP mail, with mailboxes and scopes set per agent.

    https://cloud.fluxmail.ai/mcp
  • Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.

    https://www.primitive.dev/mcp

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server for email management that enables reading, searching, drafting, replying to, and sending emails with thread-aware replies and draft-first safety, supporting Gmail API and IMAP/SMTP backends.
    7 npm
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    A self-hosted MCP server that gives an AI client read, search, triage, drafting, attachment/export and label-management access to several Gmail or Google Workspace accounts at once, with each call naming an explicit account. Sending is disabled unless armed twice, mail deletion is impossible, and tokens, exports and audit data stay local.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI assistants to read, search, send, manage, schedule, and analyze email across multiple IMAP/SMTP accounts through a single MCP server. Also supports drafts and templates, provider-aware labels and bulk operations, calendar extraction, real-time mailbox watching, and OAuth2 sign-in for Gmail and Microsoft 365.
    25 npm
    ISC
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables authenticated MCP clients to list, search, read, flag, draft, and optionally send mail from one Gmail or Microsoft 365 mailbox using OAuth without app registration.
    MIT