sino-bc-cli 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +60 -14
  2. package/dist/SKILL.md +32 -14
  3. package/dist/api-doc/README.md +23 -5
  4. package/dist/api-doc/biz-line-query.md +2 -0
  5. package/dist/api-doc/biz-line-strategy.md +2 -0
  6. package/dist/api-doc/icenter-mcp-strategy-dimension-facebook-ad-list.md +13 -5
  7. package/dist/api-doc/icenter-mcp-strategy-dimension-google-ad-list.md +170 -0
  8. package/dist/api-doc/icenter-mcp-strategy-dimension-tiktok-ad-list.md +172 -0
  9. package/dist/api-doc/icenter-mcp-strategy-metrics-facebook-ad-list.md +11 -6
  10. package/dist/api-doc/icenter-mcp-strategy-metrics-google-ad-list.md +201 -0
  11. package/dist/api-doc/icenter-mcp-strategy-metrics-tiktok-ad-list.md +204 -0
  12. package/dist/api-doc/icenter-mcp-version-query.md +5 -3
  13. package/dist/index.js +1 -33
  14. package/package.json +6 -3
  15. package/dist/commands/api-endpoint.command.d.ts +0 -58
  16. package/dist/commands/api-endpoint.command.js +0 -212
  17. package/dist/commands/api-endpoint.command.js.map +0 -1
  18. package/dist/commands/api-list.command.d.ts +0 -39
  19. package/dist/commands/api-list.command.js +0 -179
  20. package/dist/commands/api-list.command.js.map +0 -1
  21. package/dist/commands/bc-api.command.d.ts +0 -20
  22. package/dist/commands/bc-api.command.js +0 -30
  23. package/dist/commands/bc-api.command.js.map +0 -1
  24. package/dist/commands/ic-api.command.d.ts +0 -20
  25. package/dist/commands/ic-api.command.js +0 -30
  26. package/dist/commands/ic-api.command.js.map +0 -1
  27. package/dist/commands/index.d.ts +0 -12
  28. package/dist/commands/index.js +0 -29
  29. package/dist/commands/index.js.map +0 -1
  30. package/dist/commands/init.command.d.ts +0 -30
  31. package/dist/commands/init.command.js +0 -130
  32. package/dist/commands/init.command.js.map +0 -1
  33. package/dist/constants/api-catalog.d.ts +0 -34
  34. package/dist/constants/api-catalog.js +0 -118
  35. package/dist/constants/api-catalog.js.map +0 -1
  36. package/dist/constants/api-doc.d.ts +0 -13
  37. package/dist/constants/api-doc.js +0 -97
  38. package/dist/constants/api-doc.js.map +0 -1
  39. package/dist/constants/biz-line-api-doc.d.ts +0 -19
  40. package/dist/constants/biz-line-api-doc.js +0 -353
  41. package/dist/constants/biz-line-api-doc.js.map +0 -1
  42. package/dist/constants/gateway.d.ts +0 -35
  43. package/dist/constants/gateway.js +0 -113
  44. package/dist/constants/gateway.js.map +0 -1
  45. package/dist/constants/index.d.ts +0 -32
  46. package/dist/constants/index.js +0 -84
  47. package/dist/constants/index.js.map +0 -1
  48. package/dist/core/cli-app.d.ts +0 -51
  49. package/dist/core/cli-app.js +0 -283
  50. package/dist/core/cli-app.js.map +0 -1
  51. package/dist/core/command-registry.d.ts +0 -71
  52. package/dist/core/command-registry.js +0 -195
  53. package/dist/core/command-registry.js.map +0 -1
  54. package/dist/core/index.d.ts +0 -2
  55. package/dist/core/index.js +0 -9
  56. package/dist/core/index.js.map +0 -1
  57. package/dist/index.d.ts +0 -12
  58. package/dist/index.js.map +0 -1
  59. package/dist/types/index.d.ts +0 -122
  60. package/dist/types/index.js +0 -46
  61. package/dist/types/index.js.map +0 -1
  62. package/dist/utils/browser.d.ts +0 -52
  63. package/dist/utils/browser.js +0 -222
  64. package/dist/utils/browser.js.map +0 -1
  65. package/dist/utils/common.d.ts +0 -97
  66. package/dist/utils/common.js +0 -198
  67. package/dist/utils/common.js.map +0 -1
  68. package/dist/utils/crypto.d.ts +0 -53
  69. package/dist/utils/crypto.js +0 -153
  70. package/dist/utils/crypto.js.map +0 -1
  71. package/dist/utils/http.d.ts +0 -58
  72. package/dist/utils/http.js +0 -188
  73. package/dist/utils/http.js.map +0 -1
  74. package/dist/utils/index.d.ts +0 -7
  75. package/dist/utils/index.js +0 -22
  76. package/dist/utils/index.js.map +0 -1
  77. package/dist/utils/logger.d.ts +0 -56
  78. package/dist/utils/logger.js +0 -161
  79. package/dist/utils/logger.js.map +0 -1
  80. package/dist/utils/prompt.d.ts +0 -18
  81. package/dist/utils/prompt.js +0 -77
  82. package/dist/utils/prompt.js.map +0 -1
  83. package/dist/utils/skill-install.d.ts +0 -74
  84. package/dist/utils/skill-install.js +0 -131
  85. package/dist/utils/skill-install.js.map +0 -1
package/README.md CHANGED
@@ -140,11 +140,14 @@ sino-bc-cli/
140
140
  │ │
141
141
  │ ├── commands/ # 📦 命令实现层(每命令一个文件,可独立扩展)
142
142
  │ │ ├── index.ts # 命令批量注册入口
