A Cloudflare Worker that files forwarded emails into lanes. An agent can read only the lanes it has been granted, through a small MCP server, so it can see your receipts and invoices without getting at the rest of your mail.
Experimental. It was built for personal use and is only lightly tested. Read the threat model before pointing an agent at real mail.
Unofficial. Not affiliated with, endorsed by, or sponsored by Cloudflare.
You forward the emails you choose (receipts, invoices, notifications) from your own mailbox to a lane's address, which is a long random string nobody could guess. The Worker checks the mail really came from you, turns it into plain text, keeps the original, and lets the agents you've granted that lane read it. Nobody else can.
text (domain). It also tries to drop hidden text, but that's best effort and won't catch everything.list_messages, get_message, create_share_link and mark_processed. Anything written by a third party comes back in a field whose name starts with untrusted.Four steps to an agent reading its first message.
npm run deploy.Steps 2 and 3, at a terminal:
# point the CLI at your account $ export AGENT_INBOX_CLI_API_TOKEN=... $ export CLOUDFLARE_ACCOUNT_ID=... $ export AGENT_INBOX_WORKER_NAME=... $ export AGENT_INBOX_MAIL_HOSTNAME=mail.example.com # create a lane, then give an agent access to it $ npm run cli -- lanes create receipts --description "Shop receipts" $ npm run cli -- agents create my-agent $ npm run cli -- agents grant my-agent receipts $ npm run cli -- messages inject-test receipts --text "Total 3.50 GBP"
The full guide covers DNS, Email Routing and deploy tokens. There's also a prompt you can give an agent to do the mechanical parts, but it hasn't been run end to end yet, so treat a first run as a trial.
The command-line tool does everything. The optional admin interface does the day-to-day tasks in a browser.
The admin interface has its own hostname and signs you in with Cloudflare Access. The Worker checks the Access token on every request, so a misconfigured Access application does not leave it open. It is off unless configured.
The CLI prints metadata only, and never a message body unless asked.
$ npm run cli -- lanes list LANE STATUS MESSAGES UNPROCESSED LAST RECEIVED ADDRESS --------------- ------ -------- ----------- ------------------------ ------------------------------------------------- alerts active 69 2 2026-11-19T23:15:16.068Z inbox+x5db7ys3gq2nwm4zc6hta5k2rp@mail.example.com bank-statements paused 12 0 2026-11-13T23:35:16.068Z inbox+m7ta4cx2qs5bnz6dy3wkpj7h2f@mail.example.com invoices active 58 0 2026-11-19T21:35:16.068Z inbox+p4yw2nq6dz7kxm3ta5hbcj2r6s@mail.example.com receipts active 144 3 2026-11-19T23:23:16.068Z inbox+k3x7qmz2ab5wd4ycp6jrn2tv7e@mail.example.com school-letters active 38 4 2026-11-19T23:00:16.068Z inbox+c2hq5wz7ntb3xy4ka6dmr2p7je@mail.example.com $ npm run cli -- agents list AGENT STATUS CREATED LANES --------------- -------------------------------- ------------------------ ----------------------------------- finance-agent active 2026-09-05T23:35:16.068Z bank-statements, invoices, receipts household-agent active 2026-10-10T23:35:16.068Z school-letters ops-agent active 2026-09-30T23:35:16.068Z alerts trial-agent revoked 2026-10-30T23:35:16.068Z 2026-09-20T23:35:16.068Z - $ npm run cli -- lanes get invoices Lane: invoices (active) Address: inbox+p4yw2nq6dz7kxm3ta5hbcj2r6s@mail.example.com Description: Supplier invoices for the home office. Allowed senders: (deployment default) Forwarded from: accounts@supplier.example.com (dmarc or dkim), *@billing.example.net (dmarc) Shareable: yes Attachments: application/pdf (max 10.0 MiB each) Transforms: none Limits: message 25.0 MiB, text 200000 chars, retention 365 days Transform failures: 0 Active share links: 0 $
Everything can be managed from your own machine with the CLI, which talks to the Cloudflare API.
inbox+<token>@mail.example.com. The token is 160 random bits.Every email body is treated as untrusted, because somebody else wrote it. The Worker doesn't try to spot malicious content. It keeps the risk down by being strict about who can send mail in and what an agent can read, so how safe this is also depends on what the agent itself is allowed to do. Read the threat model before connecting one.
You can use, copy, modify and distribute it, including commercially, as long as the copyright and licence notice stay with it. It comes as is, without warranty.
| Licence | MIT |
| Copyright | 2026 Luke Redpath |
| Security issues | SECURITY.md |
| Source and issues | github.com/lukeredpath/cloudflare-agent-inbox |