SendGrid MCP Server
Manages SendGrid email workflows including design library, transactional templates, marketing contacts and lists, single sends, and direct email sends via the SendGrid v3 API.
README
SendGrid MCP Server
An MCP stdio server for managing SendGrid email workflows from Codex and other MCP clients.
It supports:
- Design Library assets
- Dynamic transactional templates and versions
- Marketing contacts and contact lists
- Single Sends
- Direct email sends
- Stats, email validation, verified senders, and suppression groups
The server uses SendGrid v3 APIs only. It never hardcodes API keys; provide SENDGRID_API_KEY through the environment.
Install
Requires Node.js 24 or newer.
git clone https://github.com/coopersully/sendgrid-mcp.git
cd sendgrid-mcp
npm install
npm run build
Codex Configuration
Add the server to ~/.codex/config.toml:
[mcp_servers.sendgrid]
command = "node"
args = ["/absolute/path/to/sendgrid-mcp/build/index.js"]
env = { SENDGRID_API_KEY = "SG.your-api-key" }
Prefer setting the key in your local environment or secret store instead of writing it into a shared file.
Recommended auto-approval policy: approve read-only tools only. Require review for tools that send email, mutate contacts, update templates/designs, or delete anything.
Read-only tools that are usually safe to auto-approve:
[
"list_contacts",
"list_contact_lists",
"get_contacts_by_list",
"get_contacts_by_emails",
"get_contact_by_id",
"get_total_contact_count",
"get_contact_list",
"get_list_contact_count",
"list_custom_fields",
"list_segments",
"list_templates",
"get_template",
"get_template_version",
"list_designs",
"get_design",
"list_pre_built_designs",
"get_pre_built_design",
"list_single_sends",
"get_single_send",
"search_single_sends",
"get_single_send_schedule",
"list_single_send_categories",
"list_single_send_stats",
"get_single_send_stats",
"list_verified_senders",
"list_suppression_groups",
"list_group_suppressions",
"list_global_suppressions",
"list_bounces",
"list_blocks",
"list_invalid_emails",
"list_spam_reports",
"list_marketing_senders",
"get_marketing_sender",
"get_stats",
"validate_email"
]
Tool Groups
Design Library
| Tool | Purpose | Mutates |
|---|---|---|
list_designs |
List account designs with optional page_size, page_token, and summary. Returns pagination metadata when SendGrid provides it. |
No |
get_design |
Retrieve a design, including editable content fields returned by SendGrid. | No |
create_design |
Create a design from name, subject, HTML/plain content, editor, categories, and plain-text generation options. | Yes |
update_design |
Patch an existing design. Requires at least one editable field. | Yes |
duplicate_design |
Copy an existing account design. | Yes |
delete_design |
Permanently delete a design. Requires confirm_delete: true. |
Yes |
list_pre_built_designs |
List SendGrid pre-built designs. | No |
get_pre_built_design |
Retrieve a pre-built design. | No |
duplicate_pre_built_design |
Copy a pre-built design into the account. | Yes |
Dynamic Templates
| Tool | Purpose | Mutates |
|---|---|---|
list_templates |
List dynamic transactional templates. | No |
get_template |
Retrieve a template and its versions. | No |
create_template |
Create a dynamic template and an initial active version. | Yes |
update_template_name |
Rename a template. | Yes |
duplicate_template |
Copy a template using SendGrid's native duplicate endpoint. | Yes |
delete_template |
Permanently delete a template. Requires confirm_delete: true. |
Yes |
get_template_version |
Retrieve one version's content and active state. | No |
create_template_version |
Create a new version. Defaults to inactive with active: 0. |
Yes |
activate_template_version |
Activate an existing version for future sends. | Yes |
update_template_version |
Directly patch a version. Prefer creating a new version for reviewable edits. | Yes |
delete_template_version |
Permanently delete a version. Requires confirm_delete: true. |
Yes |
Safe editing workflow:
- Call
get_template. - Call
get_template_versionfor the active version. - Call
create_template_versionwith edited content and leaveactiveomitted or set to0. - Inspect the returned version.
- Call
activate_template_versiononly after approval.
Contacts and Lists
| Tool | Purpose | Mutates |
|---|---|---|
list_contacts |
List marketing contacts. | No |
add_contact |
Upsert one contact. | Yes |
delete_contacts |
Permanently delete contacts by email. Requires confirm_delete: true. |
Yes |
get_contacts_by_emails |
Retrieve contacts by email addresses. | No |
get_contact_by_id |
Retrieve one contact by SendGrid contact ID. | No |
get_total_contact_count |
Retrieve total marketing contact count. | No |
list_contact_lists |
List contact lists. | No |
get_contact_list |
Retrieve one contact list by ID. | No |
create_contact_list |
Create a list. | Yes |
update_contact_list |
Rename a contact list. | Yes |
delete_list |
Delete a list. Requires confirm_delete: true. |
Yes |
get_list_contact_count |
Retrieve contact count for one list. | No |
get_contacts_by_list |
List contacts in a list. | No |
add_contacts_to_list |
Add emails to a list. | Yes |
remove_contacts_from_list |
Remove emails from a list without deleting contacts. | Yes |
Custom Fields and Segments
| Tool | Purpose | Mutates |
|---|---|---|
list_custom_fields |
List marketing contact custom field definitions. | No |
create_custom_field |
Create a custom field definition. | Yes |
update_custom_field |
Rename a custom field definition. | Yes |
delete_custom_field |
Delete a custom field definition. Requires confirm_delete: true. |
Yes |
list_segments |
List Segments v2 segments. | No |
create_segment |
Create a segment from name and query_dsl. |
Yes |
get_segment |
Retrieve one segment. | No |
update_segment |
Update a segment name or query DSL. | Yes |
refresh_segment |
Refresh a segment. | Yes |
delete_segment |
Delete a segment. Requires confirm_delete: true. |
Yes |
Sending
| Tool | Purpose | Mutates |
|---|---|---|
send_email |
Send one email through SendGrid Mail Send. | Yes |
send_to_list |
Create and immediately schedule a Single Send to lists or segments. Requires either suppression_group_id or custom_unsubscribe_url. |
Yes |
create_single_send |
Create a Single Send draft without scheduling it. | Yes |
update_single_send |
Patch a Single Send draft. | Yes |
delete_single_send |
Delete a Single Send. Requires confirm_delete: true. |
Yes |
duplicate_single_send |
Duplicate a Single Send. | Yes |
search_single_sends |
Search Single Sends with SendGrid query syntax. | No |
schedule_single_send |
Schedule an existing Single Send for now or a future timestamp. |
Yes |
get_single_send_schedule |
Retrieve schedule information for a Single Send. | No |
cancel_single_send_schedule |
Cancel a Single Send schedule without deleting the draft. | Yes |
list_single_send_categories |
List Single Send categories. | No |
list_single_send_stats |
Retrieve Single Sends stats. | No |
get_single_send_stats |
Retrieve stats for one Single Send. | No |
list_single_sends |
List Single Sends. | No |
get_single_send |
Retrieve one Single Send. | No |
Suppressions, Senders, Stats, and Validation
| Tool | Purpose | Mutates |
|---|---|---|
list_verified_senders |
List verified sender identities. | No |
list_suppression_groups |
List unsubscribe groups. | No |
list_group_suppressions |
List suppressed addresses in a suppression group. | No |
add_group_suppressions |
Add addresses to a suppression group. | Yes |
delete_group_suppression |
Remove an address from a suppression group. Requires confirm_delete: true. |
Yes |
list_global_suppressions |
List global suppressions. | No |
add_global_suppressions |
Add addresses to global suppressions. | Yes |
delete_global_suppression |
Remove an address from global suppressions. Requires confirm_delete: true. |
Yes |
list_bounces |
List bounce suppressions. | No |
list_blocks |
List block suppressions. | No |
list_invalid_emails |
List invalid email suppressions. | No |
list_spam_reports |
List spam report suppressions. | No |
list_marketing_senders |
List Marketing sender identities. | No |
get_marketing_sender |
Retrieve one Marketing sender identity. | No |
create_marketing_sender |
Create a Marketing sender identity. | Yes |
update_marketing_sender |
Update a Marketing sender identity. | Yes |
delete_marketing_sender |
Delete a Marketing sender identity. Requires confirm_delete: true. |
Yes |
resend_marketing_sender_verification |
Resend a sender verification email. | Yes |
get_stats |
Retrieve email stats for start_date, optional end_date, and optional aggregation. |
No |
validate_email |
Validate one email address. | No |
Safety Behavior
- Tool schemas are closed with
additionalProperties: false. - Tool arguments are validated before SendGrid is called.
- Empty strings, wrong primitive types, empty arrays, unexpected arguments, and missing required fields are rejected locally.
- Destructive delete tools require
confirm_delete: true. - Template content edits are safe by default through
create_template_version, which creates inactive versions unlessactive: 1is explicitly provided. - Server error logging avoids dumping raw error objects to stderr.
Development
npm ci
npm run check
npm run check runs formatting, ESLint, TypeScript type checks, Vitest coverage, build, and npm audit.
Tests use Vitest with mocked SendGrid clients. They do not make live API calls.
Useful commands:
npm run format
npm run lint
npm run typecheck
npm run test:coverage
npm run watch
npm run inspector
CI runs the same validation gates on Node.js 24 and 26.
Architecture and code standards live in docs/ARCHITECTURE.md.
Notes
- The API key must have the SendGrid permissions required for the tools you use.
- Sender addresses must be verified before sending.
- Bulk sends must include either a suppression group or custom unsubscribe URL.
- SendGrid Marketing API changes can be eventually consistent; recently changed contacts and lists may not appear immediately.
- Use least-privilege API keys when possible, especially for agents that only need template/design management.
References
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。