DearAgent MCP
Self-hosted agent email on Cloudflare Workers: wait for verification codes, reply in thread, get webhooks, with MCP and a skill.
- 51 ★ on the repository
- Last commit
- AGPL-3.0
Broad access
Why this level
- The agent sends and reads email, and one shared Bearer key opens every inbox.
- Verification codes and reset links from third-party services pass through the agent inbox.
Install
- Works in
Manual install
git clone https://github.com/panda-sandeep/dearagent && cd dearagentThen the `wrangler` steps from Quick start: D1, R2, the `API_KEY` secret and Email Routing.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- The agent sends and reads email, and one shared Bearer key opens every inbox.
- Verification codes and reset links from third-party services pass through the agent inbox.
This is third-party code. Review the repository files before installing.
What it does
DearAgent gives every agent its own inbox that runs entirely in your Cloudflare account. One Worker receives inbound mail through Email Routing, stores it in D1 and R2 and sends outbound mail through Cloudflare Email Sending. An agent can create an inbox, hand the address to a signup form, wait for the code email and read the confirmation link. It supports threads by `In-Reply-To` headers, full-text search with SQLite FTS5, attachments, reply, reply-all and forward, and HMAC-signed `message.received` and `message.sent` webhooks. Agents connect over REST with a Bearer key or over MCP at `/mcp`. The repository also carries a `skills/dearagent` skill that teaches the workflow.
Who it is for. Developers whose agents sign up for services and receive code emails and who want mail on their own infrastructure instead of a third-party service.
Good fit when
- An agent registers on a service and must wait for an email with a six-digit code
- Order emails need to stay in one thread and be answered with correct headers
- A webhook with a signature and delivery log is needed on each inbound message
- An email API for agents is deployed at the cost of a Workers plan without a separate server
- Full-text search over message text is needed straight from the agent
Not a fit when
- You do not use Cloudflare: the whole architecture is built on Workers, D1 and R2
- You need an audited product: the author marks the project as experimental
- Agents get untrusted internet access: run your own audit first
Example request
Create an inbox, sign up to the service with that address, wait for the code email and enter the verification code.MCP
- Transport
- http
- Authentication
- API key
Environment variables
API_KEYrequired, secret- Shared Bearer key for REST and MCP, set in Worker secrets.
Limitations
The author calls the project experimental: there was no in-depth audit and the API may change. You need a Cloudflare account, a domain with Email Routing enabled, Node 20 or later and `wrangler` logged in. Sending and replying need a Workers Paid plan. API and MCP access is guarded by one shared Bearer key that you set with `wrangler secret put API_KEY`, so a leak opens every inbox. Demo inboxes on the public site live for fifteen minutes and suit only a trial. The AGPL-3.0 license places conditions on hosting modified versions.
How to disable. Remove the `dearagent` MCP entry from the agent config and the skill from the skills directory. Delete the Worker, D1 database, R2 bucket and Email Routing rules in the Cloudflare dashboard.
FAQ
How do I connect DearAgent to Claude Code?
After deploying the Worker run `claude mcp add --transport http dearagent https://<your-address>/mcp --header "Authorization: Bearer $KEY"`. The key is the same one you set as `API_KEY`.
Do I need to deploy anything to try it?
No. dearagent.sh creates a real inbox on the public demo when the page loads and mail arrives on the page. Addresses live fifteen minutes and mail is not kept.
Which tools does the MCP offer?
Among them `create_inbox`, `wait_for_message`, `get_latest_message`, `search_messages`, `send_message`, `reply_to_message`, `forward_message` and webhook tools.
How does DearAgent differ from AgentMail?
The README calls it an open-source self-hosted alternative to AgentMail: the same email API idea for agents, run on your own infrastructure for the cost of a Workers plan.
How are messages grouped into threads?
By `In-Reply-To` and `References` headers, never by subject, so automated mail is not merged together.
Discussion
No questions or reviews yet.
Related
MCP serversOpen Agent Email — a self-hosted mail server for AI agents: inboxes, in-thread replies, human approval, webhooks and an MCP endpoint with 96 tools
An inbox for an AI agent: send, receive and reply in thread through MCP with optional human approval
The Atomic Mail MCP server: an agent creates its own atomicmail.ai inbox and works with mail through JMAP with no human involved.
KeyID agent-kit
@keyid/agent-kit
An MCP server that gives an agent a real email address: 27 tools for sending, replying, inbox search and contacts
CLI dispatcher for agents: tasks run in the background and the agent sleeps on a question until you reply from a messenger.
Skill and CLI for job applications: fills Greenhouse, Ashby and Lever forms and logs only confirmed submissions
README in short
The README shows the agent view, the inbound and outbound mail flow, features, a quick start with `wrangler` commands, and API and MCP sections. The project is marked as early.