@actiondock/mcp 2.0.11 → 2.2.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.
- package/README.md +9 -9
- package/dist/adapter.d.ts +51 -0
- package/dist/adapter.js +395 -0
- package/dist/execution-mode.d.ts +30 -0
- package/dist/execution-mode.js +63 -0
- package/dist/http.d.ts +5 -0
- package/dist/http.js +221 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/register-tasks-extension.d.ts +9 -0
- package/dist/register-tasks-extension.js +69 -0
- package/dist/schemas.d.ts +6 -0
- package/dist/schemas.js +30 -0
- package/dist/stdio-host.d.ts +2 -0
- package/dist/stdio-host.js +13 -0
- package/dist/stdio.d.ts +10 -0
- package/dist/stdio.js +114 -0
- package/dist/types.d.ts +99 -0
- package/dist/types.js +33 -0
- package/package.json +13 -12
- package/src/adapter.ts +0 -437
- package/src/http.ts +0 -163
- package/src/index.ts +0 -5
- package/src/schemas.ts +0 -19
- package/src/stdio.ts +0 -51
- package/src/types.ts +0 -105
package/src/stdio.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
2
|
-
import { createActionDockMcpServer, type ActionDockMcpServer } from "./adapter";
|
|
3
|
-
import type { ActionDockMcpOptions } from "./types";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Starts an ActionDock MCP server over STDIO transport.
|
|
7
|
-
*/
|
|
8
|
-
export async function startMcpStdio(
|
|
9
|
-
options: ActionDockMcpOptions = {}
|
|
10
|
-
): Promise<void> {
|
|
11
|
-
let activeServer: ActionDockMcpServer | undefined;
|
|
12
|
-
|
|
13
|
-
const stdioHandler = serveStdio(
|
|
14
|
-
async () => {
|
|
15
|
-
const server = await createActionDockMcpServer(options);
|
|
16
|
-
activeServer = server;
|
|
17
|
-
return server;
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
onerror: (err) => {
|
|
21
|
-
process.stderr.write(`[MCP Error] ${err?.message || String(err)}\n`);
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const cleanup = async () => {
|
|
27
|
-
if (activeServer) {
|
|
28
|
-
try {
|
|
29
|
-
await activeServer.close();
|
|
30
|
-
} catch {
|
|
31
|
-
// ignore
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
process.once("SIGINT", async () => {
|
|
37
|
-
await cleanup();
|
|
38
|
-
try {
|
|
39
|
-
await stdioHandler.close();
|
|
40
|
-
} catch {}
|
|
41
|
-
process.exit(0);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
process.once("SIGTERM", async () => {
|
|
45
|
-
await cleanup();
|
|
46
|
-
try {
|
|
47
|
-
await stdioHandler.close();
|
|
48
|
-
} catch {}
|
|
49
|
-
process.exit(0);
|
|
50
|
-
});
|
|
51
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { ExecutionManager, RuntimeStorage, ServerRuntimeRegistry } from "@actiondock/core";
|
|
2
|
-
import type { ActionDefinition, ExecutionResult, RunRecord, RunStatus } from "@actiondock/sdk";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* MCP 任务状态枚举(兼容 Model Context Protocol Task 规范)。
|
|
6
|
-
*/
|
|
7
|
-
export type McpTaskStatus = "working" | "completed" | "failed" | "cancelled";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* MCP 任务状态数据载荷结构体。
|
|
11
|
-
*/
|
|
12
|
-
export interface McpTaskPayload {
|
|
13
|
-
taskId: string;
|
|
14
|
-
status: McpTaskStatus;
|
|
15
|
-
createdAt: string;
|
|
16
|
-
finishedAt?: string;
|
|
17
|
-
input?: unknown;
|
|
18
|
-
output?: unknown;
|
|
19
|
-
error?: unknown;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 将 ActionDock 内部的 RunStatus 转换为 MCP 标准的 TaskStatus。
|
|
24
|
-
*/
|
|
25
|
-
export function toMcpTaskStatus(status: RunStatus): McpTaskStatus {
|
|
26
|
-
switch (status) {
|
|
27
|
-
case "running":
|
|
28
|
-
return "working";
|
|
29
|
-
case "success":
|
|
30
|
-
return "completed";
|
|
31
|
-
case "failed":
|
|
32
|
-
return "failed";
|
|
33
|
-
case "cancelled":
|
|
34
|
-
return "cancelled";
|
|
35
|
-
default:
|
|
36
|
-
return "working";
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 将内部 RunRecord 实体转换为向 MCP 客户端暴露的 McpTaskPayload。
|
|
42
|
-
*/
|
|
43
|
-
export function toMcpTaskPayload(run: RunRecord): McpTaskPayload {
|
|
44
|
-
return {
|
|
45
|
-
taskId: run.id,
|
|
46
|
-
status: toMcpTaskStatus(run.status),
|
|
47
|
-
createdAt: run.startedAt,
|
|
48
|
-
finishedAt: run.finishedAt,
|
|
49
|
-
input: run.input,
|
|
50
|
-
output: run.output,
|
|
51
|
-
error: run.error,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* ActionDock MCP 适配层初始化选项。
|
|
57
|
-
*/
|
|
58
|
-
export interface ActionDockMcpOptions {
|
|
59
|
-
/** 单个目标项目根目录 */
|
|
60
|
-
projectRoot?: string;
|
|
61
|
-
/** 多个项目根目录(用于多包聚合提供) */
|
|
62
|
-
projectRoots?: string[];
|
|
63
|
-
/** 目标 Package ID */
|
|
64
|
-
packageId?: string;
|
|
65
|
-
/** 多个 Package ID 列表 */
|
|
66
|
-
packageIds?: string[];
|
|
67
|
-
/** 是否聚合暴露全局 Registry 中的所有 Package */
|
|
68
|
-
all?: boolean;
|
|
69
|
-
/** 自定义家目录路径 */
|
|
70
|
-
customHome?: string;
|
|
71
|
-
/** 配置动态覆盖项 */
|
|
72
|
-
configOverrides?: Record<string, unknown>;
|
|
73
|
-
/** 单个 Tool 执行超时时间(毫秒) */
|
|
74
|
-
timeoutMs?: number;
|
|
75
|
-
/** 预加载的 Action 映射表 */
|
|
76
|
-
actions?: Map<string, ActionDefinition>;
|
|
77
|
-
/** 底层存储实例 */
|
|
78
|
-
storage?: RuntimeStorage;
|
|
79
|
-
/** 服务端运行时注册表 */
|
|
80
|
-
runtimeRegistry?: ServerRuntimeRegistry;
|
|
81
|
-
/** 活跃执行任务管理器 */
|
|
82
|
-
executionManager?: ExecutionManager;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* HTTP 传输协议安全配置项。
|
|
87
|
-
*/
|
|
88
|
-
export interface HttpSecurityOptions {
|
|
89
|
-
host?: string;
|
|
90
|
-
port?: number;
|
|
91
|
-
token?: string;
|
|
92
|
-
allowInsecureNoAuth?: boolean;
|
|
93
|
-
corsOrigins?: string[];
|
|
94
|
-
maxBodyBytes?: number;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface ActionDockMcpHttpOptions extends ActionDockMcpOptions, HttpSecurityOptions {}
|
|
98
|
-
|
|
99
|
-
export interface ActionDockMcpHttpServerInstance {
|
|
100
|
-
port: number;
|
|
101
|
-
host: string;
|
|
102
|
-
url: string;
|
|
103
|
-
stop: () => void;
|
|
104
|
-
}
|
|
105
|
-
|