From 6d7751d46b1f112c661e77591945585ab69d0be8 Mon Sep 17 00:00:00 2001 From: Chris Pennington Date: Thu, 24 Apr 2025 13:06:23 -0600 Subject: [PATCH 1/3] feat: improve readme instructions --- CHANGELOG.md | 6 ++- README.md | 124 +++++++++++++++++++++++++++++++++++++++------------ email.md | 4 +- 3 files changed, 103 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 209be4a..d06f0e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Improved instructions in README +- Removed test email address from example email.md + ### Added - CC and BCC support for email recipients - Full request/response logging for improved debugging @@ -27,4 +31,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Basic email sending functionality - HTML email support - Email scheduling capability -- Reply-to addressing \ No newline at end of file +- Reply-to addressing \ No newline at end of file diff --git a/README.md b/README.md index 5db347a..2761f15 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ This is a simple MCP server that sends emails using Resend's API. Why? Now you can let Cursor or Claude Desktop compose emails for you and send it right away without having to copy and paste the email content. +As an example, you could use this to run local scripts, chat with Claude, or process data and send the results to yourself or your team. + Built with: - [Resend](https://resend.com/) @@ -18,49 +20,115 @@ Built with: - Configure reply-to addresses - Customizable sender email (requires verification) -**DEMO** +## Demo https://github.com/user-attachments/assets/8c05cbf0-1664-4b3b-afb1-663b46af3464 -**Cursor** +## Setup + +Currently, you must build the project locally to use this MCP server. Once you have the project built, you can point either in [Cursor](#cursor) or [Claude Desktop](#claude-desktop) to the MCP server script. -1. First, you need to authorize Resend to send emails from your domain or email. Follow the steps [here](https://resend.com/docs/send-with-nodejs) to set that up and get a Resend API key. -2. Clone this project locally. Edit index.ts and replace me@yoko.dev to your own email to send emails from -3. Run `npm install`, `npm run build` under the project dir. You should now see a /build/index.js generated - this is the MCP server script! +Once you configure the MCP server, you can use it in any Cursor or Claude Desktop chat. -Then go to Cursor Settings -> MCP -> Add new MCP server +1. Clone this project locally. + +``` +git clone https://github.com/resend/mcp-send-email.git +``` -- Name = [choose your own name] -- Type = command -- Command: `node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js --key=YOUR_RESEND_API_KEY --sender=OPTIONAL_SENDER_EMAIL_ADDRESS --reply-to=OPTIONAL_REPLY_TO_EMAIL_ADDRESS_ONE --reply-to=OPTIONAL_REPLY_TO_EMAIL_ADDRESS_TWO` +2. Build the project -You can get Resend API key here: https://resend.com/ +``` +npm install +npm run build +``` +3. Setup Resend -Now you can test out sending emails by going to email.md, replace the to: email address, select all in email md, and hit cmd+l. You can now tell cursor to "send this as an email" in the chat. Make sure Cursor chat is in Agent mode by selecting "Agent" on lower left side dropdown +Create a free Resend account and [Create an API Key](https://resend.com/api-keys). To send to other addresses, you'll also need to [verify your own domain](https://resend.com/domains). -Screenshot 2025-02-25 at 9 13 05 AM +> [!NOTE] +> For more info on how to send emails with Resend, see the [docs](https://resend.com/docs/send-with-nodejs). -**Claude desktop** +## Cursor -Same set up as above, and then add the following MCP config +1. Open Cursor Settings. -``` +Open the command palette (`cmd`+`shift`+`p` on macOS or `ctrl`+`shift`+`p` on Windows) and choose "Cursor Settings". + +2. Add the MCP server + +Select "MCP" from the left sidebar and click "Add new global MCP server". + +Add the following config: +```json { - "mcpServers": { - "resend": { - "command": "node", - "args": ["ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js"], - "env": { - "RESEND_API_KEY": [YOUR_API_KEY], - "SENDER_EMAIL_ADDRESS": [OPTIONAL_SENDER_EMAIL_ADDRESS], - "REPLY_TO_EMAIL_ADDRESSES": [OPTIONAL_REPLY_TO_EMAIL_ADDRESSES_COMMA_DELIMITED] - } + "mcpServers": { + "resend": { + "type": "command", + "command": "node ABSOLUTE_PATH_TO_MCP_SEND_EMAIL_PROJECT/build/index.js --key=YOUR_RESEND_API_KEY" + } + } +} +``` + +You can get the absolute path to your build script by right-clicking on the `/build/index.js` file in Cursor and selecting `Copy Path`. + +**Possible arguments** + +- `--key`: Your Resend API key (required) +- `--sender`: Your sender email address from a verified domain (optional) +- `--reply-to`: Your reply-to email address (optional) + +> [!NOTE] +> If you don't provide a sender email address, the MCP server will ask you to provide one each time you call the tool. + +3. Test the sending + +Now you can test out sending emails by going to `email.md`. +- Replace the to: email address with your own +- Select all text in `email.md`, and press `cmd+l` +- Tell cursor to "send this as an email" in the chat (make sure cursor is in Agent mode by selecting "Agent" on lower left side dropdown). + +Cursor chat with email.md file selected and Agent mode enabled + +## Claude Desktop + +1. Open Claude's Developer config file + +Open Claude Desktop settings and navigate to the "Developer" tab. Click `Edit Config`. + +2. Add the MCP server + +Add the following config: + +```json{ + "mcpServers": { + "resend": { + "command": "node", + "args": [ + "ABSOLUTE_PATH_TO_MCP_SEND_EMAIL_PROJECT/build/index.js" + ], + "env": { + "RESEND_API_KEY": "YOUR_RESEND_API_KEY", + } + } } - } } ``` -**Develop** +You can get the absolute path to your build script by right-clicking on the `/build/index.js` file in your IDE and selecting `Copy Path`. + +**Possible environment variables** + +- `RESEND_API_KEY`: Your Resend API key (required) +- `SENDER_EMAIL_ADDRESS`: Your sender email address from a verified domain (optional) +- `REPLY_TO_EMAIL_ADDRESS`: Your reply-to email address (optional) + +> [!NOTE] +> If you don't provide a sender email address, the MCP server will ask you to provide one each time you call the tool. + +3. Test the sending + +Close and reopen Claude Desktop. Verify that the `resend` tool is available in the Claude developer settings. -`npm install` -`npm run build` +Chat with Claude and tell it to send you an email using the `resend` tool. \ No newline at end of file diff --git a/email.md b/email.md index 1557ef9..eaffb54 100644 --- a/email.md +++ b/email.md @@ -1,4 +1,4 @@ -to: ykhli1013@gmail.com +to: YOUR_EMAIL_ADDRESS subject: Test! content: This is a test email. @@ -8,4 +8,4 @@ Fun fact: cats have 32 muscles in their ears. (??!) # Example of using CC and BCC: # cc: colleague1@example.com, colleague2@example.com -# bcc: manager@example.com +# bcc: manager@example.com \ No newline at end of file From 734f8686825ca0abce301e53d106e102e6b35bbb Mon Sep 17 00:00:00 2001 From: cpenned <66193019+cpenned@users.noreply.github.com> Date: Thu, 24 Apr 2025 13:13:20 -0600 Subject: [PATCH 2/3] Update README.md --- README.md | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 2761f15..ba8cea0 100644 --- a/README.md +++ b/README.md @@ -62,12 +62,12 @@ Select "MCP" from the left sidebar and click "Add new global MCP server". Add the following config: ```json { - "mcpServers": { - "resend": { - "type": "command", - "command": "node ABSOLUTE_PATH_TO_MCP_SEND_EMAIL_PROJECT/build/index.js --key=YOUR_RESEND_API_KEY" - } - } + "mcpServers": { + "resend": { + "type": "command", + "command": "node ABSOLUTE_PATH_TO_MCP_SEND_EMAIL_PROJECT/build/index.js --key=YOUR_RESEND_API_KEY" + } + } } ``` @@ -101,18 +101,19 @@ Open Claude Desktop settings and navigate to the "Developer" tab. Click `Edit Co Add the following config: -```json{ - "mcpServers": { - "resend": { - "command": "node", - "args": [ - "ABSOLUTE_PATH_TO_MCP_SEND_EMAIL_PROJECT/build/index.js" - ], - "env": { - "RESEND_API_KEY": "YOUR_RESEND_API_KEY", - } - } +```json +{ + "mcpServers": { + "resend": { + "command": "node", + "args": [ + "ABSOLUTE_PATH_TO_MCP_SEND_EMAIL_PROJECT/build/index.js" + ], + "env": { + "RESEND_API_KEY": "YOUR_RESEND_API_KEY", + } } + } } ``` @@ -131,4 +132,6 @@ You can get the absolute path to your build script by right-clicking on the `/bu Close and reopen Claude Desktop. Verify that the `resend` tool is available in the Claude developer settings. -Chat with Claude and tell it to send you an email using the `resend` tool. \ No newline at end of file +![Claude Desktop developer settings with Resend MCP server showing](https://github.com/user-attachments/assets/be9549e5-eaef-4946-b10a-e708c1864acf) + +Chat with Claude and tell it to send you an email using the `resend` tool. From 7e2d81695a6b33ffb8f8d4c4f6087971a08e975d Mon Sep 17 00:00:00 2001 From: cpenned <66193019+cpenned@users.noreply.github.com> Date: Thu, 24 Apr 2025 13:21:20 -0600 Subject: [PATCH 3/3] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index ba8cea0..1911e8f 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,7 @@ https://github.com/user-attachments/assets/8c05cbf0-1664-4b3b-afb1-663b46af3464 ## Setup -Currently, you must build the project locally to use this MCP server. Once you have the project built, you can point either in [Cursor](#cursor) or [Claude Desktop](#claude-desktop) to the MCP server script. - -Once you configure the MCP server, you can use it in any Cursor or Claude Desktop chat. +Currently, you must build the project locally to use this MCP server. Then add the server in [Cursor](#cursor) or [Claude Desktop](#claude-desktop) to use it in any Cursor or Claude Desktop chat. 1. Clone this project locally.