services:
  sfmcp:
    build: .
    ports:
      - "5100:5100"
    environment:
      - ConnectionStrings__WfDBConnectionString=${DB_CONNECTION}
      - McpAuth__ApiKey=${MCP_API_KEY}
      - RateLimit__PermitLimit=100
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5100/health"]
      interval: 30s
      timeout: 5s
      retries: 3

敏感配置(数据库连接串、API Key)通过 .env 文件注入,不进入镜像。

环境变量一览(.env.example

DB_CONNECTION=Host=xxx;Database=wfdb;Username=xxx;Password=xxx
MCP_API_KEY=your-strong-api-key-here
RATELIMIT_PERMITLIMIT=100
RATELIMIT_WINDOWMINUTES=1

八、测试验证结果

全部 14 个工具在测试环境(PostgreSQL,42 个已发布流程,402 条知识库文档)验证通过:

类别 工具数 验证状态
流程查询(只读) 5 ✅ 全部通过
流程操作(写入) 7 ✅ 全部通过(含错误处理)
知识库 2 ✅ 全部通过(threshold≥0.5 可匹配)

踩坑记录:

  1. PowerShell + curl.exe 双引号问题:PowerShell inline JSON 传 curl.exe 时双引号被剥离,改用 -d @file.json 方式解决。
  2. start_process 引擎参数问题:引擎需要 ProcessId + Version,工具层先调用 GetProcessByCode 查出实体再填入,不能只传 ProcessCode
  3. n8n SSE 兼容:n8n SDK 升级至 1.4.0 后需 EnableLegacySse=true,走旧 SSE 通道。
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