Skip to main content
SE

SendGrid

v0.2.0API Key

Email (transactional + marketing), Twilio-owned. Completes channel coverage: Twilio handles SMS/WhatsApp/Voice, SendGrid handles email. Send mail, templates, contacts CRUD, suppressions, stats.

20 tools2 env vars๐ŸŒ GLOBALstable on npm

Install

terminal
$ npm install @codespar/mcp-sendgrid

Quickstart

Add this entry to your claude_desktop_config.json (or any MCP-compatible client config).

claude_desktop_config.json
{
  "mcpServers": {
    "sendgrid": {
      "command": "npx",
      "args": [
        "-y",
        "@codespar/mcp-sendgrid"
      ],
      "env": {
        "SENDGRID_API_KEY": "<your_sendgrid_api_key>"
      }
    }
  }
}

After restart, your agent can call any of the 20 tools below โ€” try send_mail first.

Environment variables ยท 2

Required to authenticate the server. Stored encrypted when using CodeSpar managed hosting.

SENDGRID_API_KEY
requiredsecret

SendGrid API key. Used as Bearer token in the Authorization header.

SENDGRID_FROM_EMAIL
optional

Optional default From address used by send_mail / send_template when `from.email` is omitted. Must be a Verified Sender or authenticated domain.

Available tools ยท 20

Each tool is independent โ€” your agent loads only what it needs to reduce context and response time.

WRITEsend_mail
Send an email via POST /mail/send. Supply at least one `personalization` with `to` recipients, a `from` address (falls back to SENDGRID_FROM_EMAIL), and either `content` blocks or a `template_id` with `dynamic_template_data`. Returns 202 on success.
WRITEsend_template
Convenience wrapper for POST /mail/send with a dynamic template. Equivalent to send_mail with `template_id` set. Supply `to`, `template_id`, and `dynamic_template_data`; content is rendered from the template.
WRITEadd_contact
Upsert contacts in Marketing Campaigns via PUT /marketing/contacts. Matches on email. Returns a job_id โ€” ingestion is async. Optionally assign to list_ids.
READlist_contacts
List Marketing Campaigns contacts via GET /marketing/contacts. Returns up to 50 sample contacts; for full export use a Contacts Export job.
DELETEdelete_contact
Delete contacts by id via DELETE /marketing/contacts?ids=.... Pass a comma-separated list of contact UUIDs, or set delete_all_contacts=true to wipe all contacts (irreversible).
READsearch_contacts
Search contacts with an SGQL query via POST /marketing/contacts/search. Example: `email LIKE '%@codespar.com' AND CONTAINS(list_ids, 'abc-123')`.
READget_contact
Retrieve a single Marketing Campaigns contact by id via GET /marketing/contacts/{id}. Returns full contact record including custom fields and list_ids.
READlist_lists
List all Marketing Campaigns contact lists via GET /marketing/lists. Returns list UUIDs, names, and contact_count. Supports pagination.

Compatible frameworks

MCP is a protocol โ€” any framework that speaks it can mount this server.

Claude Agent SDKAnthropic
OpenAI AgentsOpenAI
Vercel AI SDKVercel
LangChainLangChain
LlamaIndexLlamaIndex
CrewAICrewAI
MastraMastra
Any MCP clientProtocol

Frequently asked questions

All credentials are encrypted at rest in an isolated vault scoped per organization. OAuth2 tokens are automatically refreshed before expiry. Your agent code never sees raw secrets โ€” it receives scoped, short-lived session tokens.
Servers โ€” Every LatAm commerce API your agent needs | CodeSpar