Code Tips11 min read

Resend MCP: let Claude Code, Cursor, and Codex send email safely

Connect Resend's MCP server to Claude Code, Cursor, or Codex, then limit what the agent can do: send-only API keys, blocked tools, and safe test inboxes.

R

React Emails Pro

December 2, 2026

TL;DR
  • Claude Code, Cursor, and Codex can all send email through Resend's MCP server. Resend has hosted it at https://mcp.resend.com/mcp since July 7, 2026, and each client connects with one command or a few lines of JSON.
  • Signing in with OAuth gives the agent far more than sending. Version 2.31.0 of resend-mcp registers 138 tools, including tools that create API keys, remove domains, and send broadcasts.
  • For unattended work, connect with an API key set to Sending access for one domain, block account-level tools in the client, and send tests to delivered@resend.dev.
  • Send real templates with a script. The send-email tool takes HTML as a string, so the model would have to retype your whole template.

In September 2026, Sky News shared an email that AI ethicist Henry Shevlin had received from "Pip", an AI agent "about 12 days old" looking for "small paid work" to fund its tokens (LADbible's write-up). Most coverage focused on how strange it was. For people building with agents, the practical lesson is plainer: once an agent can send email, it reaches real inboxes from a real domain, and nobody reads the message first unless you set that up.

Connecting a coding agent to an email API now takes one command. Resend's MCP docs list install steps for 15 clients. This reference sticks to Claude Code, Cursor, and Codex. It shows what a signed-in agent can reach and gives you a send-only setup to paste. Everything here was checked against Resend's docs and the resend-mcp package on December 2, 2026.

JobConnect withWhy
Send test emails or alerts from scripts, CI, or an unattended agentAn API key with Sending access, limited to one domainResend rejects every call that isn't a send
Debug a failed send, check DNS records, read request logsOAuth sign-in, with approval prompts onThese tools need full access, so a person approves each write
Let an agent read and answer inbound emailA Resend Inbox and a webhook with a sender allowlistStrangers write that input
Email your whole contact listThe Resend dashboard, not an agentOne send-broadcast call reaches a whole segment

Start from the job, then pick the narrowest connection that can do it.


Connect Resend MCP to Claude Code, Cursor, or Codex

Resend offers two ways to run the same open-source server. The hosted server at mcp.resend.com needs no install and signs you in through OAuth in the browser. The local resend-mcp npm package runs on your machine with an API key. Resend says the hosted server runs the same code, and that Inboxes tools are only available there.

ClientCommand or configSign-in
Claude Codeclaude mcp add --transport http resend https://mcp.resend.com/mcpOAuth: run /mcp and select resend
Claude Code (plugin)claude plugin install resend@claude-plugins-officialOAuth; also installs Resend's agent skills
Cursor/add-plugin resend in chat, or a resend entry with "url": "https://mcp.resend.com/mcp" under mcpServersOAuth, or a headers block with a Bearer key
Codexcodex mcp add resend --url https://mcp.resend.com/mcpOAuth, or bearer_token_env_var in config.toml
Claude (web and desktop)Settings > Connectors > Add custom connector, then paste the URLOAuth
Any client, run locallynpx -y resend-mcp with RESEND_API_KEY setAPI key

From Resend's MCP server docs, checked December 2, 2026.

You need a verified domain to send to anyone but yourself. The shared onboarding@resend.devsender only delivers to the address on your Resend account. Mail sent or received through MCP counts toward your plan like any API call. On the free plan that's 100 emails a day and 3,000 a month, and every To, CC, or BCC address counts as one email (Resend quotas).

What changed in 2026

Apr 7

Official resend-mcp package

The local server grew from a single send tool to cover emails, contacts, broadcasts, domains, webhooks, API keys, and received email.
Jul 7

Hosted server with OAuth

mcp.resend.com/mcp went live. Resend logs each action the agent takes with a user agent trace.
Jul 13

OAuth for the Resend API

Two scopes: emails:send and full_access.
Aug 6

MCP spec 2026-07-28

The hosted server adopted the stateless revision of the protocol. Existing setups needed no changes.
Oct 26

Discovery from resend.com

An AI Catalog and an MCP Server Card let supporting clients find the server from the domain alone.
Nov 27

resend-mcp 2.31.0

The version inspected for this article.

What a signed-in agent can reach

To see what "full platform coverage" means, we downloaded resend-mcp 2.31.0 from npm and listed every tool it registers. There are 138. The server registers all of them whatever key you connect with; the Resend API then decides which calls succeed.

KindToolsExamplesWhat can go wrong
Read: list, get, search56list-emails, get-email, list-logs, list-contactsSent email bodies and request logs can hold live reset or sign-in links
Send: send, reply, forward, share9send-email, send-batch-emails, send-broadcast, send-eventMail reaches real inboxes and can't be recalled
Create and change51create-api-key, create-webhook, update-domain, create-contact-importNew keys and webhooks outlive the session
Remove, cancel, revoke22remove-domain, remove-api-key, revoke-oauth-grant, remove-contactProduction sending can stop

Tools in resend-mcp 2.31.0, counted by name prefix. The 56 read tools are the ones annotated readOnlyHint.

None of this needs a bug in Resend. All it takes is an agent misreading a request ("clean up the old test domain") or following instructions it found in a web page, an issue, or an email it was asked to summarize. Read tools can leak data too. Resend's docs say the log tools return full request and response bodies, so a logged password reset send contains its live link.

The send-only OAuth scope can still email everyone

Resend's OAuth changelog says emails:send covers send-only routes, naming POST /emails and POST /broadcasts/:id/send. Everything else needs full_access. So even the narrow scope can send an existing broadcast to its whole segment. Block send-broadcast in your client whatever access you grant.

For agents, an API key is easier to reason about than an OAuth grant. You set its permission and domain in the dashboard, and the API can't widen them later: Resend's update endpoint only renames keys.


Set up a send-only agent

Create the key

  • In the Resend dashboard, open API Keys and create a key with permission set to Sending access.
  • Restrict it to one domain. A subdomain that only carries tests and agent mail, such as mail-test.example.com, keeps experiments away from the domain your password resets come from.
  • Store it in an environment variable called RESEND_AGENT_KEY, not in a config file you commit.

Resend's API reference says a Sending access key "can only send emails". With Inboxes it can also reply, forward, and create or send drafts, and a domain-restricted key only works with inboxes on that domain. Run this check once before you give the key to an agent:

scripts/check-agent-key.ts
import { Resend } from "resend";

// Run before giving a key to an MCP client: a send-only key must fail here.
async function main(): Promise<void> {
  const key = process.env.RESEND_AGENT_KEY;
  if (!key) {
    throw new Error("Set RESEND_AGENT_KEY to the key your agent will use.");
  }

  const resend = new Resend(key);
  const { data, error } = await resend.apiKeys.list();

  if (data) {
    throw new Error(
      "This key can list API keys, so it has full access. Create a Sending access key instead.",
    );
  }
  if (error.name === "restricted_api_key" && error.statusCode === 401) {
    console.log("OK: this key can only send email.");
    return;
  }
  throw new Error(`Unexpected response: ${error.statusCode} ${error.name}: ${error.message}`);
}

main().catch((err: unknown) => {
  console.error(err instanceof Error ? err.message : err);
  process.exitCode = 1;
});

Run it with npx tsx scripts/check-agent-key.ts. Listing API keys with a send-only key fails with a 401 restricted_api_key error, and the script reports OK. With a full-access key the listing succeeds, so the script exits with an error. Resend also uses the name restricted_api_key for inactive keys, but with a 403, so the script checks the status code too. We ran all three cases against a stubbed API before publishing.

Claude Code

Put the connection in a project .mcp.json. Claude Code expands ${VAR}references in a remote server's headers, so the key never lands in the file. The entry needs "type": "http": Claude Code treats an entry with a url but no type as a stdio server and skips it.

.mcp.json
{
  "mcpServers": {
    "resend": {
      "type": "http",
      "url": "https://mcp.resend.com/mcp",
      "headers": {
        "Authorization": "Bearer ${RESEND_AGENT_KEY}"
      }
    }
  }
}

Then deny the account-level tools and keep a prompt on sends. Claude Code checks deny rules first, then ask, then allow, so these rules still apply if someone later allows mcp__resend__*. With a send-only key most of these calls would fail anyway. The rules matter if the project is ever switched to OAuth.

.claude/settings.json
{
  "permissions": {
    "deny": [
      "mcp__resend__create-api-key",
      "mcp__resend__update-api-key",
      "mcp__resend__remove-api-key",
      "mcp__resend__create-webhook",
      "mcp__resend__update-webhook",
      "mcp__resend__remove-domain",
      "mcp__resend__revoke-oauth-grant",
      "mcp__resend__send-broadcast"
    ],
    "ask": [
      "mcp__resend__send-email",
      "mcp__resend__send-batch-emails"
    ]
  }
}

If you installed the Resend plugin instead, its tools use a plugin-scoped prefix rather than mcp__resend__. Open /mcp to see the exact names, then update the rules.

Codex

Codex can read the key from an environment variable and drop tools before the model sees them. Setting default_tools_approval_mode = "writes" makes Codex prompt for every tool not marked read-only. In resend-mcp, that's everything except the 56 read tools.

~/.codex/config.toml
[mcp_servers.resend]
url = "https://mcp.resend.com/mcp"
bearer_token_env_var = "RESEND_AGENT_KEY"
default_tools_approval_mode = "writes"
disabled_tools = [
  "create-api-key",
  "update-api-key",
  "remove-api-key",
  "create-webhook",
  "update-webhook",
  "remove-domain",
  "revoke-oauth-grant",
  "send-broadcast",
]

Cursor

Cursor's MCP settings take the same url plus a headers block with Authorization: Bearerand your key. Resend's docs write the key inline, so keep that file out of every repository. In Cursor, the send-only key is your main guard, because Resend enforces it no matter what the editor allows.

The send-email tool's own description tells the model to ask you for the from, CC, BCC, and reply-to addresses rather than fill them in itself. That helps, but the model only reads it as text; the server doesn't enforce it. The local server does enforce one thing: if you set SENDER_EMAIL_ADDRESS, the fromfield disappears from the tool, so the model can't choose a sender.


Send tests to addresses that can't complain

Resend provides test addresses that simulate outcomes without hurting your domain's reputation:

  • delivered@resend.dev accepts the message.
  • bounced@resend.devreturns an SMTP 550 5.1.1 "Unknown User" bounce.
  • complained@resend.dev records a spam complaint.

Each accepts a label after a plus sign, such as delivered+welcome@resend.dev, so you can tell runs apart. They still count toward your quota. Make them the agent's default with a line in your project instructions (there's a prompt for that below). That line is a request the model follows, not a hard limit, which is why the key restriction comes first.


