@taptap/instant-games-open-mcp 1.24.6 → 1.24.7

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.
package/README.md CHANGED
@@ -45,13 +45,13 @@
45
45
 
46
46
  ## 🛠️ TapTap Maker 本地开发(CLI-first)
47
47
 
48
- Maker 本地开发按“初始化用 CLI,开发循环用 MCP”拆分。首次配置推荐直接运行:
48
+ Maker 本地开发独立发布为 `@taptap/maker`。首次配置推荐直接运行:
49
49
 
50
50
  ```bash
51
51
  npx -y @taptap/maker init
52
52
  ```
53
53
 
54
- CLI 负责一次性流程:Git 检查、PAT 保存、TapTap token 换取、app 列表选择、Maker Git
54
+ CLI 负责一次性流程:Git 检查、CLI 登录、TapTap token 换取、app 列表选择、Maker Git
55
55
  clone、AI dev kit 准备、MCP 配置写入与基础验证。安装或修改 MCP 配置后,Claude Code /
56
56
  Codex / Cursor 通常需要重启会话、刷新 MCP 或新开窗口才会出现新的 MCP tools;但当前终端
57
57
  里的 CLI 初始化流程可以继续完成到 PAT 鉴权和项目绑定。
@@ -60,31 +60,26 @@ Codex / Cursor 通常需要重启会话、刷新 MCP 或新开窗口才会出现
60
60
 
61
61
  ```bash
62
62
  taptap-maker init
63
+ taptap-maker login
63
64
  taptap-maker doctor
64
65
  taptap-maker apps --json
65
- taptap-maker pat set
66
66
  taptap-maker install --ide codex,cursor,claude
67
67
  taptap-maker mcp verify
68
68
  taptap-maker dev-kit update
69
69
  ```
70
70
 
71
- `taptap-maker pat set` 默认通过交互式 prompt 接收 PAT,避免把 PAT 写进
72
- `ps` 进程列表或 shell history;自动化场景可用 `--pat-stdin` 从标准输入读取。
73
- `taptap-maker install` 是 `taptap-maker mcp install` 的快捷别名,二者都会写入 AI 客户端
74
- MCP 配置。`taptap-maker mcp verify` 默认验证 `mcp install` 写入 AI 客户端配置的 npx 启动命令;
75
- 本地开发只想验证当前 CLI 时可加 `--mode self`。如果验证输出 `status: null`
76
- `failure_type`,说明本地 Node/npm/npx 启动命令还没正常跑通,Maker MCP server
77
- 尚未启动;这不是 PAT、app 选择或 Maker 业务接口报错。先按输出里的 command
78
- 在终端直接执行,再检查 `where.exe npx/node/npm`、`node -v` 和 `npm -v`。
71
+ `taptap-maker login` CLI 登录入口;它会按需打开 Maker 授权页,CLI 轮询授权结果并完成本地鉴权配置。
72
+ `taptap-maker init` PAT 时会自动进入该流程。`taptap-maker pat set` 保留为兼容入口;
73
+ 自动化场景可用 `--pat-stdin` 从标准输入读取。`taptap-maker install`
74
+ `taptap-maker mcp install` 的快捷别名,二者都会写入 AI 客户端 MCP 配置。
75
+ `taptap-maker dev-kit update` 会检查当前环境可用的最新 AI dev kit 并更新当前目录。
79
76
 
80
- MCP 精简为开发循环里的高频能力:
77
+ Maker MCP 精简为开发循环里的高频能力:
81
78
 
82
79
  ```text
83
80
  maker://status # Resource,读取本地 Maker 状态
84
81
  maker_status_lite # Resource 不可用时的兼容 tool
85
82
  maker_build_current_directory # commit/push/build 合并入口
86
- maker_pull_runtime_logs # 单次拉取运行日志并落到本地固定路径
87
- taptap-maker logs watch # CLI,构建成功后持续轮询运行日志
88
83
  ```
89
84
 
90
85
  `maker_build_current_directory` 同时覆盖“构建 / 预览 / 跑一下 / 验证一下 / 提交 / 推送”。