143
- │ │ ├── init.command.ts # /init 命令实现(注册 Agent 技能)
143
+ │ │ ├── init.command.ts # /init 命令实现(注册 Agent 技能 + 初始化变量配置)
144
144
  │ │ ├── api-list.command.ts # /api-list 命令实现(列出接口并打开文档)
145
145
  │ │ ├── api-endpoint.command.ts # 接口调用类命令基类(选择接口 → 发起调用 → 打印响应)
146
146
  │ │ ├── ic-api.command.ts # /ic-api 命令实现(调用 iCenter 接口地址)
147
- │ │ └── bc-api.command.ts # /bc-api 命令实现(调用业务线查询 / 业务线策略接口)
147
+ │ │ ├── bc-api.command.ts # /bc-api 命令实现(调用业务线查询 / 业务线策略接口)
148
+ │ │ ├── get-config.command.ts # /get-config 命令实现(查看变量配置)
149
+ │ │ ├── set-config.command.ts # /set-config 命令实现(修改变量配置)
150
+ │ │ └── uninstall.command.ts # /uninstall 命令实现(清理技能目录与配置并卸载)
148
151
  │ │
149
152
  │ ├── utils/ # 🛠 工具类层(高内聚的可复用工具)
150
153
  │ │ ├── index.ts # 工具模块统一导出
@@ -152,7 +155,11 @@ sino-bc-cli/
152
155
  │ │ ├── browser.ts # 浏览器工具(跨平台 URL 打开,兼容 Win/macOS/Linux)
153
156
  │ │ ├── crypto.ts # 加密工具(MD5、SHA-256、AES、Base64、签名生成)
154
157
  │ │ ├── http.ts # HTTP 工具(axios 封装:请求/响应拦截、自动重试)
155
- │ │ └── common.ts # 通用工具(日期、深拷贝、防抖节流、ID 生成等)
158
+ │ │ ├── common.ts # 通用工具(日期、深拷贝、防抖节流、ID 生成等)
159
+ │ │ ├── prompt.ts # 终端交互(复用单一 readline 会话:提问、选择、确认)
160
+ │ │ ├── config-store.ts # 变量配置读写(字段元信息 + 读 / 写 / 删)
161
+ │ │ ├── config-prompt.ts # 变量配置交互采集(/init 与 /set-config 共用)
162
+ │ │ └── skill-install.ts # Agent 技能目录的写入与清理
156
163
  │ │
157
164
  │ ├── types/ # 📝 类型定义层
158
165
  │ │ └── index.ts # 全局接口、枚举定义(ICommand、LogLevel 等)
@@ -160,8 +167,8 @@ sino-bc-cli/
160
167
  │ └── constants/ # 🔧 常量配置层
161
168
  │ └── index.ts # CLI 配置、命令名称、默认值
162
169
  │
163
- ├── dist/ # 📤 编译输出目录(编译后自动生成)
164
- │ └── ... # JavaScript 编译产物 + 类型声明 + SourceMap
170
+ ├── dist/ # 📤 构建输出目录(构建后自动生成)
171
+ │ └── ... # 单文件混淆压缩产物 + SKILL.md + api-doc(不含 SourceMap)
165
172
  │
166
173
  ├── package.json # 📄 项目配置(依赖、脚本、bin 命令)
167
174
  ├── tsconfig.json # 📄 TypeScript 编译配置
@@ -280,10 +287,38 @@ sino-bc-cli /init
280
287
 
281
288
  | 命令 | 说明 |
282
289
  | :---------- | :-------------------------------------------------------------------------------------------- |
283
- | `/init` | 将本包 `SKILL.md` 复制到用户主目录下的 Agent 技能目录,供飞书豆包工作 / Cursor / Claude / Codex 自动识别 |
284
- | `/api-list` | 列出全部可调用接口;Cursor / VS Code 终端中 Ctrl+单击接口名或文档路径打开本地文档,也可输入序号或传入 name |
285
- | `/ic-api` | 交互选择并调用 iCenter 接口地址(路径统一带 `/sino-icenter` 前缀);`ENV` 默认 `prod`,`API_KEY` 默认使用网关常量 |
286
- | `/bc-api` | 交互选择并调用业务线查询 / 业务线策略接口(共 22 个,路径统一带 `/sino-opti-hive` 前缀) |
290
+ | `/init` | 注册 `SKILL.md` 到 Agent 技能目录,并交互设置环境 / `X-GATEWAY-TYPE` / `API_KEY` 写入变量配置文件 |
291
+ | `/api-list` | 列出全部可调用接口;Cursor / VS Code 终端中 Ctrl+单击接口名或文档路径打开本地文档,也可输入序号或传入 name |
292
+ | `/ic-api` | 交互选择并经网关调用 iCenter 接口(路径统一带 `/sino-icenter` 前缀);**不接收参数**,环境与鉴权取自变量配置文件 |
293
+ | `/bc-api` | 交互选择并调用业务线查询 / 业务线策略接口(共 22 个,路径统一带 `/sino-opti-hive` 前缀);**不接收参数** |
294
+ | `/get-config` | 查看变量配置文件内容;`API_KEY` 默认打码,`--show-secret` 显示明文,`--json` 输出 JSON |
295
+ | `/set-config` | 修改变量配置文件内容;不带参数时逐项交互修改 |
296
+ | `/uninstall` | 删除 `/init` 创建的技能目录与变量配置文件,并从全局 npm 卸载本 CLI |
297
+
298
+ ### 变量配置文件
299
+
300
+ 环境、`X-GATEWAY-TYPE`、`API_KEY` 统一存放在 `<用户主目录>/.sino-bc-cli/config.json`,是这三项取值的唯一来源。
301
+
302
+ | 字段 | 命令行键名 | 默认值 | 说明 |
303
+ | :--- | :--------- | :----- | :--- |
304
+ | `env` | `env` | `prod` | 目标环境,可选 `test` / `pre` / `prod` |
305
+ | `gatewayType` | `gateway-type` | `A2C-CLI` | `X-GATEWAY-TYPE` 请求头取值 |
306
+ | `apiKey` | `api-key` | 内置默认 Key | 网关鉴权用的 API Key |
307
+
308
+ ```bash
309
+ # 查看(API_KEY 打码)
310
+ sino-bc-cli /get-config
311
+
312
+ # 三种修改写法等价
313
+ sino-bc-cli /set-config env test
314
+ sino-bc-cli /set-config env=test
315
+ sino-bc-cli /set-config --env=test
316
+
317
+ # 不带参数则逐项交互修改,直接回车保留当前值
318
+ sino-bc-cli /set-config
319
+ ```
320
+
321
+ > `/init` 在非交互环境(npm `postinstall`、CI、Agent 调用)下不会提问:配置文件不存在时按默认值创建,已存在时保持不变,因此重装或升级不会覆盖你设置好的环境与密钥。
287
322
 