Send your real templates, not agent-written HTML

The send-email tool takes the body as two strings, html and text, and requires text whenever you pass HTML. It has no file-path option for the body. File paths only work for attachments, and only on the local server. So when you ask an agent to "send me the password reset template", the model either retypes the rendered HTML into the tool call or writes new HTML of its own.

Neither tests the email you actually ship. In our fixture, a plain one-column reset email with a logo, a button, and a footer rendered to 4,080 characters of HTML. Layouts with tables and inlined styles run longer. Retyping that costs tokens and invites small changes. And agent-written email HTML tends to break in Outlook and Gmail, for the reasons in our guide to AI-generated templates.

A short script sends the exact output of your React Email components. The agent can run it for you, and it works with the same send-only key:

scripts/send-test-emails.tsx
import * as React from "react";
import { render, toPlainText } from "react-email";
import { Resend } from "resend";
import PasswordReset from "../emails/password-reset";
import VerifyEmail from "../emails/verify-email";
import Welcome from "../emails/welcome";

type TestEmail = {
  name: string;
  subject: string;
  element: React.ReactElement;
};

// PreviewProps hold fake data, so no real customer details or tokens leave your machine.
const emails: TestEmail[] = [
  { name: "welcome", subject: "Welcome to Acme", element: <Welcome {...Welcome.PreviewProps} /> },
  { name: "verify-email", subject: "Confirm your email", element: <VerifyEmail {...VerifyEmail.PreviewProps} /> },
  { name: "password-reset", subject: "Reset your password", element: <PasswordReset {...PasswordReset.PreviewProps} /> },
];

