sendgrid mcp
Provides an interface to manage email marketing, contact lists, dynamic templates, and email analytics via SendGrid's API.
Provides an interface to manage email marketing, contact lists, dynamic templates, and email analytics via SendGrid's API.
A Model Context Protocol (MCP) server that provides access to SendGrid's Marketing API for email marketing and contact management. https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api
In this demo, we ask the Cline SendGrid agent to make a new contact list, add my emails to it, automatically generate a template for Lost Cities facts, and send the email to the list. In this process, Cline will automatically realize that it needs to know the verified senders we have, and which unsubscribe group to use. A pretty email is delivered to my inboxes, delighting me with Lost Cities!
This server exclusively supports SendGrid's v3 APIs and does not provide support for legacy functionality. This includes:
Lists all contacts in your SendGrid account.
// No parameters required
Add a contact to your SendGrid marketing contacts.
{
email: string; // Required: Contact email address
first_name?: string; // Optional: Contact first name
last_name?: string; // Optional: Contact last name
custom_fields?: object; // Optional: Custom field values
}
Delete contacts from your SendGrid account.
{
emails: string[]; // Required: Array of email addresses to delete
}
Get all contacts in a SendGrid list.
{
list_id: string; // Required: ID of the contact list
}
List all contact lists in your SendGrid account.
// No parameters required
Create a new contact list in SendGrid.
{
name: string; // Required: Name of the contact list
}
Delete a contact list from SendGrid.
{
list_id: string; // Required: ID of the contact list to delete
}
Add contacts to an existing SendGrid list.
{
list_id: string; // Required: ID of the contact list
emails: string[]; // Required: Array of email addresses to add
}
Remove contacts from a SendGrid list without deleting them.
{
list_id: string; // Required: ID of the contact list
emails: string[]; // Required: Array of email addresses to remove
}
Send an email using SendGrid.
{
to: string; // Required: Recipient email address
subject: string; // Required: Email subject line
text: string; // Required: Plain text content
from: string; // Required: Verified sender email address
html?: string; // Optional: HTML content
template_id?: string; // Optional: Dynamic template ID
dynamic_template_data?: object; // Optional: Template variables
}
Send an email to a contact list using SendGrid Single Sends.
{
name: string; // Required: Name of the single send
list_ids: string[]; // Required: Array of list IDs to send to
subject: string; // Required: Email subject line
html_content: string; // Required: HTML content
plain_content: string; // Required: Plain text content
sender_id: number; // Required: ID of the verified sender
suppression_group_id?: number; // Required if custom_unsubscribe_url not provided
custom_unsubscribe_url?: string; // Required if suppression_group_id not provided
}
Create a new dynamic email template.
{
name: string; // Required: Name of the template
subject: string; // Required: Default subject line
html_content: string; // Required: HTML content with handlebars syntax
plain_content: string; // Required: Plain text content with handlebars syntax
}
List all dynamic email templates.
// No parameters required
Retrieve a template by ID.
{
template_id: string; // Required: ID of the template to retrieve
}
Delete a dynamic template.
{
template_id: string; // Required: ID of the template to delete
}
Get SendGrid email statistics.
{
start_date: string; // Required: Start date (YYYY-MM-DD)
end_date?: string; // Optional: End date (YYYY-MM-DD)
aggregated_by?: 'day' | 'week' | 'month'; // Optional: Aggregation period
}
Validate an email address using SendGrid.
{
email: string; // Required: Email address to validate
}
List all verified sender identities.
// No parameters required
List all unsubscribe groups.
// No parameters required
git clone https://github.com/Garoth/sendgrid-mcp.git
cd sendgrid-mcp
npm install
Save the API key securely as it won't be shown again
Add it to your Cline MCP settings file inside VSCode's settings (ex. ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):
{
"mcpServers": {
"sendgrid": {
"command": "node",
"args": ["/path/to/sendgrid-mcp/build/index.js"],
"env": {
"SENDGRID_API_KEY": "your-api-key-here"
},
"disabled": false,
"autoApprove": [
"list_contacts",
"list_contact_lists",
"list_templates",
"list_single_sends",
"get_single_send",
"list_verified_senders",
"list_suppression_groups",
"get_stats",
"validate_email"
]
}
}
}
Note: Tools that modify data (like sending emails or deleting contacts) are intentionally excluded from autoApprove for safety.
The tests use real API calls to ensure accurate responses. To run the tests:
Copy the example environment file:
cp .env.example .env
Edit .env
and add your SendGrid API key:
SENDGRID_API_KEY=your-api-key-here
Note: The .env
file is gitignored to prevent committing sensitive information.
Run the tests:
npm test
npm run build
MIT
SendGrid logo copyright / owned by Twilio
[
{
"description": "Delete contacts from your SendGrid account",
"inputSchema": {
"properties": {
"emails": {
"description": "Array of email addresses to delete",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"emails"
],
"type": "object"
},
"name": "delete_contacts"
},
{
"description": "List all contacts in your SendGrid account",
"inputSchema": {
"properties": {},
"required": [],
"type": "object"
},
"name": "list_contacts"
},
{
"description": "Send an email using SendGrid",
"inputSchema": {
"properties": {
"dynamic_template_data": {
"description": "Dynamic data for template variables (optional)",
"type": "object"
},
"from": {
"description": "Sender email address (must be verified with SendGrid)",
"type": "string"
},
"html": {
"description": "HTML content of the email (optional)",
"type": "string"
},
"subject": {
"description": "Email subject line",
"type": "string"
},
"template_id": {
"description": "SendGrid template ID (optional)",
"type": "string"
},
"text": {
"description": "Plain text content of the email",
"type": "string"
},
"to": {
"description": "Recipient email address",
"type": "string"
}
},
"required": [
"to",
"subject",
"text",
"from"
],
"type": "object"
},
"name": "send_email"
},
{
"description": "Add a contact to your SendGrid marketing contacts",
"inputSchema": {
"properties": {
"custom_fields": {
"description": "Custom field values (optional)",
"type": "object"
},
"email": {
"description": "Contact email address",
"type": "string"
},
"first_name": {
"description": "Contact first name (optional)",
"type": "string"
},
"last_name": {
"description": "Contact last name (optional)",
"type": "string"
}
},
"required": [
"email"
],
"type": "object"
},
"name": "add_contact"
},
{
"description": "Create a new contact list in SendGrid",
"inputSchema": {
"properties": {
"name": {
"description": "Name of the contact list",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"name": "create_contact_list"
},
{
"description": "Add contacts to an existing SendGrid list",
"inputSchema": {
"properties": {
"emails": {
"description": "Array of email addresses to add to the list",
"items": {
"type": "string"
},
"type": "array"
},
"list_id": {
"description": "ID of the contact list",
"type": "string"
}
},
"required": [
"list_id",
"emails"
],
"type": "object"
},
"name": "add_contacts_to_list"
},
{
"description": "Create a new email template in SendGrid",
"inputSchema": {
"properties": {
"html_content": {
"description": "HTML content of the template",
"type": "string"
},
"name": {
"description": "Name of the template",
"type": "string"
},
"plain_content": {
"description": "Plain text content of the template",
"type": "string"
},
"subject": {
"description": "Default subject line for the template",
"type": "string"
}
},
"required": [
"name",
"subject",
"html_content",
"plain_content"
],
"type": "object"
},
"name": "create_template"
},
{
"description": "Retrieve a SendGrid template by ID",
"inputSchema": {
"properties": {
"template_id": {
"description": "ID of the template to retrieve",
"type": "string"
}
},
"required": [
"template_id"
],
"type": "object"
},
"name": "get_template"
},
{
"description": "Delete a dynamic template from SendGrid",
"inputSchema": {
"properties": {
"template_id": {
"description": "ID of the template to delete",
"type": "string"
}
},
"required": [
"template_id"
],
"type": "object"
},
"name": "delete_template"
},
{
"description": "Validate an email address using SendGrid",
"inputSchema": {
"properties": {
"email": {
"description": "Email address to validate",
"type": "string"
}
},
"required": [
"email"
],
"type": "object"
},
"name": "validate_email"
},
{
"description": "Get SendGrid email statistics",
"inputSchema": {
"properties": {
"aggregated_by": {
"description": "How to aggregate the statistics (optional)",
"enum": [
"day",
"week",
"month"
],
"type": "string"
},
"end_date": {
"description": "End date in YYYY-MM-DD format (optional)",
"type": "string"
},
"start_date": {
"description": "Start date in YYYY-MM-DD format",
"type": "string"
}
},
"required": [
"start_date"
],
"type": "object"
},
"name": "get_stats"
},
{
"description": "List all email templates in your SendGrid account",
"inputSchema": {
"properties": {},
"required": [],
"type": "object"
},
"name": "list_templates"
},
{
"description": "Delete a contact list from SendGrid",
"inputSchema": {
"properties": {
"list_id": {
"description": "ID of the contact list to delete",
"type": "string"
}
},
"required": [
"list_id"
],
"type": "object"
},
"name": "delete_list"
},
{
"description": "List all contact lists in your SendGrid account",
"inputSchema": {
"properties": {},
"required": [],
"type": "object"
},
"name": "list_contact_lists"
},
{
"description": "Get all contacts in a SendGrid list",
"inputSchema": {
"properties": {
"list_id": {
"description": "ID of the contact list",
"type": "string"
}
},
"required": [
"list_id"
],
"type": "object"
},
"name": "get_contacts_by_list"
},
{
"description": "List all verified sender identities in your SendGrid account",
"inputSchema": {
"properties": {},
"required": [],
"type": "object"
},
"name": "list_verified_senders"
},
{
"description": "List all unsubscribe groups in your SendGrid account",
"inputSchema": {
"properties": {},
"required": [],
"type": "object"
},
"name": "list_suppression_groups"
},
{
"description": "Send an email to a contact list using SendGrid Single Sends",
"inputSchema": {
"properties": {
"custom_unsubscribe_url": {
"description": "Custom URL for unsubscribes (required if suppression_group_id not provided)",
"type": "string"
},
"html_content": {
"description": "HTML content of the email",
"type": "string"
},
"list_ids": {
"description": "Array of list IDs to send to",
"items": {
"type": "string"
},
"type": "array"
},
"name": {
"description": "Name of the single send",
"type": "string"
},
"plain_content": {
"description": "Plain text content of the email",
"type": "string"
},
"sender_id": {
"description": "ID of the verified sender",
"type": "number"
},
"subject": {
"description": "Email subject line",
"type": "string"
},
"suppression_group_id": {
"description": "ID of the suppression group for unsubscribes (required if custom_unsubscribe_url not provided)",
"type": "number"
}
},
"required": [
"name",
"list_ids",
"subject",
"html_content",
"plain_content",
"sender_id"
],
"type": "object"
},
"name": "send_to_list"
},
{
"description": "Get details of a specific single send",
"inputSchema": {
"properties": {
"single_send_id": {
"description": "ID of the single send to retrieve",
"type": "string"
}
},
"required": [
"single_send_id"
],
"type": "object"
},
"name": "get_single_send"
},
{
"description": "List all single sends in your SendGrid account",
"inputSchema": {
"properties": {},
"required": [],
"type": "object"
},
"name": "list_single_sends"
},
{
"description": "Remove contacts from a SendGrid list without deleting them",
"inputSchema": {
"properties": {
"emails": {
"description": "Array of email addresses to remove from the list",
"items": {
"type": "string"
},
"type": "array"
},
"list_id": {
"description": "ID of the contact list",
"type": "string"
}
},
"required": [
"list_id",
"emails"
],
"type": "object"
},
"name": "remove_contacts_from_list"
}
]