288
323
  ### 全局选项
289
324
 
@@ -293,6 +328,18 @@ sino-bc-cli /init
293
328
  | `--help` | `-h` | 显示帮助信息 |
294
329
  | `--debug` | `-d` | 启用 Debug 日志模式,输出更详细的运行信息 |
295
330
 
331
+ ### 环境与请求网关
332
+
333
+ `/ic-api`、`/bc-api` 的请求地址一律由 [`src/constants/gateway.ts`](./src/constants/gateway.ts) 的 `GATEWAY_CONFIG` 决定,命令内部统一走 `joinGatewayUrl(env, path)` 拼接,不在任何命令或文档里硬编码请求地址。
334
+
335
+ | `ENV` | 说明 | 网关地址 |
336
+ | :----- | :------- | :----------------------------------- |
337
+ | `test` | 测试环境 | `https://test-agent.beyondclick.com` |
338
+ | `pre` | 预发环境 | `https://test-agent.beyondclick.com` |
339
+ | `prod` | 生产环境 | `https://test-agent.beyondclick.com` |
340
+
341
+ > 当前三环境同一地址。换地址只需改 `GATEWAY_CONFIG`,同时同步 [`SKILL.md`](./SKILL.md) 与 [`src/api-doc/`](./src/api-doc/README.md) 中的示例地址。
342
+
296
343
  ### 使用示例
297
344
 
298
345
  #### ① 查看版本和帮助
@@ -317,23 +364,22 @@ sino-bc-cli /api-list biz-line-open-list
317
364
 
318
365
  执行效果:按「iCenter MCP / 业务线查询 / 业务线策略」分组列出全部接口。接口名是终端超链接,文档路径可 Ctrl+单击打开对应 markdown;交互终端也可输入序号。传入序号或接口 `name` 则直接打开该文档。
319
366
 
320
- #### ③ 调用 iCenter 接口地址
367
+ #### ③ 经网关调用 iCenter 接口
321
368
 
322
369
  ```bash
323
370
  sino-bc-cli /ic-api
324
- sino-bc-cli /ic-api test
325
371
  ```
326
372
 
327
- 执行效果:交互选择接口后,向对应环境的 iCenter 接口地址发起请求。所有路径带 `/sino-icenter` 前缀。
373
+ 执行效果:交互选择接口后,向变量配置文件指定环境的网关地址发起请求。所有路径带 `/sino-icenter` 前缀。
374
+ 本命令不接收参数,切换环境请先执行 `sino-bc-cli /set-config env <test|pre|prod>`。
328
375
 
329
376
  #### ④ 调用业务线查询 / 业务线策略接口
330
377
 
331
378
  ```bash
332
379
  sino-bc-cli /bc-api
333
- sino-bc-cli /bc-api test
334
380
  ```
335
381
 
336
- 执行效果:按「业务线查询(5 个)」「业务线策略(17 个)」两组列出接口,输入序号后向对应环境网关发起请求。所有路径统一带 `/sino-opti-hive` 路由前缀,接口清单见 [`src/api-doc/README.md`](./src/api-doc/README.md)。
382
+ 执行效果:按「业务线查询(5 个)」「业务线策略(17 个)」两组列出接口,输入序号后向配置文件指定环境的网关发起请求。所有路径统一带 `/sino-opti-hive` 路由前缀,接口清单见 [`src/api-doc/README.md`](./src/api-doc/README.md)。
337
383
 
338
384
  > ⚠️ 业务线策略组含新建 / 编辑 / 删除等写操作接口,会按文档示例请求体直接发起调用,执行前请确认环境。
339
385
 
package/dist/SKILL.md CHANGED
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  name: sino-bc-cli
3
3
  description: >
4
- Use when 查询或操作 BeyondClick / iCenter / 业务线数据:Facebook 广告策略维度或成效、
4
+ Use when 查询或操作 BeyondClick / iCenter / 业务线数据:Facebook / Google / TikTok 广告策略维度或成效、
5
5
  投放渠道、投放品类、业务线列表/详情/策略与表现、Top 业务线、周策略增删改查、
6
6
  红绿灯、客户满意度、消耗、ROAS;或用户提到 sino-bc-cli、/init、/api-list、
7
- /ic-api、/bc-api、sino-icenter、sino-opti-hive、A2C-CLI。
7
+ /ic-api、/bc-api、/get-config、/set-config、/uninstall、sino-icenter、
8
+ sino-opti-hive、A2C-CLI。
8
9
  metadata:
9
10
  requires:
10
11
  bins: ["sino-bc-cli"]
@@ -16,7 +17,7 @@ BeyondClick 投放数据与业务线策略的 Agent 调用入口。用本 CLI
16
17
 
17
18
  ## When to Use
18
19
 
19
- - 查 Facebook(Meta)广告策略配置、消耗/点击/购买等成效
20
+ - 查 Facebook / Google / TikTok 广告策略配置、消耗/点击/购买等成效
20
21
  - 查投放渠道、投放行业/品类、业务线主数据、周策略与表现、行业 Top
21
22
  - 新建/编辑/删除业务线或周策略(须先确认环境和写操作意图)
22
23
  - 用户点名 `/api-list`、`/ic-api`、`/bc-api`、iCenter、sino-opti-hive
@@ -27,15 +28,21 @@ BeyondClick 投放数据与业务线策略的 Agent 调用入口。用本 CLI
27
28
 
28
29
  | 项 | 规则 |
29
30
  | --- | --- |
30
- | 环境 | `test` / `pre` / `prod`,未指明默认 `prod` |
31
- | 网关 | `https://test-agent.beyondclick.com`(当前三环境同一地址) |
31
+ | 环境 | `test` / `pre` / `prod`,取自变量配置文件,默认 `prod` |
32
+ | 网关 | `https://test-agent.beyondclick.com`(当前三环境同一地址;所有请求只走网关,不直连服务地址) |
32
33
  | iCenter 前缀 | `/sino-icenter` |
33
34
  | 业务线前缀 | `/sino-opti-hive` |
34
- | 鉴权 | `Authorization: Bearer <API_KEY>`;用户未给 Key 时用 CLI 内置默认值 |
35
- | 来源头 | 必须带 `X-GATEWAY-TYPE: A2C-CLI` |
35
+ | 鉴权 | `Authorization: Bearer <API_KEY>`;取自变量配置文件,未设置时用 CLI 内置默认值 |
36
+ | 来源头 | 必须带 `X-GATEWAY-TYPE`,取自变量配置文件,默认 `A2C-CLI` |
36
37
  | 请求体 | 按用户条件组装;禁止原样提交文档示例账号/业务线 ID |
37
38
 
38
- `/ic-api`、`/bc-api` 会停在「请输入序号」,且只用文档默认 body。Agent 在非 TTY 下不要跑这两条;需要真实查询时直接 HTTP。
39
+ ### 变量配置文件
40
+
41
+ 环境、`X-GATEWAY-TYPE`、`API_KEY` 统一存放在 `<用户主目录>/.sino-bc-cli/config.json`,由 `/init` 创建、`/set-config` 修改。
42
+ 需要知道当前生效取值时执行 `sino-bc-cli /get-config --json`(`API_KEY` 默认打码,加 `--show-secret` 才是明文)。
43
+
44
+ `/ic-api`、`/bc-api` 不接收任何参数,且必须在交互式终端里选接口、只用文档默认 body。
45
+ Agent 在非 TTY 下跑这两条会直接报错退出;需要真实查询时用 `/api-list` 发现接口后直接 HTTP。
39
46
 
40
47
  ## Agent 流程
41
48
 
@@ -61,8 +68,12 @@ CLI 未安装:`npm i sino-bc-cli@latest -g`(需 Node.js >= 24)。技能未
61
68
 
62
69
  | 用户在问 | name | 注意 |
63
70
  | --- | --- | --- |
64
- | Facebook 广告策略配置(目标/出价/受众,不含消耗) | `icenter-mcp-strategy-dimension-facebook-ad-list` | `dimensionValues` 只能有 `account_id`;账户须 `act_` 前缀;`dimensions` 非空 |
65
- | 策略 + 成效(消耗、点击、购买等) | `icenter-mcp-strategy-metrics-facebook-ad-list` | 最多近 21 天;`indicators` 非空 |
71
+ | Facebook 广告策略配置(目标/出价/受众/创意,不含消耗) | `icenter-mcp-strategy-dimension-facebook-ad-list` | `dimensionValues` 只能有 `account_id`;账户须 `act_` 前缀;`dimensions` 非空;`country_code` 必须单独传 |
72
+ | Facebook 策略 + 成效(消耗、点击、购买等) | `icenter-mcp-strategy-metrics-facebook-ad-list` | 最多近 21 天;`indicators` 非空 |
73
+ | Google 广告策略配置(成效目标/出价/系列类型,不含消耗) | `icenter-mcp-strategy-dimension-google-ad-list` | 不支持广告目标和兴趣词包;出价用 `cpc_bid_amount` / `cpm_bid_amount` / `cpv_bid_amount`;`country_code` 必须单独传 |
74
+ | Google 策略 + 成效 | `icenter-mcp-strategy-metrics-google-ad-list` | 最多近 21 天;`indicators` 非空 |
75
+ | TikTok 广告策略配置(含转化出价/深度转化出价,不含消耗) | `icenter-mcp-strategy-dimension-tiktok-ad-list` | TikTok 独有 `conversion_bid` / `deep_cpabid`;`country_code` 必须单独传 |
76
+ | TikTok 策略 + 成效 | `icenter-mcp-strategy-metrics-tiktok-ad-list` | 最多近 21 天;`indicators` 非空 |
66
77
  | iCenter git 版本 | `icenter-mcp-version-query` | GET,无 body |
67
78
 
68
79
  ### 业务线查询(只读,文档 `biz-line-query.md`)