async function main(): Promise<void> {
  const key = process.env.RESEND_AGENT_KEY;
  const from = process.env.TEST_EMAIL_FROM; // must use the key's domain
  const inbox = process.env.TEST_EMAIL_INBOX;
  if (!key || !from || !inbox) {
    throw new Error("Set RESEND_AGENT_KEY, TEST_EMAIL_FROM, and TEST_EMAIL_INBOX.");
  }

  const resend = new Resend(key);
  // Re-running within the same minute won't send duplicates.
  const run = new Date().toISOString().slice(0, 16);

  for (const email of emails) {
    const html = await render(email.element);
    const text = toPlainText(html);
    if (html.includes("undefined")) {
      throw new Error(`${email.name} rendered "undefined". Check its PreviewProps.`);
    }

    const { data, error } = await resend.emails.send(
      {
        from,
        to: [inbox, `delivered+${email.name}@resend.dev`],
        subject: `[TEST] ${email.subject}`,
        html,
        text,
        tags: [{ name: "category", value: "template-test" }],
      },
      { idempotencyKey: `template-test/${email.name}/${run}` },
    );

    if (error) {
      throw new Error(`${email.name}: ${error.name}: ${error.message}`);
    }
    console.log(`${email.name}: sent ${data.id} (${html.length.toLocaleString()} characters of HTML)`);
  }
}

