Skip to main content
Glama
README.md
# mcp_argo_pipeline — 按 Pipeline 调度 Argo WorkflowTemplate 的 MCP

| 文件 | 内容 |
|------|------|
| `pipelines.yaml` | pipeline、templates、instructions、kubeconfig、port、namespace |
| `auth.yaml` | 各 pipeline 多 Bearer(username / unit) |

入口仅 `server.py`(通过 `MCP_PIPELINE` 选择流程)。

## 快速开始

依赖由 **uv** 管理(`pyproject.toml` + `uv.lock`)。

```bash
cd mcp/mcp_argo_pipeline
cp pipelines.yaml.example pipelines.yaml
cp auth.yaml.example auth.yaml
uv sync          # 生成/更新 .venv(也可交给 start_serve.sh 自动 sync)
```

### 本地 Cursor(stdio)

```json
{
  "mcpServers": {
    "argo-sirna": {
      "command": ".../mcp/mcp_argo_pipeline/.venv/bin/python",
      "args": [".../mcp/mcp_argo_pipeline/server.py"],
      "env": { "MCP_PIPELINE": "sirna" }
    }
  }
}
```

启动时校验 kubeconfig 与模板可访问性;排障可设 `MCP_SKIP_STARTUP_CHECKS=1`。

### 服务器

`start_serve.sh` 启动前会执行 `uv sync --frozen`(可用 `MCP_SKIP_UV_SYNC=1` 跳过)。

```bash
./start_serve.sh
./start_serve.sh sirna
./start_serve.sh -f enzyme
```

默认端口(见 `pipelines.yaml`):affinity `8101`、sirna `8102`、enzyme `8103`。

### 远程客户端(Streamable HTTP)

服务端强制 `Authorization: Bearer <token>`,token 来自 `auth.yaml`(示例见 `auth.yaml.example`)。将下列片段写入 Cursor 的 `mcp.json`(`~/.cursor/mcp.json` 或项目 `.cursor/mcp.json`),按实际主机改 `url`。

```json
{
  "mcpServers": {
    "argo-affinity": {
      "url": "http://127.0.0.1:8101/mcp",
      "headers": {
        "Authorization": "Bearer change-me-affinity-alice"
      }
    },
    "argo-sirna": {
      "url": "http://127.0.0.1:8102/mcp",
      "headers": {
        "Authorization": "Bearer change-me-sirna-carol"
      }
    },
    "argo-enzyme": {
      "url": "http://127.0.0.1:8103/mcp",
      "headers": {
        "Authorization": "Bearer change-me-enzyme-dave"
      }
    }
  }
}
```

对应示例身份:`alice`(结构生物学组)、`carol`(核酸药物组)、`dave`(酶工程组)。上线请改掉 `change-me-*`,勿把真实 token 提交仓库;也可用 `"Authorization": "Bearer ${env:ARGO_SIRNA_TOKEN}"` 从环境变量注入。

## pipelines.yaml

```yaml
pipelines:
  sirna:
    server_name: argo-sirna
    kubeconfig: "~/.kube/config"
    port: 8102
    instructions: |
      ...
    templates:
      - sirna-predict
```

## 环境变量

| 变量 | 含义 |
|------|------|
| `MCP_PIPELINE` | 当前 pipeline(必填) |
| `MCP_PIPELINES_CONFIG` | pipelines.yaml 路径 |
| `MCP_AUTH_CONFIG` | auth.yaml 路径 |
| `MCP_TRANSPORT` | `stdio` / `streamable-http` |
| `MCP_SKIP_STARTUP_CHECKS` | `1` 跳过启动校验 |
| `MCP_SKIP_UV_SYNC` | `1` 跳过 `uv sync` |