@@ -97,18 +108,25 @@ CLI 未安装:`npm i sino-bc-cli@latest -g`(需 Node.js >= 24)。技能未
97
108
  ```bash
98
109
  sino-bc-cli /api-list
99
110
  sino-bc-cli /api-list biz-line-open-list
100
- sino-bc-cli /ic-api test # 交互;默认文档示例 body
101
- sino-bc-cli /bc-api --env=prod
102
- sino-bc-cli /init
111
+ sino-bc-cli /ic-api # 交互选接口;不接收参数,用文档示例 body
112
+ sino-bc-cli /bc-api
113
+
114
+ sino-bc-cli /init # 注册技能 + 交互设置环境 / 网关头 / API_KEY
115
+ sino-bc-cli /get-config # 查看变量配置(API_KEY 打码)
116
+ sino-bc-cli /set-config env prod # 改单项;也支持 --env=prod、不带参数逐项交互
117
+ sino-bc-cli /uninstall # 清理技能目录与配置文件并卸载 CLI
103
118
  ```
104
119
 
105
120
  ## Common Mistakes
106
121
 
107
122
  | 错误 | 正确做法 |
108
123
  | --- | --- |
109
- | 非 TTY 执行 `/ic-api`、`/bc-api` 卡住 | 直接 HTTP;只用 `/api-list` 发现接口 |
124
+ | 非 TTY 执行 `/ic-api`、`/bc-api` | 这两条会报错退出;改直接 HTTP,只用 `/api-list` 发现接口 |
125
+ | 给 `/ic-api`、`/bc-api` 传环境或 Key | 参数已下线;用 `/set-config` 改、`/get-config` 查 |
110
126
  | 用文档里的 `act_…` / `bizLineId: 1251` | 换成用户给出的账户或业务线 |
111
127
  | 成效接口一次查超过 21 天 | 拆段或改查维度接口 |
128
+ | 把 `country_code` 和其他维度一起传 | 国家维度必须单独查,不能和其他维度同时传入 |
112
129
  | 漏 `X-GATEWAY-TYPE` 或路径前缀 | 带 `A2C-CLI`;iCenter / 业务线分别加对应前缀 |
130
+ | 直连 `o-test-tc-sino-icenter` / `o-test-sino-opti-hive` 等服务地址 | 一律请求网关 `https://test-agent.beyondclick.com` + 路由前缀 |
113
131
  | 未确认就调 save/update/del | 先确认环境与写操作 |
114
132
  | 把 `exprot-all` 改成 `export-all` | 按服务端拼写调用 |
@@ -4,22 +4,40 @@
4
4
 
5
5
  | 分组 | 命令 | 接口数 | 文档 |
6
6
  | --- | --- | --- | --- |
7
- | iCenter MCP | `/ic-api` | 3 | 见下方「iCenter MCP 接口」 |
7
+ | iCenter MCP | `/ic-api` | 7 | 见下方「iCenter MCP 接口」 |
8
8
  | 业务线查询 | `/bc-api` | 5 | [biz-line-query.md](./biz-line-query.md) |
9
9
  | 业务线策略 | `/bc-api` | 17 | [biz-line-strategy.md](./biz-line-strategy.md) |
10
10
 
11
11
  ---
12
12
 
13
+ ## 请求网关
14
+
15
+ 所有接口一律经网关调用,网关地址的唯一来源是 `src/constants/gateway.ts` 的 `GATEWAY_CONFIG`;各文档中出现的上游服务地址(`o-test-tc-sino-icenter`、`o-test-sino-opti-hive` 等)仅作接口文档出处,不作为请求地址。
16
+
17
+ | 环境 | 网关地址 |
18
+ | --- | --- |
19
+ | `test` 测试环境 | `https://test-agent.beyondclick.com` |
20
+ | `pre` 预发环境 | `https://test-agent.beyondclick.com` |
21
+ | `prod` 生产环境 | `https://test-agent.beyondclick.com` |
22
+
23
+ > 当前三环境同一地址;改地址只改 `GATEWAY_CONFIG`,代码通过 `joinGatewayUrl(env, path)` 取值,不要在别处硬编码。
24
+
25
+ ---
26
+
13
27
  ## iCenter MCP 接口
14
28
 
