智能营销活动管理服务器

一个基于Model Context Protocol (MCP)的服务器,通过Server-Sent Events (SSE)与Smartlead营销活动管理API交互,支持AI代理进行营销活动、序列和潜在客户管理。

  • by jacob-dietle
  • JavaScript
  • 混合部署
  • 4 星标
  • 更新于
在 GitHub 查看 jacob-dietle/smartlead-mcp-server-sse

使用说明

一键部署Smartlead MCP服务器和SSE

这是一个模型上下文协议(MCP)服务器,通过Supergateway进行了增强,允许AI代理通过服务器事件(SSE)与Smartlead活动管理API进行交互。

部署

一键部署到铁路

点击上面的“铁路部署”按钮。Railway将指导您使用此模板创建新项目并配置必要的环境变量(请参阅下面的“配置”)。

Docker部署(手动/本地测试)

这 Dockerfile 在此存储库中构建 smartlead-mcp-server 并使用Supergateway运行它。

  1. 构建Docker镜像:

    docker build -t smartlead-mcp-server-supergateway .
    
  2. 运行Docker容器:

    # Replace YOUR_SMARTLEAD_API_KEY with your actual Smartlead API key
    # The server will be accessible via SSE on http://localhost:8001/sse (host port 8001 mapped to container port 8000)
    docker run --rm -it -p 8001:8000 \
      -e PORT=8000 \
      -e SMARTLEAD_API_KEY="YOUR_SMARTLEAD_API_KEY" \
      -e SMARTLEAD_API_URL="https://server.smartlead.ai/api/v1" \
      -e DEBUG=true \
      smartlead-mcp-server-supergateway
    

    Supergateway提供默认路径: /sse 对于事件流和 /message 用于发布消息。健康检查在 /healthz.

配置

服务器需要以下环境变量。部署到Railway时,系统将提示您输入这些内容。对于本地Docker运行,使用 -e 旗帜。

  • SMARTLEAD_API_KEY:您的Smartlead API密钥。 必需 应该被视为秘密。
  • SMARTLEAD_API_URL (可选):自定义Smartlead API URL。默认为 https://server.smartlead.ai/api/v1.
  • SMARTLEAD_RETRY_MAX_ATTEMPTS (可选):API调用的最大重试次数。违约: 3.
  • SMARTLEAD_RETRY_INITIAL_DELAY (可选):重试的初始延迟(毫秒)。违约: 1000.
  • SMARTLEAD_RETRY_MAX_DELAY (可选):重试的最大延迟(毫秒)。违约: 10000.
  • SMARTLEAD_RETRY_BACKOFF_FACTOR (可选):重试延迟的回退系数。违约: 2.
  • DEBUG (可选):设置为 true 用于服务器和Supergateway的详细日志记录,或 false 用于生产。违约: false.
  • PORT (由铁路/集装箱设置):端口超级网关将监听 集装箱内The Dockerfile 默认值为 8000当使用Docker在本地运行时,您可以将主机端口映射到此容器端口(例如。, -p 8001:8000).

连接到服务器(客户端集成)

一旦 smartlead-mcp-server 如果正在运行(例如,部署在Railway上或本地Docker中),它会通过服务器发送事件(SSE)公开MCP接口。

超级网关实例通常使MCP服务器在以下位置可用:

  • SSE流: http://<server_address>:<port>/sse
  • 消息端点(如果使用): http://<server_address>:<port>/message

