sendmcp
by agentfirsthq
README.md
# sendmcp
**Free email for all your projects. Open source, on your own Cloudflare.**
Every domain you own, one Worker, nothing extra to pay, and your agent runs it over MCP.
sendmcp speaks the Resend API, so an app that already uses the Resend SDK only needs a new base URL.
[](https://deploy.workers.cloudflare.com/?url=https://github.com/agentfirsthq/sendmcp)
Site and guides: [sendmcp.dev](https://sendmcp.dev).
## Why
Resend's free plan stops at 3 domains, and the fourth project costs $20 a month even if it sends ten
emails. sendmcp runs in your Cloudflare account instead, so every side project gets email from its own
domain:
- **Unlimited domains and projects** from one deploy.
- **Resend-compatible API**: same paths, error names and `re_` keys. Keep your code.
- **Your agent runs it**: Claude Code, Cursor or Codex sends and reads email, creates keys, webhooks and
templates and checks delivery over MCP. Domains are added in the dashboard or with `POST /domains`,
and Cloudflare writes the DNS records.
- **Your data stays in your account**: D1 for metadata, R2 for bodies, Cloudflare Access for the
dashboard. No passwords, no third-party service.
Transactional email only (sign-up, magic links, receipts, alerts). No marketing or bulk mail: Cloudflare
Email Sending does not allow it.
## Before you deploy
1. **Workers Paid plan** on the Cloudflare account. Queues and Email Sending need it.
2. **Zero Trust organization.** Open [Zero Trust](https://one.dash.cloudflare.com/) once and pick a
team name. The free plan is enough; Cloudflare asks for payment details even on Free.
3. **Email Sending turned on** for the account (Email Service in the dashboard).
No secrets, no API token, no email to type in.
## Deploy
1. Click **Deploy to Cloudflare** above. Cloudflare copies the repo into your GitHub account and
creates the D1 database, R2 bucket and queue. It asks for nothing else.
2. Open the Worker URL (`https://sendmcp.<your-subdomain>.workers.dev`) and click **Sign in with
Cloudflare**. Pick the account the Worker runs in and approve what sendmcp asks for. sendmcp checks
that this account runs the Worker, makes you the owner and creates a Cloudflare Access application
that lets in your Cloudflare email only.
3. Sign in to Access with the one-time code it emails you. The **Get started** page runs the setup
checks and tells you what is missing, with a link to fix each one.
The first sign-in has to use the workers.dev URL: that is how sendmcp proves the account owns it.
Revoke sendmcp any time in your Cloudflare profile under OAuth authorizations, then sign in again.
What the sign-in grants, and why:
| Permission | Used for |
| -------------------------------- | ------------------------------------- |
| User details · Read | your email, the dashboard owner |
| Account · Read, Workers · Read | proving the account runs this Worker |
| Email Sending · Edit | sending and quota checks |
| Access: Apps and Policies · Edit | protecting the dashboard |
| Access: Organizations · Read | finding your Zero Trust team domain |
| Zone · Read | listing the domains you can send from |
| DNS · Edit | writing DKIM, SPF and DMARC records |
| Email Routing · Edit | receiving mail |
| Zone Settings · Edit | turning on the receiving subdomain |
| Queues · Edit | delivery events (delivered, bounced) |
| Offline access | refreshing the sign-in token |
Prefer a hand-made API token? Set it with `wrangler secret put CLOUDFLARE_API_TOKEN` (same
permissions, plus `CLOUDFLARE_ACCOUNT_ID` if it sees several accounts). It overrides the sign-in token.
### Deploy from a clone
```bash
pnpm install
```
```bash
pnpm build && pnpm run deploy
```
`pnpm run deploy` applies the D1 migrations, then runs `wrangler deploy`. Use `pnpm run deploy`, not
`pnpm deploy`, which is a different pnpm command.
## Use the API
Point the Resend SDK at your Worker and use a key from the dashboard (**API keys**):
```bash
RESEND_BASE_URL=https://sendmcp.<your-subdomain>.workers.dev
RESEND_API_KEY=re_...
```
The Python SDK reads `RESEND_API_URL` instead. A `test` key (`re_test_...`) accepts sends and never delivers them.
| Area | Same as Resend | Different or missing |
| --- | --- | --- |
| Emails | send, batch of up to 100, retrieve, list, update, cancel, `scheduled_at` | attachments are base64 `content` only, no share link |
| Requests | bodies, error shape, cursor pagination, `Idempotency-Key` | no rate-limit headers; a daily limit per project plus Cloudflare's account quota |
| Domains, API keys | same endpoints; a domain's id is its name | full access keys only; Cloudflare writes the DNS records into your zone |
| Templates | drafts, publish, `{{{VARIABLES}}}` | none |
| Webhooks | Resend's event names, Svix-style signature headers | no `contact.*` events |
| Suppressions, logs | | dashboard and MCP only |
| Marketing | | `/broadcasts`, `/audiences`, `/contacts` return 501 |
Errors use Resend's shape: `{ "statusCode": 403, "name": "invalid_api_key", "message": "..." }`.
Inbound mail lands on the domain's receiving addresses and is delivered to your webhooks as `email.received`.
## Use it from your agent
Add `https://sendmcp.<your-subdomain>.workers.dev/mcp` to Claude, Cursor, ChatGPT or Codex as a remote MCP
server and approve access once in the browser (OAuth). The server has 31 tools: projects, domains and
tracking, API keys, sending and reading emails, inbound mail, webhooks with replay, templates, suppressions,
request logs, the daily quota and the setup checks. Each tool runs the same route as the dashboard.
## Update
The setup page and `GET /version` say when a new release is out. The Deploy button created your own copy
of the repo, so pull the new release into it (or merge the upstream tag) and Workers Builds redeploys.
Migrations run as part of the deploy.
## Develop
```bash
pnpm install
```
```bash
cp .dev.vars.example .dev.vars
```
`LOCAL_DEV=1` in `.dev.vars` lets `wrangler dev` on localhost skip Cloudflare Access. It has no effect on
any other host. Put an API token in `CLOUDFLARE_API_TOKEN` there, since OAuth sign-in only
returns to workers.dev URLs.
```bash
pnpm -C apps/worker db:migrate && pnpm -C apps/worker dev
```
```bash
VITE_DATA=live pnpm dev
```
Without `VITE_DATA=live` the dev server runs on mock data; production builds always use the Worker API. If the Worker is not on port 8787, set
`WORKER_URL=http://localhost:<port>`.
```bash
pnpm check
```
`pnpm check` runs Biome, the TypeScript checks and the Worker tests.
| Path | What |
| ------------- | ------------------------------------------------------------ |
| `apps/worker` | the Worker: Hono, D1 migrations, Access, public API, MCP server |
| `apps/web` | the dashboard SPA (React, Vite), served by the Worker at `/app` |
| `wrangler.jsonc` | Worker config, at the root so the Deploy button builds the whole workspace |
## More from agentfirsthq
sendmcp is built by [agentfirsthq](https://agentfirsthq.com): tools that your agent can set up and run.
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues