communitystdio

SendGrid MCP Server

Send transactional email, check delivery stats, and manage contacts from Claude Code or Cursor using a SendGrid API key.

Updated: April 15, 2026

Install

npx mcp-server-sendgrid
~/.claude/settings.json
{
  "mcpServers": {
    "sendgrid-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-sendgrid"
      ],
      "env": {
        "SENDGRID_API_KEY": "SG.xxx"
      }
    }
  }
}

Capabilities

  • + Send transactional emails with HTML, plain text, or template IDs
  • + View email activity and delivery stats with date-range filters
  • + Manage contacts and lists including create, add, and remove members
  • + Check suppression and bounce lists to avoid sending to bad addresses
  • + Validate email addresses using the built-in validation endpoint

Limitations

  • - Requires a SendGrid API key with at least `Mail Send` permission
  • - No template editor access via MCP; you create templates in the SendGrid web UI
  • - Bulk sending is throttled; API tier determines sends per second
  • - Delivery events (open, click, bounce) arrive via webhooks only - not polled here

SendGrid MCP server setup for Claude Code and Cursor

Quick answer: The SendGrid MCP server wraps the SendGrid API as MCP tools for Claude Code and Cursor. Drop in the env vars, run one npx command, and the editor can reach the service directly. Setup takes about 3 minutes, tested on mcp-server-sendgrid@0.4.1 on April 15, 2026.

SendGrid (a Twilio product) is the transactional email backbone for a large share of SaaS companies. A single API key handles both marketing and transactional sends. Without an MCP connection, working with SendGrid means flipping between the editor and the web UI - copying IDs, pasting results, losing context. The MCP server removes that loop. Claude can fetch the data itself, reason about it, and write changes back without you switching tabs.

This guide covers install, config for both editors, prompt patterns that actually work, and the places where the API will bite back.

What this server does

The server speaks MCP over stdio and wraps the standard SendGrid SDK. The tool surface is grouped into these sets:

  • Mail: send_email, send_template, schedule_email
  • Stats: get_stats, list_activity, get_activity_detail
  • Contacts: list_contacts, create_contact, update_contact, list_lists, add_to_list
  • Validation: validate_email, check_suppression

Authentication uses SENDGRID_API_KEY. The server holds credentials in process memory for the life of the subprocess. Nothing is written to disk by the server itself. If you rotate the credential, restart the MCP server and the new value takes effect immediately.

The server does not implement a local cache. Every tool call is a fresh round trip. For most workflows this is fine - round trip times are 100-400 ms - but it adds up on heavy batch jobs. For those, prefer the native SDK in a script.

Installing the server

The package ships on npm as mcp-server-sendgrid. The npx -y prefix fetches on first launch and caches the binary for subsequent runs. Cold pull is typically 3-8 MB depending on the SDK footprint and lands in 2-4 seconds.

Before touching editor config, get your credentials ready:

  1. Sign in at app.sendgrid.com
  2. Navigate to Settings > API Keys and click Create API Key
  3. Pick Restricted Access and enable Mail Send, Stats, and Marketing Campaigns > Read as needed
  4. Copy the key immediately; it starts with SG. and is only shown once

Keep the credential values out of any file you commit. The rest of this guide assumes they live in your shell profile or a .envrc managed by direnv.

Configuring for Claude Code

Claude Code reads MCP servers from ~/.claude/mcp.json or a per-project .mcp.json. Add a sendgrid entry:

{
  "mcpServers": {
    "sendgrid": {
      "command": "npx",
      "args": ["-y", "mcp-server-sendgrid"],
      "env": {
        "SENDGRID_API_KEY": "SG.xxx"
      }
    }
  }
}

Restart Claude Code, then run /mcp in a session to confirm SendGrid is attached. Call a read-only tool as a smoke test before any write operations. If the first call returns real data, the auth is working and you can widen the prompt scope.

For team projects, commit a placeholder version of .mcp.json with ${VAR_NAME} inside the env values and let each developer provide the real credential via their shell. Claude Code expands env vars when it spawns the subprocess.

Configuring for Cursor

Cursor uses the same MCP spec and reads from ~/.cursor/mcp.json. The config is identical to Claude Code:

{
  "mcpServers": {
    "sendgrid": {
      "command": "npx",
      "args": ["-y", "mcp-server-sendgrid"],
      "env": {
        "SENDGRID_API_KEY": "SG.xxx"
      }
    }
  }
}

Open Cursor settings, navigate to the MCP tab, and toggle the server on. Cursor spawns the subprocess lazily on the first tool call. Expect 2-4 seconds of cold start and 150-500 ms per subsequent call depending on network latency to the upstream API.

If the Cursor UI shows the server as red, click the refresh icon and watch the error log. Most failures at this stage are a missing env var or a wrong file path in the credential config.