15
- 数据来源:[ContextForge MCP Gateway Admin - Tools](https://o-test-sino-mcp-gateway.meetsocial.cn/admin/?tools_page=2&tools_size=10&tools_inactive=false#tools)
29
+ 数据来源:[ContextForge MCP Gateway Admin - Tools](https://o-test-sino-mcp-gateway.meetsocial.cn/admin/?team_id=61761abbe4a4476c84c7df2cd7335a52#tools)
16
30
 
17
- 筛选规则:`name` 以 `icenter-mcp-` 开头。当前共 **3** 个接口,每个接口一份独立文档。所有路径经网关调用时统一带 `/sino-icenter` 路由前缀,例如 `/sino-icenter/version`。
31
+ 筛选规则:`name` 以 `icenter-mcp-` 开头。当前共 **7** 个接口,每个接口一份独立文档。所有路径经网关调用时统一带 `/sino-icenter` 路由前缀,例如 `/sino-icenter/version`。
18
32
 
19
33
  | 文档 | name | 展示名 | 方法 | 说明 |
20
34
  | --- | --- | --- | --- | --- |
21
- | [icenter-mcp-strategy-dimension-facebook-ad-list.md](./icenter-mcp-strategy-dimension-facebook-ad-list.md) | `icenter-mcp-strategy-dimension-facebook-ad-list` | Facebook广告策略维度数据 | POST | 查询广告策略配置(不含成效指标) |
22
- | [icenter-mcp-strategy-metrics-facebook-ad-list.md](./icenter-mcp-strategy-metrics-facebook-ad-list.md) | `icenter-mcp-strategy-metrics-facebook-ad-list` | Facebook广告策略成效数据 | POST | 查询策略维度 + 成效指标(最多近 21 天) |
35
+ | [icenter-mcp-strategy-dimension-facebook-ad-list.md](./icenter-mcp-strategy-dimension-facebook-ad-list.md) | `icenter-mcp-strategy-dimension-facebook-ad-list` | Facebook广告策略维度数据 | POST | 查询 Facebook 广告策略配置(不含成效指标) |
36
+ | [icenter-mcp-strategy-metrics-facebook-ad-list.md](./icenter-mcp-strategy-metrics-facebook-ad-list.md) | `icenter-mcp-strategy-metrics-facebook-ad-list` | Facebook广告策略成效数据 | POST | 查询 Facebook 策略维度 + 成效指标(最多近 21 天) |
37
+ | [icenter-mcp-strategy-dimension-google-ad-list.md](./icenter-mcp-strategy-dimension-google-ad-list.md) | `icenter-mcp-strategy-dimension-google-ad-list` | Google广告策略维度数据 | POST | 查询 Google 广告策略配置(不含成效指标) |
38
+ | [icenter-mcp-strategy-metrics-google-ad-list.md](./icenter-mcp-strategy-metrics-google-ad-list.md) | `icenter-mcp-strategy-metrics-google-ad-list` | Google广告策略成效数据 | POST | 查询 Google 策略维度 + 成效指标(最多近 21 天) |
39
+ | [icenter-mcp-strategy-dimension-tiktok-ad-list.md](./icenter-mcp-strategy-dimension-tiktok-ad-list.md) | `icenter-mcp-strategy-dimension-tiktok-ad-list` | TikTok广告策略维度数据 | POST | 查询 TikTok 广告策略配置(不含成效指标) |
40
+ | [icenter-mcp-strategy-metrics-tiktok-ad-list.md](./icenter-mcp-strategy-metrics-tiktok-ad-list.md) | `icenter-mcp-strategy-metrics-tiktok-ad-list` | TikTok广告策略成效数据 | POST | 查询 TikTok 策略维度 + 成效指标(最多近 21 天) |
23
41
  | [icenter-mcp-version-query.md](./icenter-mcp-version-query.md) | `icenter-mcp-version-query` | 查询git最新提交版本 | GET | 查询 iCenter 服务 git 最新提交版本 |
24
42
 
25
43
  对应命令:`/ic-api`,接口清单定义在 `src/constants/api-doc.ts`。
@@ -4,6 +4,8 @@
4
4
 
5
5
  对外开放的只读查询接口,共 **5** 个,均不涉及数据变更。
6
6
 
7
+ > **网关地址**:`https://test-agent.beyondclick.com`(三环境同一地址,唯一来源 `src/constants/gateway.ts` 的 `GATEWAY_CONFIG`),不要直连 sino-opti-hive 服务地址。
8
+ >
7
9
  > **路由前缀**:经网关调用时所有路径需带 `/sino-opti-hive`,例如 `/sino-opti-hive/biz-line-open/channels`。
8
10
 
9
11
  | # | name | 展示名 | 方法 | 路径(含前缀) |
@@ -4,6 +4,8 @@
4
4
 
5
5
  业务线主数据与周策略的增删改查,共 **17** 个接口。
6
6
 
7
+ > **网关地址**:`https://test-agent.beyondclick.com`(三环境同一地址,唯一来源 `src/constants/gateway.ts` 的 `GATEWAY_CONFIG`),不要直连 sino-opti-hive 服务地址。
8
+ >
7
9
  > **路由前缀**:经网关调用时所有路径需带 `/sino-opti-hive`,例如 `/sino-opti-hive/biz-line/list`。
8
10
  >
9
11
  > ⚠️ 标记为「写操作」的接口会变更线上数据,`/bc-api` 会按文档示例请求体直接发起调用,调用前请确认环境。
@@ -11,18 +11,22 @@
11
11
  ## 接口地址
12
12
 
13
13
  ```
14
- https://o-test-tc-sino-icenter.meetsocial.com/sino-icenter/mcp/strategy/dimension/facebook/ad/list
14
+ https://test-agent.beyondclick.com/sino-icenter/mcp/strategy/dimension/facebook/ad/list
15
15
  ```
16
16
 
17
- - **baseUrl**:`https://o-test-tc-sino-icenter.meetsocial.com`
17
+ - **baseUrl**:`https://test-agent.beyondclick.com`(网关地址,三环境同一地址,唯一来源 `src/constants/gateway.ts` 的 `GATEWAY_CONFIG`)
18
18
  - **path**:`/sino-icenter/mcp/strategy/dimension/facebook/ad/list`
19
19
 
20
+ > 一律经网关调用,不要直连 iCenter 服务地址。
21
+
20
22
  ## 说明
21
23
 
22
- 查询 Facebook(Meta)渠道的广告策略配置数据。按指定广告账户和日期范围,返回广告的策略设置明细(广告目标、成效目标、出价方式、调整出价、受众类型、兴趣词包、年龄、性别等),用于分析某批账户在某段时间内各广告的策略配置分布。
24
+ 查询 Facebook(Meta)渠道的广告策略配置数据。按指定广告账户和日期范围,返回广告的策略设置明细(广告目标、成效目标、创意类型、出价方式、调整出价、受众类型、兴趣词包、年龄、性别等),用于分析某批账户在某段时间内各广告的策略配置分布。
23
25
 
24
26
  本接口**只返回策略维度**,不含消耗、点击等成效指标。需要成效数据请改用 [`icenter-mcp-strategy-metrics-facebook-ad-list`](./icenter-mcp-strategy-metrics-facebook-ad-list.md)。
25
27
 
28
+ **国家维度特别说明**:`country_code` 必须单独传入,不能和任何其他维度同时传,否则会报错「country_code 不能和其他维度同时传入」。查国家维度时服务端会转走跨渠道广告数据接口,只返回按国家分组的数据。
29
+
26
30
  ## 请求头
27
31
 
28
32
  | Header | 值 |
@@ -66,15 +70,15 @@ https://o-test-tc-sino-icenter.meetsocial.com/sino-icenter/mcp/strategy/dimensio
66
70
  | bid_amount | 调整出价 |
67
71
  | objective | 广告目标 |
68
72
  | optimization_goal | 成效目标 |
73
+ | ad_format | 创意类型 |
69
74
  | bid_strategy | 出价方式 |
70
75
  | audience_type | 受众类型 |
71
- | targeting_geo_countries | 定向国家 |
72
- | targeting_geo_country_groups | 定向国家分组 |
73
76
  | targeting_interests | 兴趣词包 |
74
77
  | targeting_flexible_interests | 弹性兴趣词包 |
75
78
  | targeting_exclusion_interests | 排除兴趣词包 |
76
79
  | targeting_age | 年龄 |
77
80
  | targeting_genders | 性别 |
81
+ | country_code | 国家(必须单独传,不能和其他维度同时传) |
78
82
 
79
83
  ## 返回格式
80
84
 
@@ -100,6 +104,7 @@ https://o-test-tc-sino-icenter.meetsocial.com/sino-icenter/mcp/strategy/dimensio
100
104
  "ad_name",
101
105
  "objective",
102
106
  "optimization_goal",
107
+ "ad_format",
103
108
  "bid_strategy",
104
109
  "audience_type"
105
110
  ],
@@ -126,6 +131,7 @@ https://o-test-tc-sino-icenter.meetsocial.com/sino-icenter/mcp/strategy/dimensio
126
131
  "ad_name": "广告名称",
127
132
  "objective": "广告目标",
128
133
  "optimization_goal": "成效目标",
134
+ "ad_format": "创意类型",
129
135
  "bid_strategy": "出价方式",
130
136
  "audience_type": "受众类型"
131
137
  },
