Skip to main content
Glama
SendGrid MCP Server

SendGrid MCP Server

by bhoggard

SendGrid MCP Server

一个 Python MCP(Model Context Protocol)服务器,让 AI 助手能够发送 电子邮件并通过 SendGrid 的 Web API v3 管理联系人。

工具

工具

描述

send_email

向一个或多个收件人发送纯文本/HTML 电子邮件

get_template_info

检查动态模板的结构

send_template_email

通过带替换数据的动态模板发送

add_contact

添加/更新营销联系人(由 SendGrid 异步处理)

search_contacts

使用有界 SGQL 查询搜索联系人

get_contact_lists

列出已命名的营销联系人列表

authenticate_domain

为新的发信域名启动域名身份验证,返回需要添加的 DNS 记录

list_domain_authentications

列出域名及其验证状态

validate_domain_authentication

添加记录后重新检查 DNS

delete_domain_authentication

移除域名身份验证

Related MCP server: sendcraft-mcp

设置

  1. 创建虚拟环境并安装依赖项:

    python -m venv venv
    source venv/bin/activate   # Windows: venv\Scripts\activate
    pip install -r requirements.txt
  2. 将 .env.example 复制为 .env,并填写你的 SendGrid API 密钥 (SendGrid 控制台中的 Settings > API Keys)和默认发件人:

    cp .env.example .env
  3. 发送前,请在 SendGrid 的 Settings > Sender Authentication 下验证你的发件人邮箱, 未验证的发件人将被拒绝。

  4. (可选)在 Email API > Dynamic Templates 下创建动态模板, 并在 .env 中设置 DEFAULT_TEMPLATE_ID。

运行

python main.py

这会通过 stdio 运行服务器,这是 Claude Desktop 等 MCP 客户端 对本地子进程所期望的传输方式。

验证是否正常工作

python smoke_test.py

列出已注册的工具,并对你的 SendGrid 账户发起一次实时调用。如需进行交互式 schema/工具检查:

npx @modelcontextprotocol/inspector python main.py

连接到 Claude Desktop

添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "sendgrid-mcp": {
      "command": "python",
      "args": ["/path/to/twilio-sendgrid-mcp/main.py"],
      "cwd": "/path/to/twilio-sendgrid-mcp",
      "env": {
        "SENDGRID_API_KEY": "SG.your-actual-api-key-here"
      }
    }
  }
}

之后重启 Claude Desktop。如果某个工具调用失败,请检查 ~/Library/Logs/Claude/mcp*.log(macOS)以查看服务器的 stderr 输出。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables comprehensive email marketing and transactional email operations through SendGrid's API v3. Supports contact management, campaign creation, email automation, list management, and email sending with built-in read-only safety mode.
      58
      1,553 npm
      4
      ISC
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to send emails, manage campaigns, subscribers, templates, and domains via the SendCraft email API.
      26
      14 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI models to send emails, manage contacts, and interact with SendGrid's email platform via MCP.
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables querying SendGrid email statistics, blocked addresses, and bounces through the SendGrid v3 API, allowing AI agents to retrieve delivery metrics and lists of problematic recipients.
      1,721 npm
      MIT