# ════════════════════════════════════════════════════════════════
# 光湖 · MCP 配置代码生成器 (一键获取)
# 用于 WorkBuddy 换账号后，快速获取最新 MCP 连接配置
# 使用方法：点 "Run workflow" → 等几秒 → 复制下方配置代码
# ════════════════════════════════════════════════════════════════
name: 🔌 MCP 配置生成

on:
  workflow_dispatch:

jobs:
  generate-config:
    runs-on: ubuntu
    steps:
      - name: 读取 MCP 访问密钥
        id: read_key
        run: |
          echo "═══ 光湖 · MCP 配置代码 ═══"
          echo ""
          echo "以下配置可直接粘贴到 WorkBuddy MCP 工具中："
          echo ""

          if [ -f "/data/guanghulab/mcp-server/.access-key" ]; then
            ACCESS_KEY=$(cat /data/guanghulab/mcp-server/.access-key)
            cat <<CONFIG
{
  "mcpServers": {
    "guanghulab": {
      "url": "https://guanghulab.com/mcp",
      "headers": {
        "Authorization": "Bearer ${ACCESS_KEY}"
      }
    }
  }
}
CONFIG
            echo ""
            echo "═══════════════════════════════════════"
            echo "✅ 配置已就绪！全选 → 复制 → 粘贴到新账号的 WorkBuddy MCP 配置中"
            echo "═══════════════════════════════════════"
          else
            echo "⚠️ 未找到访问密钥文件"
            echo "请先运行「部署 MCP Server」工作流来初始化 MCP Server"
          fi