@@ -94,56 +89,18 @@ build。push 失败时不会继续 build,会返回本地 commit、ahead 状态
94
89
  Maker 远端但构建失败。只有用户明确说“不提交,只构建云端版本”时,才传
95
90
  `confirm_remote_build_without_submit=true`。
96
91
 
97
- 构建成功并收到远端 build 返回后,Maker MCP 会主动调用当前环境的 Maker Web
98
- `/api/v1/apps/<APP_ID>/preview-refresh`,让 Web 端预览页刷新到最新构建。
99
- 构建成功输出会同时给出本地 watcher 状态;MCP 在收到远端 build 返回后会启动本地
100
- `taptap-maker logs watch --target-dir <PROJECT_ROOT> --reset --interval 5s` detached 进程,
101
- CLI 清理历史日志并持续轮询。后续如果用户询问游戏运行结果、Lua 报错或调试问题,
102
- 本地 AI Agent 应优先读取返回中的 `runtime_logs.local_file`;如需判断 watcher 是否正常,
103
- 读取 `runtime_logs.state_file`。
104
-
105
- `maker_pull_runtime_logs` 只做固定的一次性业务流:调用远端 `query_runtime_logs`,默认只拉
106
- `user_script`(客户端 Lua 脚本)和 `server_user_script`(服务端 Lua 脚本)。本地只追加写入一份
107
- `.maker/logs/runtime/runtime.log`,保持 server 日志行格式(`t/topic/level/msg/userId` 等),
108
- 但去掉无用的 `id` 字段,也不再补 `time/message` 重复字段;`.maker/logs/runtime/state.json`
109
- 保存下一次查询游标和 watcher 心跳状态,包括最近轮询时间、最近成功时间、最近写入条数、
110
- 连续失败次数和最后错误。
111
- 持续轮询和清理旧日志由 `taptap-maker logs watch --reset --interval 5s` 承担,不放进 MCP
112
- tool 长调用;远端返回 `hasMore=true` 时会立即继续拉取,否则每 5 秒轮询一次。
113
-
114
- `maker://status` 和 `maker_status_lite` 会在已绑定项目里检查 Maker 远端同步状态。
115
- 如果远端有新提交,状态输出会区分本地工作区是否干净:干净时提示可先
116
- `git pull --ff-only origin main`,有本地改动时提示不要直接 pull,应让本地 Agent 先处理
117
- 提交、stash 或取消同步。
118
- 频繁轮询状态或只需要快速本地状态时,调用 `maker_status_lite` 应传
119
- `skip_remote_sync=true`,避免每次状态查询都触发 `git fetch origin` 网络往返。
120
-
121
- 首次 clone/fetch 和 push 遇到 503、HTTP 5xx、超时、连接重置、RPC/HTTP2 中断等临时网络错误时会自动重试;认证、权限、仓库不存在、远端拒绝和本地目录冲突不会重试,会把错误分类交给 Agent 处理。首次 clone/fetch 前 CLI 会提示 Maker server 可能正在准备仓库,首次拉代码 20 秒以上是正常现象,建议保持命令运行等待自动重试。
92
+ 构建成功后,Maker MCP 会刷新 Maker Web 预览,并启动本地 runtime log watcher。后续如果用户询问
93
+ 游戏运行结果、Lua 报错或调试问题,本地 AI Agent 应优先读取构建返回中的
94
+ `runtime_logs.local_file`;如需判断 watcher 是否正常,读取 `runtime_logs.state_file`。
95
+
96
+ Maker MCP 也提供部分生成类能力,当前包括 `generate_image`、`batch_generate_images`、
97
+ `edit_image`、`create_video_task` `text_to_music`;具体参数以 MCP 客户端展示的 tool
98
+ schema 为准。代理转发和白名单细节见 [TapTap Maker 本地开发](docs/MAKER.md)。
122
99
 
123
100
  Windows 是默认优先级:CLI 写 MCP 配置时会在 Windows 使用 `npx.cmd`,Git 引导优先提示
124
101
  Git for Windows,并要求安装选项允许命令行和第三方工具通过 PATH 找到 Git。macOS 用户可通过
125
102
  `git --version` 触发 Xcode Command Line Tools,或安装官方 Git。
126
103
 
