Skip to main content
SE

SendGrid

v0.2.1API Key

Email (transacional + marketing), do grupo Twilio. Completa a cobertura de canais: o Twilio cuida de SMS/WhatsApp/Voz, o SendGrid cuida de email. Enviar email, templates, CRUD de contatos, suppressions, stats.

20 ferramentas2 env vars🌐 GLOBALestável no npm

O que seu agente faz

O SendGrid dá ao seu agente 20 tools que ele chama direto — escolha as que precisar, no Claude, Cursor ou qualquer cliente MCP.

  • send_mailSend 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.
  • send_templateConvenience 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.
  • add_contactUpsert contacts in Marketing Campaigns via PUT /marketing/contacts. Matches on email. Returns a job_id — ingestion is async. Optionally assign to list_ids.
Exemplo de chamada
// Your agent calls a tool directly — no glue code.
// CodeSpar's managed tier handles OAuth2, token rotation and rate limits.
const result = await session.call("send_mail", { /* ... */ });

Instalar

terminal
$ npm install @codespar/mcp-sendgrid

Quickstart

Adicione esta entrada ao seu claude_desktop_config.json (ou a config de qualquer cliente compatível com MCP).

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

Depois de reiniciar, seu agente pode chamar qualquer uma das 20 ferramentas abaixo — teste send_mail primeiro.

Variáveis de ambiente · 2

Necessárias pra autenticar o server. Armazenadas criptografadas ao usar a hospedagem gerenciada da CodeSpar.

SENDGRID_API_KEY
obrigatóriosecret

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

SENDGRID_FROM_EMAIL
opcional

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

Ferramentas disponíveis · 20

Cada ferramenta é independente — seu agente carrega só o que precisa pra reduzir contexto e tempo de resposta.

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.

Frameworks compatíveis

MCP é um protocolo — qualquer framework que o fale pode montar este server.

Claude Agent SDKAnthropic
OpenAI AgentsOpenAI
Vercel AI SDKVercel
LangChainLangChain
LlamaIndexLlamaIndex
CrewAICrewAI
MastraMastra
Qualquer cliente MCPProtocolo

Perguntas frequentes

Rode `npx -y @codespar/mcp-sendgrid` e adicione o bloco de config acima ao seu cliente MCP — Claude, Cursor, VS Code ou qualquer cliente compatível com MCP. Sem build, sem SDK. Prefere hospedado? O tier gerenciado da CodeSpar roda pra você, com a auth resolvida.
SendGrid — MCP server · 20 tools | CodeSpar