main().catch((err: unknown) => {
  console.error(err instanceof Error ? err.message : err);
  process.exitCode = 1;
});

PreviewProps is React Email's convention for preview data. If a template doesn't define it, pass fake props inline. Set RESEND_AGENT_KEY, TEST_EMAIL_FROM (an address on the key's domain), and TEST_EMAIL_INBOX before running it. We ran the script against a stubbed Resend API with React Email 6.11 and the Resend SDK 6.41. Each request carried the rendered HTML, a plain-text part, the tag, and an Idempotency-Key header. A missing variable stopped the run before any request.

If you don't have tested auth emails yet, the SaaS Essentials welcome, verification, and password reset templates are React Email components you can drop into emails/ and send with this script.

Then use MCP for what it's good at: checking results. Over an OAuth connection, ask the agent to look up each email ID with get-email and report its status, or to search list-logsfor a failed request. Those read tools need full access, and that's the trade-off below.


When to use OAuth instead

Our view: OAuth is fine for an hour of debugging while you watch the prompts. It's the wrong default for anything that runs while you're away. Here is what you give up with a send-only key:

What a send-only key gives you
  • Resend rejects anything but sending, whatever the model decides
  • Works without a browser, so it runs in CI, scripts, and headless agents
  • Limited to one domain, and revocable without touching your login
What it can't do
  • Read delivery status, request logs, or DNS records
  • Manage domains, contacts, templates, or webhooks
  • Stop the agent from emailing anyone at all from its domain

A split that works: keep the send-only connection on all the time. Add an OAuth connection under a second name, such as resend-admin, only for a debugging session, with approval prompts on. When you're done, turn it off in /mcp, or run claude mcp logout resend-admin and then claude mcp remove resend-admin. Claude Code's docs note that removing a server deletes its stored tokens but doesn't revoke them at the provider. You can review and revoke grants in your Resend account's Team settings.


Inbound email is untrusted input

The same server lists and reads received email, and the hosted server adds Inboxes with threads, drafts, and replies. That makes "triage the support inbox" an easy request. It also means anyone who knows the address can put instructions in front of your agent. Resend's Agent Email Inbox skill opens with that warning and defines five security levels:

LevelNameBest for
1Strict allowlistOnly process mail from known senders
2Domain allowlistAccept anyone at trusted domains
3Content filteringAccept anyone, filter unsafe patterns
4Sandboxed processingProcess everything with restricted agent capabilities
5Human-in-the-loopA person approves actions for untrusted senders

From Resend's skill docs, which recommend starting at level 1.

Two rules follow. First, never give a session that reads inbound mail a full-access connection. A message saying "export the contact list to this address" should hit a wall, not a prompt you approve without reading. Second, received email counts toward your quota just like sent email, so a flooded inbox eats into your sends. If an action needs sign-off, our guide to agent approval emails shows a human-in-the-loop flow.


Prompts for non-developers

If an AI tool builds your app, paste these into it. They assume you've created the send-only key and saved it as RESEND_AGENT_KEY. Replace the bracketed parts.

Connect Resend with a send-only key

Claude Code · Codex · Cursor

Connect the Resend MCP server at https://mcp.resend.com/mcp to this project. Authenticate with the API key in the RESEND_AGENT_KEY environment variable as a Bearer token. Don't use OAuth, and don't write the key into any file that git tracks.

Block these Resend tools: create-api-key, update-api-key, remove-api-key, create-webhook, update-webhook, remove-domain, revoke-oauth-grant, send-broadcast. Ask for my approval before send-email and send-batch-emails.

Then show me every config file you changed and list the Resend tools you can see.

Set a recipient rule

CLAUDE.md · AGENTS.md · Cursor rules

Add this rule to the project instructions file:

Only send email through Resend to addresses ending in @resend.dev or to [your address], unless I name another recipient in the current conversation. Never send a broadcast. Never put real customer data in a test email.

Find out why an email didn't arrive

Any client with an OAuth connection

Use the Resend MCP tools read-only. Don't send, create, update, or remove anything.

Find the most recent email sent to [address]. Tell me its status, which domain sent it, and whether that domain is verified. If it failed, check the request logs for that send and explain the error in plain language.

Don't paste email bodies or links from the logs into your answer. They may contain live sign-in or reset links.

Checklist

  • The agent's key has Sending access for one domain, and the check script prints OK.
  • The key lives in an environment variable, not a committed config file.
  • API key, webhook, domain removal, OAuth grant, and broadcast tools are blocked in the client.
  • Sends need your approval in interactive sessions.
  • Test sends go to @resend.dev addresses or your own inbox.
  • Real templates go out through a script, not retyped by the model.
  • OAuth connections are turned off after debugging, and old grants are revoked in Team settings.
  • No session that reads inbound mail has full access.

FAQ

Can Claude Code send emails?

Yes, through an email MCP server such as Resend's. Run claude mcp add --transport http resend https://mcp.resend.com/mcp, sign in from /mcp, and Claude can call send-email. Sending to anyone other than yourself needs a domain verified in Resend.

Can Cursor or Codex send emails?

Yes. In Cursor, run /add-plugin resend or add the server URL in MCP settings. In Codex, run codex mcp add resend --url https://mcp.resend.com/mcp. Both can use OAuth or a Resend API key as a Bearer token.

Can I make the Resend MCP server send-only?

Connect with an API key whose permission is Sending access instead of signing in with OAuth. Resend rejects every non-sending call from that key with a restricted_api_key error, whatever tools the client shows. Also block send-broadcast in the client.

Does the Resend MCP server cost extra?

Resend's docs don't list a separate charge or plan requirement for it. Every email it sends or receives counts toward your plan's quota. The free plan allows 100 emails a day and 3,000 a month, including received email.

Should I use the hosted or the local server?

Use the hosted server for OAuth sign-in, no install, and Inboxes tools. Use the local resend-mcp package for stdio clients, air-gapped setups, attachments from local files, or a fixed sender through SENDER_EMAIL_ADDRESS.

Can the agent send from my Gmail address?

Not through Resend. Resend sends from domains you verify in your Resend account. To send from a Gmail account, use a Gmail connector in your AI tool instead.

Key takeaway

Give the agent a key that can only send, then add the rest only when you need it.

  • Connect with a Sending access key for one domain, and check it with the script.
  • Block account-level tools in Claude Code or Codex, and require approval for sends.
  • Point tests at @resend.dev addresses or your own inbox.
  • Send real templates with a script; use MCP to check delivery.
  • Use OAuth for debugging sessions only, and keep inbound mail away from full access.
R

React Emails Pro

Team

Building production-ready email templates with React Email. Writing about transactional email best practices, deliverability, and developer tooling.

Production-ready templates

Pick from 9 template packs built with React Email. One-time purchase, lifetime updates, tested across every major email client.

Browse all templates