127
- ### Maker 本地 Workflow Skills(实验中)
128
-
129
- Maker 现在同时内置三个工作流 skill:
130
-
131
- - `taptap-maker-local`:把 Maker 初始化转交 CLI,并让本地 AI/Agent 按 push 失败分类处理 pull/rebase、切回 main、移除禁止路径、鉴权刷新、冲突和构建失败恢复。
132
- - `taptap-maker-dev-kit-guide`:介绍 clone 时安装到项目目录的 AI dev kit,明确 `CLAUDE.md`、`examples/`、`templates/`、`urhox-libs/` 的用途。
133
- - `update-taptap-mcp`:引导用户更新本地 npx 缓存里的 `@taptap/maker`,并提醒 Maker MCP 推荐安装到 user/global scope。
134
-
135
- 初始化流程里,PAT 验证通过、用户选择 app 后,`taptap-maker init` 会先完成 Maker Git checkout,再自动准备本地 AI dev kit。
136
-
137
- CLI 会根据 `TAPTAP_MCP_ENV` 自动选择下载源:`production`(默认)使用 `https://urhox-demo-platform.spark.xd.com/ai-dev-kit/pd/stable/ai-dev-kit.zip`,`rnd` 使用 `https://urhox-demo-platform.spark.xd.com/ai-dev-kit/rnd/latest/ai-dev-kit.zip`,checkout 后解压开发环境文档、引擎 API、demo、Lua 工具和本地 AI skills 到当前目录,并用 dev kit 覆盖同名本地辅助文件;解压复制完成后会自动运行 `tools/install-skills.sh all`(Linux/macOS)或 `tools/install-skills.ps1 all`(Windows),把 dev kit skills 安装到各 Agent 的发现目录。CLI 会先输出 `AI skills install started: <script>`,完成后输出 `AI skills install result: claude=N, codex=N, cursor=N, gemini=N`;脚本缺失、跳过或失败时也会输出原因,失败会带上平台、脚本、命令、stdout 和 stderr,方便 AI 与用户直接判断安装情况。流程会跳过 ZIP 里的顶层 `scripts` 目录并删除下载 ZIP,避免和 Maker 项目代码冲突。dev-kit 准备阶段会生成 `.gitignore.dev-kit-before-clone` 临时 block,准备成功后自动合并到远端 `.gitignore`,防止这些本地开发环境文件、Agent skill 目录和 `.maker/` 本地运行状态被提交到 Maker Git。
138
-
139
- `maker://status` 和 `maker_status_lite` 会输出已随包内置的 skill 名称和文档路径:`taptap-maker-local`、`taptap-maker-dev-kit-guide` 与 `update-taptap-mcp`。Maker 操作目标是用户当前项目目录;若 MCP 进程 cwd 是临时对话目录,Agent 应把用户当前项目目录作为 `target_dir` 传入,不扫描其他项目。已绑定项目会检查 `CLAUDE.md`、`examples/`、`templates/`、`urhox-libs/`,并输出 `skill_install_status` 和 `skill_install_summary` 说明 `.claude/.codex/.cursor/.gemini` 下的 skill 安装状态;缺失时用 `taptap-maker dev-kit update` 恢复本地 AI dev kit 并刷新 `.gitignore` 管理块。
140
-
141
- Git 引导:
142
-
143
- - macOS:用户自行执行 `git --version`,按系统提示安装 Xcode Command Line Tools,或访问 `https://git-scm.com/download/mac` 下载安装器。
144
- - Windows:用户自行访问 `https://git-scm.com/download/win` 安装 Git for Windows,并确保安装选项允许命令行和第三方工具通过 PATH 找到 Git。
145
- - 安装后需要重启 MCP 客户端或终端,再用 `git --version` 验证。
146
-
147
104
  详见:[TapTap Maker 本地开发](docs/MAKER.md)。面向团队介绍的功能总览见
148
105
  [Maker CLI + MCP + Skill Rework Overview](docs/MAKER_CLI_MCP_SKILL_REWORK_OVERVIEW.md)。
149
106
 
@@ -391,12 +348,10 @@ maker_status_lite
391
348
  maker_build_current_directory
