Back to MCP directory
publicPublicdnsLocal runtime

SendGrid

SendGrid MCP服务器是一个提供SendGrid营销API访问的模型上下文协议服务,支持电子邮件营销和联系人管理功能,包括联系人管理、列表管理、邮件发送、模板管理等操作。

article

README

🚀 发送Grid MCP服务器

本项目提供了一个发送Grid MCP服务器,可帮助你更方便地使用发送Grid的相关功能,实现邮件发送等操作。

🚀 快速开始

要使用本项目,你需要先完成安装和配置,以下是详细步骤。

📦 安装指南

git clone https://github.com/Garoth/sendgrid-mcp.git
cd sendgrid-mcp
npm install

📚 详细文档

配置

  1. 获取你的发送Grid API密钥:

    • 登录到你的发送Grid账户
    • 转到设置 > API密钥
    • 创建一个新的API密钥,权限设为全访问
    • 安全地保存该API密钥,因为一旦生成将无法再次查看
  2. 将其添加到VSCode中的Cline MCP设置文件(例如:~/.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"
      ]
    }
  }
}

⚠️ 重要提示

修改数据的工具(如发送邮件或删除联系人)出于安全考虑,默认不启用自动批准。

开发

设置测试

测试使用真实的API调用以确保准确响应。要运行测试:

  1. 复制示例环境文件:

    cp .env.example .env
    
  2. 编辑.env并添加你的发送Grid API密钥:

    SENDGRID_API_KEY=your-api-key-here
    

    ⚠️ 重要提示

    .env文件被git忽略,以防止提交敏感信息。

  3. 运行测试:

    npm test
    

构建

npm run build

重要说明

  • 当向列表发送邮件时,必须提供suppression_group_idcustom_unsubscribe_url以符合电子邮件法规
  • 发件人电子邮件地址必须在发送Grid中验证后才能用于发送邮件
  • 所有模板均作为动态模板创建,支持Handlebars语法(例如:{{variable_name}})
  • 单个发送API用于所有批量邮件操作,因为它提供更好的跟踪和管理功能
  • 发送Grid API是“最终一致性”的 - 数据更改(如添加联系人或更新列表)可能在生成后不会立即显示

📄 许可证

本项目采用MIT许可证。

发送Grid标志版权归Twilio所有

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client