Resend Email Sending MCP Server ๐
This project provides a Model Context Protocol (MCP) server designed to send emails using the Resend API. It allows AI agents like Cursor or Claude Desktop assistants to compose and send emails directly, streamlining your workflow.
This server is derived from the original resend/mcp-send-email repository and is intended for open-source distribution under the MIT License.
Features
- Send plain text and HTML emails via Resend.
- Schedule emails for future delivery.
- Add CC and BCC recipients.
- Configure reply-to addresses.
- Requires sender email verification through Resend.
Prerequisites
- Resend Account & API Key: You need a Resend account and an API key.
- Verified Domain/Email: You must authorize Resend to send emails from your domain or specific email address. Follow the Resend domain verification guide.
Setup and Running
There are two primary ways to run this MCP server: using Docker (recommended) or running it locally with Node.js.
1. Using Docker (Recommended)
This method encapsulates the server and its dependencies in a container.
Build the Docker Image:Navigate to the root directory of the
klavis
project (the parent directory ofmcp_servers
) in your terminal and run:docker build -t resend-mcp -f mcp_servers/resend/Dockerfile .
Run the Docker Container:Replace
YOUR_RESEND_API_KEY
with your actual Resend API key.docker run -d -p 5000:5000 -e RESEND_API_KEY=YOUR_RESEND_API_KEY --name resend-mcp-server resend-mcp
-d
: Runs the container in detached mode (in the background).-p 5000:5000
: Maps port 5000 on your host machine to port 5000 inside the container (the server listens on port 5000).-e RESEND_API_KEY=...
: Passes your Resend API key as an environment variable to the container.--name resend-mcp-server
: Assigns a convenient name to the container.resend-mcp
: The name of the image you built.
The server is now running and accessible at
http://localhost:5000
.
2. Running Locally with Node.js
This method requires Node.js and npm installed on your system.
Install Dependencies:Navigate to the
mcp_servers/resend
directory in your terminal:cd mcp_servers/resend npm install
Configure Environment Variables:Copy the example environment file:
cp .env.example .env
Edit the newly created
.env
file and replace the placeholder with your actual Resend API key:RESEND_API_KEY=YOUR_RESEND_API_KEY
Build the Server:Compile the TypeScript code to JavaScript:
npm run build
This will create a
build
directory containing the compiled code (e.g.,build/index.js
).Run the Server:Start the server:
node build/index.js
The server will start, load the API key from the
.env
file, and listen on port 5000. You should see a message likeserver running on port 5000
.
Connecting to Clients (e.g., Cursor)
Once the server is running (either via Docker or locally), you need to configure your AI client (like Cursor) to use it.
Go to your client's MCP server settings (e.g., in Cursor: Settings -> MCP -> Add new MCP server).
Configure the server connection:
- Name: Choose a descriptive name (e.g., "Resend Email Sender").
- Type: Select "http" or "sse" (this server uses SSE - Server-Sent Events).
- URL: Enter the address where the server is running.
- If using Docker or running locally:
http://localhost:5000/sse
- If using Docker or running locally:
- Authentication: This server expects the API key via the
RESEND_API_KEY
environment variable (handled by Dockerrun -e
or the local.env
file), not typically via MCP client headers. However, consult your specific client's documentation if it offers ways to pass environment variables or if you need to modify the server (index.ts
) to accept keys via headers (though the environment variable method is generally preferred for security).
Usage:You can now instruct your AI agent to use the "send-email" tool provided by this server. For example, you could provide email details (to, from, subject, body) and ask the agent to "send this email using the Resend Email Sender". The agent will interact with your running MCP server to send the email via your Resend account.
Important Tool Arguments:
from
: The verified sender email address associated with your Resend account.to
: The recipient's email address.subject
: The email subject.text
: The plain text body of the email.html
(optional): The HTML body of the email.cc
,bcc
,replyTo
,scheduledAt
(optional): Ask the user before using these.
Development
To modify or contribute to the server:
- Clone the repository.
- Navigate to
mcp_servers/resend
. - Install dependencies:
npm install
- Make your changes (primarily in
index.ts
). - Build the code:
npm run build
- Run locally using the Node.js instructions above.