Skip to main content
Glama
zchangechen

cotti-admin-mcp

by zchangechen
README.md
# Admin MCP v2

Cotti Admin 后台 MCP:读 + 私域新品配置写操作(Playwright UI)。

## 工具

### 读 / 查

| 工具 | 说明 |
|------|------|
| `admin_login` | 强制刷新 SSO |
| `admin_status` | Session 状态 |
| `coupon_template_list` / `coupon_template_get` | 券模板(`country`) |
| `activity_list` / `activity_get` | 活动 |
| `activity_get_full` | 活动 + 解析 landing(h5Url/longLink) |
| `private_domain_find_reference` | **找最近一条【私域】新品折扣** + 参考券 |

### 写(Phase 2,Playwright UI Save)

| 工具 | 说明 |
|------|------|
| `coupon_copy_save` | 复制参考券 → 只改名称/文案/SPU → Save |
| `activity_copy_save` | 复制参考活动 → 改名称/时间/挂券 → saveGeneralActivity |
| `activity_edit_save` | **修改**已有活动(时间/落地页) |
| `activity_set_online` | 上架 / 下架 |

## 国家参数

`country`: `ID` | `MY` | `VN` | `HK` | `MO` | `SG` | `AU`(新品日历)

## 安装

```bash
cd mcp/admin
npm install
npx playwright install chromium
```

Credentials via env: `ADMIN_USERNAME`, `ADMIN_PASSWORD` (or `DAVINCI_*`).

## Cursor 配置

```json
{
  "mcpServers": {
    "admin": {
      "command": "node",
      "args": ["/path/to/mcp/admin/src/index.js"],
      "env": {
        "ADMIN_USERNAME": "...",
        "ADMIN_PASSWORD": "..."
      }
    }
  }
}
```

## Skill

配套 Skill:`~/.codex/skills/cotti-private-domain-rollout/`

## Ops 脚本

`scripts/ops/` — MCP 写工具底层,也可 CLI:

```bash
COUNTRY=ID ACTIVITY_DATE=20260714 SOURCE_TEMPLATE_NO=CT20260612000001 SOURCE_ID=1203 \
PRODUCTS_JSON='[{"spuCode":"SP4680","spuName":"Blueberry & Mulberry Americano"}]' \
node scripts/ops/coupon-copy-save.js
```

## 机制

Session: `~/.admin-mcp/session.json`(Playwright SSO,约 2h)

**券/活动保存必须走 UI Save**,裸 API 会丢字段或校验失败。

TDQS

B3/5.0

Scored across 12 tools

Disambiguation4/5

Tools are mostly distinct; activity_copy_save and activity_edit_save both modify activities but one creates a copy while the other edits existing, and descriptions clarify the difference. activity_get vs activity_get_full also clearly separated by detail level.

Naming Consistency4/5

Most tools follow resource_verb pattern (e.g., activity_list, coupon_template_get), but admin_login and admin_status use verb_noun or less consistent structure. Overall pattern is recognizable.

Tool Count5/5

12 tools cover the main operations for activity and coupon management plus admin session handling. This is a well-scoped number for the domain.

Completeness4/5

Core workflows (create/edit/list/get/online toggle for activities, create/get/list for coupons, session management) are covered. Minor gaps like missing delete operations or direct create without copy, but these can be worked around.

Maintenance

ActivityStale
ResponsivenessNo issues