CLI, MCP server and SMTP
Three more ways in besides the SDK. Each is a thin client over the same HTTP API, so permissions, caps, suppressions, idempotency and test mode behave exactly as they do for a direct call.
Command line
The me-send CLI is a single dependency-free Node (version 24 or later) program that only speaks the HTTP API. It is not published to npm yet; run it from the Me Send repository.
export ME_SEND_API_KEY=re_... # required
export ME_SEND_BASE_URL=https://api.mesend.co # optional, this is the default
node packages/cli/bin/me-send.mjs emails send --from 'App <hi@yourdomain.com>' --to ann@example.com --subject Hi --html-file ./mail.html
| Command | API call |
|---|---|
emails send --from --to --subject with --html, --text, --html-file or --text-file, and optionally --cc, --bcc, --reply-to, --idempotency-key | POST /emails |
emails get <id> and emails list (--limit, --after, --status) | GET /emails/:id and GET /emails |
domains list | GET /domains |
suppressions list (--limit, --after, --origin), suppressions add <email>, suppressions remove <email-or-id> | /suppressions |
webhooks list | GET /webhooks |
--to a@x.co,b@x.co and a repeated --to both work. --json prints the API's JSON (and errors as JSON on stderr). Exit codes: 0 success, 1 an API or network error, 2 a usage error. The key's permissions apply: a sending-only key can send and nothing else.
MCP server
https://api.mesend.co/mcp is a hosted Model Context Protocol server over Streamable HTTP. POST a JSON-RPC message, get one JSON response. There is no SSE stream and no session; GET answers 405. Authenticate every request with Authorization: Bearer <API key or OAuth access token>.
claude mcp add --transport http me-send https://api.mesend.co/mcp --header "Authorization: Bearer $ME_SEND_API_KEY"
| Tool | Does | Key needed |
|---|---|---|
send_email | POST /emails (an idempotency_key argument sets the header) | full or sending |
get_email, list_emails | GET /emails/:id, GET /emails | full or support |
list_received_emails, get_received_email | GET /emails/receiving and /:id | full or support |
list_domains | GET /domains | full or support |
list_suppressions, add_suppression | /suppressions | full |
tools/list shows a key only the tools it may call: a sending-only key sees send_email; a support key sees the reads. Errors come back as the API's { statusCode, name, message } in a tool result with isError set. Give an agent a sending-only key, or a domain-restricted one, so it can send and nothing more.
OAuth for apps
A third-party app, or an MCP client that supports OAuth, can act on one project without being given an API key. It is OAuth 2.1 for public clients, with PKCE (S256) required.
| Step | Where |
|---|---|
| Discovery | GET https://api.mesend.co/.well-known/oauth-authorization-server, and /.well-known/oauth-protected-resource. An unauthenticated /mcp call answers 401 with a WWW-Authenticate header that points to the resource metadata. |
| Authorize | https://app.mesend.co/oauth/authorize?response_type=code&client_id&redirect_uri&code_challenge&code_challenge_method=S256&state. A signed-in admin picks the project and full_access or sending_access, then allows or denies. The app is sent back with code, state and iss. |
| Token | POST https://api.mesend.co/oauth/token (form or JSON) with grant_type=authorization_code, code, code_verifier, client_id and redirect_uri; or grant_type=refresh_token with refresh_token and client_id. It returns an access_token (valid for 1 hour), a refresh_token (30 days, single use) and scope. |
| Use | Authorization: Bearer <access_token> on the API and on /mcp. |
| List and revoke | GET /oauth/grants and DELETE /oauth/grants/:id, with a full key. Revoking ends the access and refresh tokens at once. |
Only registered clients with an exactly matching redirect URI can ask for access, and there is no dynamic client registration. An authorization code works once; using it again, or presenting a refresh token that was already rotated, revokes the whole grant. An OAuth token cannot create or delete API keys or domains.
SMTP
For software that only speaks SMTP (Nodemailer, WordPress, printers, msmtp), the SMTP relay in packages/smtp-relay accepts a message and makes the same POST /emails call. It is a front door, not a mail server: it never delivers or queues anything itself. It runs off the Worker, and no public relay host is set up yet.
| Setting | Value |
|---|---|
| Port | 587 with STARTTLS (required) |
| Username | resend |
| Password | a Me Send API key, full or sending access |
| Auth methods | PLAIN, LOGIN |
The SMTP envelope decides who receives the message. The From header and at least one To recipient are required. Reply-To, Subject, the HTML and text parts, and attachments are carried over, and so are List-*, X-*, In-Reply-To, References, Precedence and Auto-Submitted headers. A retry after a timeout does not send twice. Limits are 25 MB a message, 120 messages a minute per key and 100 messages a connection. Replies: 250 on success, 550 for a refused key or unverified domain, 554 for a validation error, 451 (try again) for a rate limit or a 5xx, 552 over 25 MB and 535 for wrong credentials.
Share links
POST /emails/:id/share with { "expires_in": "24h" } returns a public, read-only link, https://api.mesend.co/share/<token>, to one email, for showing it to someone without a key. expires_in is a number and a unit (s, m, h, d) from 1 minute to 30 days; the default is 7 days. The page shows the subject, from, to, date and body only. An expired or unknown link is a 404.