All integrations

SendGrid

Connect Claude, ChatGPT or Cursor to SendGrid via MCP. Read email activity, bounce suppressions, and delivery stats with an API key.

Manual setup 5 tools

Example questions

Try asking your AI client

  • How did SendGrid delivery look over the last 7 days?

  • Did the receipt email to Jack ever bounce?

  • Which addresses bounced in the last 6 hours?

  • Write a short deliverability brief for Amalie - do not send mail.

  • Find the events for the password-reset message I sent yesterday.

Overview

Connect SendGrid so AI clients can read transactional email activity, bounce suppressions, and delivery stats (delivered, opens, clicks) via the SendGrid v3 API.

This integration is read-first. Sending mail or deleting suppressions is not included. Use it to confirm whether a receipt, password reset, or marketing send was delivered.

This is not mailbox access. For Gmail or Outlook, use those integrations. For IMAP/SMTP inboxes, use Email.

Prerequisites

  • A SendGrid account
  • An API key with Mail Settings read access (bounces and stats)
  • Email Activity History add-on and Email Activity permission for message search
  • A stackgate.ai account

Getting credentials

  1. Sign in to the SendGrid console.
  2. Open Settings → API Keys → Create API Key.
  3. Choose Restricted Access. Enable Email Activity (read) and Mail Settings (read) at minimum. Do not enable Mail Send.
  4. Copy the key immediately. It starts with SG. and is shown only once.
  5. Optional: to query a subuser, copy that subuser username. stackgate.ai sends it as the On-Behalf-Of header.
  6. In stackgate.ai, open My Integrations → SendGrid.
  7. Paste the API key. Add the subuser username only when tools should run as that subuser.
  8. Save. stackgate.ai verifies the key against GET /v3/user/account and stores it encrypted.
  9. Optionally use Edit tool access to keep the connection read-only.

See the SendGrid v3 API and Email Activity.

Credentials reference

Field Required Where to find it Notes
API key Yes Settings → API Keys Starts with SG.; stored encrypted
Subuser username No Settings → Subuser Management Sent as On-Behalf-Of on every request

Permission model

Permission / Scope Why it is needed Access level
Email Activity (read) list_messages, search_messages, get_message Read
Mail Settings (read) list_bounces and global get_stats Read

SendGrid does not use OAuth for this connect flow. Prefer a restricted key without Mail Send.

Using with AI clients

  • Dedicated endpoint: POST /mcp/sendgrid with a Sanctum bearer token
  • Private gateway: one config for all integrations - use sendgrid__* namespaced tools

Example prompts:

  • "Show SendGrid delivery stats for the last 7 days."
  • "List recent SendGrid bounces."
  • "Search SendGrid messages to billing@example.com for subject Receipt."
  • "Get SendGrid message ID abc123 and list its events."

Troubleshooting

Problem Likely cause Fix
422 integration not configured Form not saved Complete the API key in My Integrations
401 Unauthorized Wrong or rotated key Create a new key and reconnect
Invalid API key format Key missing SG. prefix Paste the full key from Settings → API Keys
403 on list_messages Email Activity add-on or permission missing Enable Email Activity on the key, or use get_stats and list_bounces
403 on a subuser Wrong username or parent key cannot act on that subuser Confirm the subuser username
429 Too many requests SendGrid burst limits Retry after a short delay and keep limit small

Security and revocation

  • Disconnect SendGrid in My Integrations to delete the stored API key from stackgate.ai.
  • Revoke the key in SendGrid Settings → API Keys if you suspect leakage.
  • Recipient addresses and subjects in tool results are PII. Prefer message IDs, event types, and counts in Slack or ticket summaries.
  • Audit logs record tool names and arguments. Avoid pasting raw recipient lists into public prompts.
  • stackgate.ai encrypts credentials at rest and does not keep message bodies unless you copy them to Temp Storage.

Limitations

  • Read-only MVP: no send, no suppression delete, no template or marketing campaign writes.
  • list_messages, search_messages, and get_message require the Email Activity add-on.
  • Email Activity queries use SendGrid syntax such as to_email="user@example.com" AND subject="Receipt".
  • Stats start_date is required (YYYY-MM-DD). Bounce windows use unix timestamps.
  • List tools default to small pages to limit PII in model context.

Available tools

  • list_messages

    List recent SendGrid Email Activity messages. Requires Email Activity API access. Prefer search_messages when filtering by recipient or subject.

  • get_message

    Get one SendGrid Email Activity message by ID, including events and timestamps.

  • search_messages

    Search SendGrid Email Activity with query syntax. Examples: to_email="user@example.com", subject="Receipt", from_email="billing@acme.com" AND status="delivered". Combine filters with AND.

  • list_bounces

    List SendGrid bounce suppressions. Optional unix start_time and end_time window.

  • get_stats

    Get SendGrid global email stats (requests, delivered, opens, clicks, bounces) for a date range.

MCP endpoint: https://stackgate.ai/mcp/sendgrid (HTTP) or via the private gateway.

Related workflows

Multi-integration playbooks that use SendGrid to solve concrete business outcomes.