392
349
  ```
393
350
 
394
- `taptap-maker doctor` 会检查 Git、PAT、TapTap token、项目绑定和 MCP 配置。若 Git 不可用,clone/push 会直接停止,直到用户自行安装 Git 并通过 `git --version` 验证。
351
+ `taptap-maker doctor` 会检查 Git、PAT、TapTap token、项目绑定、AI dev kit 版本和 MCP 配置。若 Git 不可用,clone/push 会直接停止,直到用户自行安装 Git 并通过 `git --version` 验证。
395
352
  `taptap-maker mcp verify` 默认跑一次实际 MCP 配置使用的 npx 包命令;本地 dist 自测可用 `--mode self`。如果失败结果显示 `failure_type` 或 `status: null`,优先按本地 Node/npm/npx 启动问题处理,Maker MCP server 此时尚未启动,不要误判为 PAT 或 Maker 服务报错。
396
353
 
397
- 测试时引导用户访问当前环境的 PAT 页面新建 Maker PAT,
398
- production 使用 `https://maker.taptap.cn/pat-tokens`,RND 使用 `https://fuping.agnt.xd.com/pat-tokens`,
399
- 再运行 `taptap-maker pat set` 并在 prompt 中粘贴 PAT,CLI 会同步获取 TapTap token。
354
+ 测试时优先运行 `taptap-maker login`;CLI 会按需打开 Maker 授权页,授权完成后自动完成本地鉴权配置。
400
355
  当前目录未绑定时,APP_ID 应通过 `taptap-maker init` 或 `taptap-maker apps` 返回的 app 列表让用户选择;当前目录已绑定时不要再次引导 clone。
401
356
 
