agentic-inbox README

The project's README from github.com/cloudflare/agentic-inbox. As one markdown file: README.md.

Agentic Inbox

A self-hosted email client with an AI agent, running entirely on Cloudflare Workers

Agentic Inbox lets you send, receive, and manage emails through a modern web interface -- all powered by your own Cloudflare account. Incoming emails arrive via Cloudflare Email Routing, each mailbox is isolated in its own Durable Object with a SQLite database, and attachments are stored in R2.

An AI-powered Email Agent can read your inbox, search conversations, and draft replies -- built with the Cloudflare Agents SDK and Workers AI.

Agentic Inbox screenshot

Read the blog post to learn more about Cloudflare Email Service and how to use it with the Agents SDK, MCP, and from the Wrangler CLI: Email for Agents.

How to setup

Important: Clicking the 'Deploy to Cloudflare' button is only one part of the setup. You must follow the After deploying steps as well. For a full step-by-step guide with screenshots, refer to this comment: https://github.com/cloudflare/agentic-inbox/issues/4#issuecomment-4269118513

To set up

  1. Deploy to Cloudflare. The deploy flow will automatically provision R2, Durable Objects, and Workers AI. You'll be prompted for DOMAINS, which is the domain (yourdomain.com) you want to receive emails for ([email protected]).

    Deploy to Cloudflare

  2. Configure Cloudflare Access -- Enable one-click Cloudflare Access on your Worker under Settings > Domains & Routes. The modal will show your POLICY_AUD and TEAM_DOMAIN values. TEAM_DOMAIN can be either your Access team URL or the full .../cdn-cgi/access/certs URL. You must set these as secrets for your Worker.

  3. Set up Email Routing -- In the Cloudflare dashboard, go to your domain > Email Routing and create a catch-all rule that forwards to this Worker

  4. Enable Email Service -- The worker needs the send_email binding to send outbound emails. See Email Service docs

  5. Create a mailbox -- Visit your deployed app and create a mailbox for any address on your domain (e.g. [email protected])

Troubleshooting Access

  1. If you see Invalid or expired Access token, that usually means POLICY_AUD or TEAM_DOMAIN secrets are incorrect.
  2. If you see Cloudflare Access must be configured in production, this application is intentionally enforcing Cloudflare Access so your inbox is not exposed to anyone on the internet.

Features

Stack

Getting Started

npm install
npm run dev

Configuration

  1. Set your domain in wrangler.jsonc
  2. Create an R2 bucket named agentic-inbox: wrangler r2 bucket create agentic-inbox

Deploy

npm run deploy

Prerequisites

Any user who passes the shared Cloudflare Access policy can access all mailboxes in this app by design. This includes the MCP server at /mcp -- external AI tools (Claude Code, Cursor, etc.) connected via MCP can operate on any mailbox by passing a mailboxId parameter. There is no per-mailbox authorization; the Cloudflare Access policy is the single trust boundary.

Architecture

┌──────────────┐     ┌──────────────────┐     ┌─────────────────┐
│   Browser    │────>│  Hono Worker     │────>│  MailboxDO      │
│  React SPA   │     │  (API + SSR)     │     │  (SQLite + R2)  │
│  Agent Panel │     │                  │     └─────────────────┘
└──────┬───────┘     │  /agents/* ──────┼────>┌─────────────────┐
       │             │                  │     │  EmailAgent DO  │
       │ WebSocket   │                  │     │  (AIChatAgent)  │
       └─────────────┤                  │     │  9 email tools  │
                     │                  │────>│  Workers AI     │
                     └──────────────────┘     └─────────────────┘

License

Apache 2.0 -- see LICENSE.

agentic-inbox (cloudflare/agentic-inbox)

Searching Database…

What is this?Agentic Inbox is a self-hosted email client with a built-in AI agent that runs entirely on your own Cloudflare account, using Cloudflare Workers, Durable Objects, R2 storage, and Workers AI.
How do I get it running?Click the 'Deploy to Cloudflare' button, which auto-provisions R2, Durable Objects, and Workers AI, then you must manually finish the after-deploy steps: configure Cloudflare Access, set up an Email Routing catch-all rule, enable Email Service, and create a mailbox.
What do I need before deploying this?A Cloudflare account with your own domain, Email Routing enabled for receiving, Email Service enabled for sending, and Workers AI enabled so the agent can run.
Does clicking 'Deploy to Cloudflare' fully set it up?No -- deploying only provisions the infrastructure. You still have to follow the after-deploy steps and Cloudflare Access is enforced, so if it isn't configured the app will refuse to run in production.
Can anyone who passes my Cloudflare Access policy see every mailbox?Yes -- there's no per-mailbox authorization, so any user who passes the shared Access policy (including external AI tools connected via the /mcp endpoint) can access all mailboxes in the app.
What can the built-in AI agent actually do?It has 9 email tools for reading, searching, drafting, and sending messages, and it automatically generates a draft reply for new inbound emails, always requiring explicit confirmation before actually sending.
Can I connect external AI tools like Claude Code or Cursor to my inbox?Yes -- the app runs an MCP server at /mcp, so external AI tools can connect and operate on any mailbox by passing a mailboxId parameter.
Why does each mailbox get its own Durable Object?For isolation: every mailbox runs in its own Durable Object with its own SQLite database, while attachments are stored separately in R2.
Which AI model powers the agent?The agent is built with the Cloudflare Agents SDK and uses the Workers AI model @cf/moonshotai/kimi-k2.5.
Creator
cloudflare
Size
3.4 MB
Stars
8.3K
Updated
CommitApr 17
Age
6mo
Commits · 90 Days