@actiondock/mcp 2.5.0 → 2.5.1

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/dist/adapter.js CHANGED
@@ -177,8 +177,33 @@ export async function resolveTarget(options) {
177
177
  storage: appStorage,
178
178
  customHome: options.customHome,
179
179
  configOverrides: options.configOverrides,
180
+ dataDir: options.dataDir,
180
181
  });
181
182
  }
183
+ let platform = options.platform;
184
+ if (!platform && typeof process !== "undefined" && process.versions?.node) {
185
+ try {
186
+ const { createNodePlatform } = await import("@actiondock/runtime-node");
187
+ platform = createNodePlatform({
188
+ customHome: options.customHome,
189
+ dataDir: options.dataDir,
190
+ rootDir: projectRoot,
191
+ });
192
+ }
193
+ catch {
194
+ // 优雅降级:未安装 @actiondock/runtime-node 时回退 core 默认平台
195
+ }
196
+ }
197
+ for (const pkg of packages) {
198
+ if (typeof pkg === "object" && pkg !== null && !("info" in pkg)) {
199
+ if (platform && !pkg.platform) {
200
+ pkg.platform = platform;
201
+ }
202
+ if (!pkg.dataDir && options.dataDir) {
203
+ pkg.dataDir = options.dataDir;
204
+ }
205
+ }
206
+ }
182
207
  const target = await createActionDockTarget({
183
208
  type: "local",
184
209
  projectRoot,
@@ -188,6 +213,8 @@ export async function resolveTarget(options) {
188
213
  autoLoadCurrentProject: packages.length === 0,
189
214
  },
190
215
  customHome: options.customHome,
216
+ dataDir: options.dataDir,
217
+ platform,
191
218
  });
192
219
  return { target, ownsTarget: true };
193
220
  }
@@ -219,7 +246,36 @@ export async function createActionDockMcpServer(options = {}) {
219
246
  // 任务规范扩展注册集中隔离在独立模块,本层不再直接操作 SDK 内层实例
220
247
  registerTasksExtension(server, target);
221
248
  // 工具注册与模式映射:tools/list 纯粹委托 target.listActions()
222
- const actions = await target.listActions();
249
+ const rawActions = await target.listActions();
250
+ const seenActionKeys = new Map();
251
+ for (const act of rawActions) {
252
+ let pkgId = act.packageId || "";
253
+ let actId = act.id;
254
+ if (act.id.includes("/")) {
255
+ try {
256
+ const parsed = ActionResolver.parseRef(act.id);
257
+ pkgId = pkgId || parsed.packageId || "";
258
+ actId = parsed.actionId;
259
+ }
260
+ catch {
261
+ const idx = act.id.lastIndexOf("/");
262
+ pkgId = pkgId || act.id.slice(0, idx);
263
+ actId = act.id.slice(idx + 1);
264
+ }
265
+ }
266
+ const key = `${pkgId}:${actId}`;
267
+ const existing = seenActionKeys.get(key);
268
+ if (existing) {
269
+ // 若已存在的项是全限定名(含 /),而当前项是短名(不含 /),优先保留短名项
270
+ if (existing.id.includes("/") && !act.id.includes("/")) {
271
+ seenActionKeys.set(key, act);
272
+ }
273
+ }
274
+ else {
275
+ seenActionKeys.set(key, act);
276
+ }
277
+ }
278
+ const actions = Array.from(seenActionKeys.values());
223
279
  // 统计 Action 基础 ID 出现频次,用于同名冲突命名空间隔离
224
280
  const baseCounts = new Map();
225
281
  for (const act of actions) {
package/dist/stdio.js CHANGED
@@ -18,7 +18,7 @@ export async function startMcpStdio(options = {}) {
18
18
  let targetToUse;
19
19
  let childProcess;
20
20
  // 若显式传入了已构造的 target 或不可序列化的内存对象,直接复用或解析目标实例
21
- if (options.target || options.actions || options.storage || options.app || options.host) {
21
+ if (options.target || options.actions || options.storage || options.app || options.host || options.platform) {
22
22
  targetToUse = options.target ?? (await resolveTarget(options)).target;
23
23
  }
24
24
  else {
@@ -36,6 +36,7 @@ export async function startMcpStdio(options = {}) {
36
36
  packageIds: options.packageIds,
37
37
  all: options.all,
38
38
  customHome: options.customHome,
39
+ dataDir: options.dataDir,
39
40
  configOverrides: options.configOverrides,
40
41
  timeoutMs: options.timeoutMs,
41
42
  }),
package/dist/types.d.ts CHANGED
@@ -47,6 +47,10 @@ export interface ActionDockMcpOptions {
47
47
  all?: boolean;
48
48
  /** 自定义家目录路径 */
49
49
  customHome?: string;
50
+ /** 自定义全局数据存储目录 */
51
+ dataDir?: string;
52
+ /** 运行时底层平台适配(如提供 NodeProcessDriver 的平台实例) */
53
+ platform?: import("@actiondock/core").RuntimePlatform;
50
54
  /** 配置动态覆盖项 */
51
55
  configOverrides?: Record<string, unknown>;
52
56
  /** 单个 Tool 执行超时时间(毫秒) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actiondock/mcp",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "ActionDock MCP Adapter for exposing Actions as Model Context Protocol (MCP) Tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,10 +29,18 @@
29
29
  "test": "node ../../scripts/run-tests.ts"
30
30
  },
31
31
  "dependencies": {
32
- "@actiondock/core": "^2.5.0",
33
- "@actiondock/sdk": "^2.5.0",
32
+ "@actiondock/core": "^2.5.1",
33
+ "@actiondock/sdk": "^2.5.1",
34
34
  "@modelcontextprotocol/server": "^2.0.0"
35
35
  },
36
+ "peerDependencies": {
37
+ "@actiondock/runtime-node": "^2.5.1"
38
+ },
39
+ "peerDependenciesMeta": {
40
+ "@actiondock/runtime-node": {
41
+ "optional": true
42
+ }
43
+ },
36
44
  "devDependencies": {
37
45
  "typescript": "^5.7.0"
38
46
  },