402
357
  ```bash
package/dist/proxy.js CHANGED
@@ -29137,7 +29137,7 @@ var LogWriter = class {
29137
29137
  };
29138
29138
 
29139
29139
  // src/mcp-proxy/proxy.ts
29140
- var VERSION = true ? "1.24.6" : "dev";
29140
+ var VERSION = true ? "1.24.7" : "dev";
29141
29141
  var LOCAL_PROXY_TAG = "local";
29142
29142
  var TapTapMCPProxy = class {
29143
29143
  constructor(config2) {
@@ -29213,6 +29213,9 @@ var TapTapMCPProxy = class {
29213
29213
  if (this.config.tenant.user_id) {
29214
29214
  this.log("info", `User ID: ${this.config.tenant.user_id}`);
29215
29215
  }
29216
+ if (this.config.tenant.client_session_id) {
29217
+ this.log("info", `Client Session ID: ${this.config.tenant.client_session_id}`);
29218
+ }
29216
29219
  if (this.config.tenant.project_id) {
29217
29220
  this.log("info", `Project ID: ${this.config.tenant.project_id}`);
29218
29221
  }
@@ -29240,6 +29243,7 @@ var TapTapMCPProxy = class {
29240
29243
  *
29241
29244
  * Headers:
29242
29245
  * - X-TapTap-User-Id: 用户标识
29246
+ * - X-TapTap-Client-Session-Id: 业务/编辑器会话标识
29243
29247
  * - X-TapTap-Project-Id: 项目标识
29244
29248
  * - X-TapTap-Project-Path: 项目路径
29245
29249
  * - X-TapTap-Mac-Token: MAC 认证令牌(JSON)
@@ -29252,6 +29256,9 @@ var TapTapMCPProxy = class {
29252
29256
  if (this.config.tenant.user_id) {
29253
29257
  headers["X-TapTap-User-Id"] = this.config.tenant.user_id;
29254
29258
  }
29259
+ if (this.config.tenant.client_session_id) {
29260
+ headers["X-TapTap-Client-Session-Id"] = this.config.tenant.client_session_id;
29261
+ }
29255
29262
  if (this.config.tenant.project_id) {
29256
29263
  headers["X-TapTap-Project-Id"] = this.config.tenant.project_id;
29257
29264
  }
@@ -29273,6 +29280,7 @@ var TapTapMCPProxy = class {
29273
29280
  * 注入的参数(以下划线开头,表示私有):
29274
29281
  * - _mac_token: MAC 认证令牌
29275
29282
  * - _user_id: 用户标识(可选)
29283
+ * - _client_session_id: 业务/编辑器会话标识(可选)
29276
29284
  * - _project_id: 项目标识(可选)
29277
29285
  * - _project_path: 项目路径(可选)
29278
29286
  * - _custom_fields: 业务自定义字段(可选)
@@ -29285,6 +29293,9 @@ var TapTapMCPProxy = class {
29285
29293
  if (this.config.tenant.user_id) {
29286
29294
  injected._user_id = this.config.tenant.user_id;
29287
29295
  }
29296
+ if (this.config.tenant.client_session_id) {
29297
+ injected._client_session_id = this.config.tenant.client_session_id;
29298
+ }
29288
29299
  if (this.config.tenant.project_id) {
29289
29300
  injected._project_id = this.config.tenant.project_id;
29290
29301
  }
@@ -29296,6 +29307,37 @@ var TapTapMCPProxy = class {
29296
29307
  }
29297
29308
  return injected;
29298
29309
  }
29310
+ /**
29311
+ * Restrict the proxied tool list to the configured public surface.
29312
+ *
29313
+ * The proxy does not wrap or rewrite upstream tool definitions. It only hides tools that are not
29314
+ * included in options.exposed_tools. Omitting the option keeps the historical full passthrough.
29315
+ */
29316
+ filterListedTools(result) {
29317
+ var _a3;
29318
+ const exposedTools = (_a3 = this.config.options) == null ? void 0 : _a3.exposed_tools;
29319
+ if (!exposedTools) {
29320
+ return result;
29321
+ }
29322
+ const exposedToolNames = new Set(exposedTools);
29323
+ return {
29324
+ ...result,
29325
+ tools: result.tools.filter((tool) => exposedToolNames.has(tool.name))
29326
+ };
29327
+ }
29328
+ /**
29329
+ * Prevent callers from invoking tools hidden from tools/list.
29330
+ */
29331
+ assertToolExposed(name) {
29332
+ var _a3;
29333
+ const exposedTools = (_a3 = this.config.options) == null ? void 0 : _a3.exposed_tools;
29334
+ if (!exposedTools) {
29335
+ return;
29336
+ }
29337
+ if (!exposedTools.includes(name)) {
29338
+ throw new McpError(ErrorCode.MethodNotFound, `Tool is not exposed by this proxy: ${name}`);
29339
+ }
29340
+ }
29299
29341
  /**
29300
29342
  * 连接到 TapTap MCP Server
29301
29343
  */
@@ -29628,7 +29670,7 @@ var TapTapMCPProxy = class {
29628
29670
  );
29629
29671
  }
29630
29672
  const result = await this.client.listTools();
29631
- return result;
29673
+ return this.filterListedTools(result);
29632
29674
  });
29633
29675
  this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
29634
29676
  if (!this.connected) {
@@ -29653,6 +29695,7 @@ var TapTapMCPProxy = class {
29653
29695
  this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
29654
29696
  var _a3, _b, _c, _d, _e, _f, _g;
29655
29697
  const { name, arguments: args } = request.params;
29698
+ this.assertToolExposed(name);
29656
29699
  const shouldInjectParams = ((_a3 = this.config.options) == null ? void 0 : _a3.inject_params_per_call) ?? true;
29657
29700
  const finalArgs = shouldInjectParams ? this.injectPrivateParams(args) : args;
29658
29701
  if ((_b = this.config.options) == null ? void 0 : _b.verbose) {
@@ -29790,6 +29833,7 @@ Received: ${configJson.substring(0, 100)}...`
29790
29833
  return applyDefaults(config2);
29791
29834
  }