Example prompts and workflows

A few prompts that work reliably once the server is attached:

  • "Send an email to alex@acme.com from hi@mysite.com with subject Welcome and body Thanks for signing up."
  • "Pull the delivery stats for the last 7 days and show the bounce rate and block rate."
  • "List all contacts in list newsletter-q2 and count the ones who have never opened an email."
  • "Validate test@invalid-domain.xyz and tell me if it is deliverable."
  • "Send a template email using template ID d-abc123 to pro@acme.com with variables {firstName: 'Pro'}."

The model will chain calls. A deliverability audit usually runs get_stats over 30 days, then list_activity with a bounce filter, then check_suppression on the top offenders. Tell Claude the exact date range up front; open-ended last week prompts often return the current week only because of time zone slippage.

One pattern that saves calls: narrow the scope up front. Instead of asking Claude to list every record and then filter, include the filter in the first prompt. The tool returns less data, the response is faster, and the model has less noise to reason through.

Troubleshooting

Tool call returns 401. API key is wrong or disabled. Check the Settings > API Keys page and regenerate if needed.

Send returns 403 on a verified sender. The sender email or domain is not verified. Finish Single Sender verification or set up Domain Authentication (SPF + DKIM) before sending.

High bounce rate. Your list has stale addresses. Run check_suppression to see entries on the bounce list and remove them from your contacts. Consider email validation on signup to avoid future bounces.

Template variables not rendering. Handlebars syntax in templates expects {{firstName}}, not {firstName}. Double-check the template in the web UI and match variable names exactly when passing dynamic data.

Rate limit errors. Free tier is 100 emails per day. Paid tiers scale up but have per-second caps (Pro is 600/second, higher on Premier). Batch sends with the personalizations array to hit up to 1,000 recipients in one call.

Server fails with ENOENT. npx is not on PATH in the env the editor inherits. On macOS, launch Claude Code or Cursor from a terminal so it inherits your shell env, or put the absolute path to npx in the command field.

Subprocess keeps restarting. The MCP transport is strict about newlines on stdio. If the server logs to stdout, those lines get treated as MCP messages and crash the client. Make sure any logging goes to stderr only (most well-built servers already do this).

Alternatives

A few options if the SendGrid server does not fit your setup:

  • postmark-mcp is focused on transactional email with strong deliverability reputation.
  • resend-mcp is the newer entrant that integrates well with React Email for developer-heavy teams.
  • amazon-ses-mcp offers the cheapest per-email cost for teams already in the AWS ecosystem.

The MCP server pays off for support and ops teams who need to trigger one-off sends, debug deliverability, or inspect stats during an incident - all without leaving the editor.

Performance notes and hardening

Steady-state call latency lands in the 150-500 ms range for most tools. For latency-sensitive workflows, place the editor close to the upstream API region - a Claude Code session in us-east-1 calling an EU-only endpoint will see 120+ ms of extra RTT on every tool call.

For production credentials, prefer scoped tokens over root credentials. Most services expose fine-grained permission models; use them. A token that can only read is strictly safer than one that can write, and costs nothing to rotate.

Log review is easier if you redirect MCP subprocess stderr to a file. Most editors do this by default, but not all surface the log path. On macOS, check ~/Library/Logs/Claude/ or the Cursor equivalent.

The SendGrid MCP server is the right default for any workflow that already touches SendGrid regularly. A few minutes of setup replaces hours of copy-paste between the editor and the service's web UI. Start with a read-only credential scoped to a single resource, then widen scopes after you trust the prompt patterns your team develops.

Guides

Frequently asked questions

What permissions does the API key need?

At minimum `Mail Send`. Add `Stats` for activity queries, `Marketing Campaigns` for list and contact management, and `Email Validation` if you use the validate endpoint. Keep the key restricted to the minimum set you need.

Can I use the server for marketing campaigns?

Partial support. The tool set covers list management, contact updates, and template sends. The campaign editor and scheduler live in the SendGrid web UI and are not exposed as MCP tools.

How do I handle unsubscribes?

SendGrid manages a global unsubscribe list. Sends to suppressed addresses are dropped at the API layer without hitting the recipient. Use `check_suppression` to see who is on the list and why.

Is there a sandbox mode?

Yes. Pass `mail_settings.sandbox_mode.enable=true` in the send call and SendGrid validates the payload without actually sending. Useful for CI tests and for dry-runs before a batch.

Does it support EU data residency?

SendGrid has a EU region but the MCP server defaults to the global API host. Pass `SENDGRID_API_HOST=https://api.eu.sendgrid.com` in the env to route through the EU region.

How do I track clicks and opens?

Click and open tracking is on by default for HTML emails. Events stream via webhooks, not through this server. Point the webhook at a collector (a Lambda or a small Node endpoint) and query that from Claude if you need live event data.