(如果部署在铁路上, <server_address>:<port> 将是您的公共铁路URL,例如。, https://my-smartlead-mcp.up.railway.app)

  1. 直接SSE连接(SSE感知客户端首选): 如果您的MCP客户端(例如,您的AI代理的框架)本机支持通过SSE URL连接到MCP服务器,请相应地进行配置。

    示例 mcp.json 直接SSE的配置:

    {
      "mcpServers": {
        "smartlead_remote_sse": {
          "url": "https://YOUR_RAILWAY_DEPLOYMENT_URL/sse", // Replace with your actual Railway SSE URL
          "disabled": false,
          "alwaysAllow": [
            "smartlead_create_campaign",
            "smartlead_update_campaign_schedule",
            "smartlead_update_campaign_settings",
            "smartlead_get_campaign",
            "smartlead_list_campaigns",
            "smartlead_save_campaign_sequence",
            "smartlead_get_campaign_sequence",
            "smartlead_update_campaign_sequence",
            "smartlead_delete_campaign_sequence",
            "smartlead_add_email_account_to_campaign",
            "smartlead_update_email_account_in_campaign",
            "smartlead_delete_email_account_from_campaign",
            "smartlead_add_lead_to_campaign",
            "smartlead_update_lead_in_campaign",
            "smartlead_delete_lead_from_campaign"
          ],
          "timeout": 300
        }
      }
    }
    
  2. 在客户端使用超级网关(SSE到stdio网桥): 如果您的MCP客户端希望启动通过stdio(标准输入/输出)进行通信的本地命令,您可以使用 另一个 客户端计算机上本地的超级网关实例,用于将远程SSE连接桥接回stdio。

    示例 mcp.json 或网桥的类似客户端配置:

    {
      "mcpServers": {
        "smartlead_remote_via_bridge": {
          "command": "npx",
          "args": [
            "-y",
            "supergateway",
            "--sse", "https://YOUR_RAILWAY_DEPLOYMENT_URL", // Replace with your actual Railway base URL (without /sse)
            // Supergateway will append /sse by default
            "--logLevel", "info" // Optional: for debugging Supergateway on the client
          ],
          "disabled": false,
          "alwaysAllow": [ /* ... list of Smartlead tools as above ... */ ]
        }
      }
    }
    

原始功能(来自基本Smartlead MCP服务器)

  • 创建新活动
  • 更新活动日程设置
  • 更新活动常规设置
  • 获取活动详细信息
  • 列出所有具有筛选选项的活动
  • 管理活动电子邮件序列(保存、获取、更新、删除)
  • 管理活动中的电子邮件帐户(添加、更新、删除)
  • 管理营销活动中的潜在客户(添加、更新、删除)

本地开发设置(不含Docker/Supergateway)

  1. 克隆存储库
  2. 安装依赖项:
    npm install
    
  3. 创建一个 .env 文件(例如,来自 .env.example)并添加您的Smartlead API密钥:
    SMARTLEAD_API_KEY=your_api_key_here
    
  4. 构建项目:
    npm run build
    
  5. 直接启动服务器(stdio模式):
    npm start 
    # or node dist/index.js
    

本地示例 mcp.json 用于stdio模式(原始设置)

{
  "mcpServers": {
    "smartlead_local_stdio": {
      "command": "node",
      // Adjust path to your local built server:
      "args": ["FULL_PATH_TO_YOUR_PROJECT/smartlead-mcp-server/dist/index.js"], 
      "env": {
        "SMARTLEAD_API_KEY": "your_api_key_here"
      },
      "disabled": false,
      "alwaysAllow": [ /* ... list of Smartlead tools ... */ ]
    }
  }
}

可用工具

(本节列出了服务器提供的工具。有关详细参数,请参阅原始README部分,或使用MCP自检(如果可用)。)

活动管理

  • smartlead_create_campaign
  • smartlead_update_campaign_schedule
  • smartlead_update_campaign_settings
  • smartlead_get_campaign
  • smartlead_list_campaigns

活动序列管理

  • smartlead_save_campaign_sequence
  • smartlead_get_campaign_sequence
  • smartlead_update_campaign_sequence
  • smartlead_delete_campaign_sequence

活动中的电子邮件帐户管理

  • smartlead_add_email_account_to_campaign
  • smartlead_update_email_account_in_campaign
  • smartlead_delete_email_account_from_campaign

活动中的领导管理

  • smartlead_add_lead_to_campaign
  • smartlead_update_lead_in_campaign
  • smartlead_delete_lead_from_campaign

鸣谢

基于:https://github.com/lkm1developer/smartlead-mcp-server

许可证

麻省理工学院