29792
29835
  function validateConfig(config2) {
29836
+ var _a3;
29793
29837
  const errors = [];
29794
29838
  if (!config2.server) {
29795
29839
  errors.push("- Missing required field: server");
@@ -29804,6 +29848,9 @@ function validateConfig(config2) {
29804
29848
  if (!config2.tenant) {
29805
29849
  errors.push("- Missing required field: tenant");
29806
29850
  } else {
29851
+ if (config2.tenant.client_session_id !== void 0 && typeof config2.tenant.client_session_id !== "string") {
29852
+ errors.push("- tenant.client_session_id must be a string");
29853
+ }
29807
29854
  if (config2.tenant.custom_fields !== void 0) {
29808
29855
  const cf = config2.tenant.custom_fields;
29809
29856
  if (typeof cf !== "object" || cf === null || Array.isArray(cf) || Object.getPrototypeOf(cf) !== Object.prototype) {
@@ -29829,13 +29876,21 @@ function validateConfig(config2) {
29829
29876
  errors.push('- Invalid auth.mac_algorithm: must be "hmac-sha-1"');
29830
29877
  }
29831
29878
  }
29879
+ if (((_a3 = config2.options) == null ? void 0 : _a3.exposed_tools) !== void 0) {
29880
+ const exposedTools = config2.options.exposed_tools;
29881
+ if (!Array.isArray(exposedTools)) {
29882
+ errors.push("- options.exposed_tools must be an array of tool names");
29883
+ } else if (!exposedTools.every((toolName) => typeof toolName === "string" && toolName.trim().length > 0)) {
29884
+ errors.push("- options.exposed_tools values must be non-empty strings");
29885
+ }
29886
+ }
29832
29887
  if (errors.length > 0) {
29833
29888
  throw new Error("Invalid configuration:\n" + errors.join("\n"));
29834
29889
  }
29835
29890
  }
29836
29891
  var DEFAULT_LOG_ROOT = "/tmp/taptap-mcp/logs";
29837
29892
  function applyDefaults(config2) {
29838
- var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
29893
+ var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
29839
29894
  const verbose = ((_a3 = config2.options) == null ? void 0 : _a3.verbose) ?? false;
29840
29895
  return {
29841
29896
  server: {
@@ -29846,6 +29901,7 @@ function applyDefaults(config2) {
29846
29901
  project_path: config2.tenant.project_path || ".",
29847
29902
  user_id: config2.tenant.user_id,
29848
29903
  project_id: config2.tenant.project_id,
29904
+ client_session_id: config2.tenant.client_session_id,
29849
29905
  custom_fields: config2.tenant.custom_fields
29850
29906
  },
29851
29907
  auth: config2.auth,
@@ -29860,12 +29916,13 @@ function applyDefaults(config2) {
29860
29916
  enable_cookie_sticky: ((_g = config2.options) == null ? void 0 : _g.enable_cookie_sticky) ?? true,
29861
29917
  inject_params_per_call: ((_h = config2.options) == null ? void 0 : _h.inject_params_per_call) ?? true,
29862
29918
  force_inject_progress_token: ((_i = config2.options) == null ? void 0 : _i.force_inject_progress_token) ?? false,
29919
+ exposed_tools: (_j = config2.options) == null ? void 0 : _j.exposed_tools,
29863
29920
  log: {
29864
- root: ((_k = (_j = config2.options) == null ? void 0 : _j.log) == null ? void 0 : _k.root) ?? DEFAULT_LOG_ROOT,
29865
- enabled: ((_m = (_l = config2.options) == null ? void 0 : _l.log) == null ? void 0 : _m.enabled) ?? false,
29921
+ root: ((_l = (_k = config2.options) == null ? void 0 : _k.log) == null ? void 0 : _l.root) ?? DEFAULT_LOG_ROOT,
29922
+ enabled: ((_n = (_m = config2.options) == null ? void 0 : _m.log) == null ? void 0 : _n.enabled) ?? false,
29866
29923
  // verbose=true 时自动使用 debug 级别
29867
- level: verbose ? "debug" : ((_o = (_n = config2.options) == null ? void 0 : _n.log) == null ? void 0 : _o.level) ?? "info",
29868
- max_days: ((_q = (_p = config2.options) == null ? void 0 : _p.log) == null ? void 0 : _q.max_days) ?? 7
29924
+ level: verbose ? "debug" : ((_p = (_o = config2.options) == null ? void 0 : _o.log) == null ? void 0 : _p.level) ?? "info",
29925
+ max_days: ((_r = (_q = config2.options) == null ? void 0 : _q.log) == null ? void 0 : _r.max_days) ?? 7
29869
29926
  }
29870
29927
  }
29871
29928
  };