@@ -141,6 +147,8 @@ https://o-test-tc-sino-icenter.meetsocial.com/sino-icenter/mcp/strategy/dimensio
141
147
  "display_objective": "转化",
142
148
  "optimization_goal": "OFFSITE_CONVERSIONS",
143
149
  "display_optimization_goal": "网站转化",
150
+ "ad_format": "SINGLE_IMAGE",
151
+ "display_ad_format": "单图",
144
152
  "bid_strategy": "LOWEST_COST_WITHOUT_CAP",
145
153
  "display_bid_strategy": "最低成本",
146
154
  "audience_type": "INTEREST",
@@ -0,0 +1,170 @@
1
+ # Google广告策略维度数据
2
+
3
+ - **name**:`icenter-mcp-strategy-dimension-google-ad-list`
4
+ - **displayName**:Google广告策略维度数据
5
+ - **Tool ID**:`8d4fbfda08ea40d2b789ba9b334106af`
6
+ - **请求方法**:`POST`
7
+ - **集成类型**:REST
8
+ - **超时**:20000 ms
9
+ - **状态**:Online / Public / enabled
10
+
11
+ ## 接口地址
12
+
13
+ ```
14
+ https://test-agent.beyondclick.com/sino-icenter/mcp/strategy/dimension/google/ad/list
15
+ ```
16
+
17
+ - **baseUrl**:`https://test-agent.beyondclick.com`(网关地址,三环境同一地址,唯一来源 `src/constants/gateway.ts` 的 `GATEWAY_CONFIG`)
18
+ - **path**:`/sino-icenter/mcp/strategy/dimension/google/ad/list`
19
+
20
+ > 一律经网关调用,不要直连 iCenter 服务地址。
21
+
22
+ ## 说明
23
+
24
+ 查询 Google 渠道的广告策略配置数据。按指定广告账户和日期范围,返回广告的策略设置明细(成效目标、创意类型、出价方式、CPC/CPM/CPV 出价、广告系列类型、关键字等),用于分析某批账户在某段时间内各广告的策略配置分布。
25
+
26
+ Google 渠道**不支持广告目标和兴趣词包维度**,出价字段使用 `cpc_bid_amount`、`cpm_bid_amount`、`cpv_bid_amount` 三个独立维度。
27
+
28
+ 本接口**只返回策略维度**,不含消耗、点击等成效指标。需要成效数据请改用 [`icenter-mcp-strategy-metrics-google-ad-list`](./icenter-mcp-strategy-metrics-google-ad-list.md)。
29
+
30
+ **国家维度特别说明**:`country_code` 必须单独传入,不能和任何其他维度同时传,否则会报错「country_code 不能和其他维度同时传入」。查国家维度时服务端会转走跨渠道广告数据接口,只返回按国家分组的数据。
31
+
32
+ ## 请求头
33
+
34
+ | Header | 值 |
35
+ | --- | --- |
36
+ | Content-Type | `application/json` |
37
+
38
+ ## 请求参数
39
+
40
+ 请求体为 JSON object。
41
+
42
+ | 字段 | 类型 | 必填 | 默认值 | 说明 |
43
+ | --- | --- | --- | --- | --- |
44
+ | startDate | string | 是 | — | 开始日期,格式 `yyyy-MM-dd`,例如 `2026-08-01` |
45
+ | endDate | string | 是 | — | 结束日期,格式 `yyyy-MM-dd`,例如 `2026-08-31` |
46
+ | dimensionValues | object | 是 | — | 过滤条件,**仅支持 `account_id` 一个 key**,传其他 key 会报错 |
47
+ | dimensions | string[] | 是 | — | 分组维度,必传且**不能为空数组**,否则返回结果为空 |
48
+ | order | string | 否 | — | 排序字段,填单个维度 code,取值范围为 `dimensions` 的可选值。不必包含在已传的 `dimensions` 中,服务端会自动补入参与排序,但该字段不会作为列返回 |
49
+ | orderType | string | 否 | `asc` | 排序方向:`desc` / `asc` |
50
+ | page | integer | 否 | `1` | 页码,从 1 开始 |
51
+ | size | integer | 否 | `10` | 每页条数,建议显式传且不超过 1000 |
52
+
53
+ ### dimensionValues
54
+
55
+ | 字段 | 类型 | 必填 | 说明 |
56
+ | --- | --- | --- | --- |
57
+ | account_id | string[] | 是 | 广告账户 ID(带格式),必须带前缀,例如 `act_1036928420879324`。最多传 500 个 |
58
+
59
+ ### dimensions 可选值
60
+
61
+ | code | 含义 |
62
+ | --- | --- |
63
+ | calendar_date | 投放日期 |
64
+ | account_id | 广告账户 |
65
+ | account_name | 账户名称 |
66
+ | campaign_id | 广告系列 ID |
67
+ | campaign_name | 广告系列名称 |
68
+ | adgroup_id | 广告组 ID |
69
+ | adgroup_name | 广告组名称 |
70
+ | ad_id | 广告 ID |
71
+ | ad_name | 广告名称 |
72
+ | optimization_goal | 成效目标 |
73
+ | ad_format | 创意类型 |
74
+ | bid_strategy | 出价方式 |
75
+ | audience_type | 受众类型 |
76
+ | targeting_age | 年龄 |
77
+ | targeting_genders | 性别 |
78
+ | cpc_bid_amount | CPC 出价 |
79
+ | cpm_bid_amount | CPM 出价 |
80
+ | cpv_bid_amount | CPV 出价 |
81
+ | advertising_channel_type | 广告系列类型 |
82
+ | keywords | 关键字 |
83
+ | country_code | 国家(必须单独传,不能和其他维度同时传) |
84
+
85
+ > Google 渠道**不含** `objective`(广告目标)、`targeting_interests`(兴趣词包)。
86
+
87
+ ## 返回格式
88
+
89
+ - `result.data` 为数据行数组,每行的每个字段有两个 key:
90
+ - **原始值**:key 即请求的 code,做计算或比较时用这个
91
+ - **展示值**:key 加 `display_` 前缀,直接呈现给用户时用这个,空值为 `"-"`
92
+ - `result.headerMap` 是字段 code 到中文列名的映射,用于给用户展示列名
93
+ - `result.total` 为总条数,`result.page` 和 `result.size` 为当前分页
94
+ - 外层 `code=0` 表示成功;非 0 时 `result` 为 `null`,失败原因在 `message` 字段里
95
+
96
+ ## 请求示例
97
+
98
+ ```json
99
+ {
100
+ "startDate": "2026-08-01",
101
+ "endDate": "2026-08-31",
102
+ "dimensionValues": {
103
+ "account_id": ["act_1036928420879324"]
104
+ },
105
+ "dimensions": [
106
+ "account_id",
107
+ "ad_id",
108
+ "ad_name",
109
+ "optimization_goal",
110
+ "ad_format",
111
+ "bid_strategy",
112
+ "advertising_channel_type"
113
+ ],
114
+ "order": "ad_id",
115
+ "orderType": "asc",
116
+ "page": 1,
117
+ "size": 20
118
+ }
119
+ ```
120
+
121
+ ## 成功响应示例
122
+
123
+ ```json
124
+ {
125
+ "code": 0,
126
+ "message": "success",
127
+ "result": {
128
+ "page": 1,
129
+ "size": 20,
130
+ "total": 1,
131
+ "headerMap": {
132
+ "account_id": "广告账户",
133
+ "ad_id": "广告ID",
134
+ "ad_name": "广告名称",
135
+ "optimization_goal": "成效目标",
136
+ "ad_format": "创意类型",
137
+ "bid_strategy": "出价方式",
138
+ "advertising_channel_type": "广告系列类型"
139
+ },
140
+ "data": [
141
+ {
142
+ "account_id": "act_1036928420879324",
143
+ "display_account_id": "act_1036928420879324",
144
+ "ad_id": "120210000000000001",
145
+ "display_ad_id": "120210000000000001",
146
+ "ad_name": "示例广告",
147
+ "display_ad_name": "示例广告",
148
+ "optimization_goal": "CONVERSIONS",
149
+ "display_optimization_goal": "转化",
150
+ "ad_format": "RESPONSIVE_SEARCH_AD",
151
+ "display_ad_format": "自适应搜索广告",
152
+ "bid_strategy": "TARGET_CPA",
153
+ "display_bid_strategy": "目标 CPA",
154
+ "advertising_channel_type": "SEARCH",
155
+ "display_advertising_channel_type": "搜索"
156
+ }
157
+ ]
158
+ }
159
+ }
160
+ ```
161
+
162
+ ## 失败响应示例
163
+
164
+ ```json
165
+ {
166
+ "code": 1,
167
+ "message": "country_code 不能和其他维度同时传入",
168
+ "result": null
169
+ }
170
+ ```