@apify/actors-mcp-server 0.1.22-beta.8 → 0.1.22
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 +62 -64
- package/dist/actors.d.ts +74 -0
- package/dist/actors.d.ts.map +1 -0
- package/dist/{tools/utils.js → actors.js} +241 -112
- package/dist/actors.js.map +1 -0
- package/dist/const.d.ts +18 -14
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +22 -22
- package/dist/const.js.map +1 -1
- package/dist/examples/clientSse.d.ts +1 -10
- package/dist/examples/clientSse.d.ts.map +1 -1
- package/dist/examples/clientSse.js +4 -7
- package/dist/examples/clientSse.js.map +1 -1
- package/dist/examples/clientStdio.js +2 -2
- package/dist/examples/clientStdio.js.map +1 -1
- package/dist/examples/clientStdioChat.js +1 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -6
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +1 -1
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +8 -6
- package/dist/input.js.map +1 -1
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +4 -0
- package/dist/logger.js.map +1 -0
- package/dist/main.d.ts +0 -4
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +121 -31
- package/dist/main.js.map +1 -1
- package/dist/server.d.ts +43 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +178 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +46 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +128 -0
- package/dist/tools.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +10 -93
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -18
- package/dist/actor/const.d.ts +0 -10
- package/dist/actor/const.d.ts.map +0 -1
- package/dist/actor/const.js +0 -11
- package/dist/actor/const.js.map +0 -1
- package/dist/actor/server.d.ts +0 -4
- package/dist/actor/server.d.ts.map +0 -1
- package/dist/actor/server.js +0 -82
- package/dist/actor/server.js.map +0 -1
- package/dist/actor/types.d.ts +0 -23
- package/dist/actor/types.d.ts.map +0 -1
- package/dist/actor/types.js +0 -2
- package/dist/actor/types.js.map +0 -1
- package/dist/actor/utils.d.ts +0 -3
- package/dist/actor/utils.d.ts.map +0 -1
- package/dist/actor/utils.js +0 -26
- package/dist/actor/utils.js.map +0 -1
- package/dist/apify-client.d.ts +0 -6
- package/dist/apify-client.d.ts.map +0 -1
- package/dist/apify-client.js +0 -23
- package/dist/apify-client.js.map +0 -1
- package/dist/mcp/actors.d.ts +0 -3
- package/dist/mcp/actors.d.ts.map +0 -1
- package/dist/mcp/actors.js +0 -13
- package/dist/mcp/actors.js.map +0 -1
- package/dist/mcp/client.d.ts +0 -6
- package/dist/mcp/client.d.ts.map +0 -1
- package/dist/mcp/client.js +0 -33
- package/dist/mcp/client.js.map +0 -1
- package/dist/mcp/const.d.ts +0 -3
- package/dist/mcp/const.d.ts.map +0 -1
- package/dist/mcp/const.js +0 -3
- package/dist/mcp/const.js.map +0 -1
- package/dist/mcp/proxy.d.ts +0 -4
- package/dist/mcp/proxy.d.ts.map +0 -1
- package/dist/mcp/proxy.js +0 -29
- package/dist/mcp/proxy.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -41
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -177
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/utils.d.ts +0 -34
- package/dist/mcp/utils.d.ts.map +0 -1
- package/dist/mcp/utils.js +0 -69
- package/dist/mcp/utils.js.map +0 -1
- package/dist/stdio.d.ts +0 -15
- package/dist/stdio.d.ts.map +0 -1
- package/dist/stdio.js +0 -46
- package/dist/stdio.js.map +0 -1
- package/dist/tools/actor.d.ts +0 -40
- package/dist/tools/actor.d.ts.map +0 -1
- package/dist/tools/actor.js +0 -136
- package/dist/tools/actor.js.map +0 -1
- package/dist/tools/build.d.ts +0 -12
- package/dist/tools/build.d.ts.map +0 -1
- package/dist/tools/build.js +0 -120
- package/dist/tools/build.js.map +0 -1
- package/dist/tools/helpers.d.ts +0 -19
- package/dist/tools/helpers.d.ts.map +0 -1
- package/dist/tools/helpers.js +0 -62
- package/dist/tools/helpers.js.map +0 -1
- package/dist/tools/index.d.ts +0 -6
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -8
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/store_collection.d.ts +0 -21
- package/dist/tools/store_collection.d.ts.map +0 -1
- package/dist/tools/store_collection.js +0 -80
- package/dist/tools/store_collection.js.map +0 -1
- package/dist/tools/utils.d.ts +0 -77
- package/dist/tools/utils.d.ts.map +0 -1
- package/dist/tools/utils.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
1
|
import type { ValidateFunction } from 'ajv';
|
|
3
2
|
import type { ActorDefaultRunOptions, ActorDefinition } from 'apify-client';
|
|
4
|
-
|
|
3
|
+
export type Input = {
|
|
4
|
+
actors: string[] | string;
|
|
5
|
+
enableAddingActors?: boolean;
|
|
6
|
+
enableActorAutoLoading?: boolean;
|
|
7
|
+
maxActorMemoryBytes?: number;
|
|
8
|
+
debugActor?: string;
|
|
9
|
+
debugActorInput?: unknown;
|
|
10
|
+
};
|
|
5
11
|
export interface ISchemaProperties {
|
|
6
12
|
type: string;
|
|
7
13
|
title: string;
|
|
@@ -32,84 +38,14 @@ export type ActorDefinitionWithDesc = Omit<ActorDefinition, 'input'> & {
|
|
|
32
38
|
input?: IActorInputSchema;
|
|
33
39
|
};
|
|
34
40
|
export type ActorDefinitionPruned = Pick<ActorDefinitionWithDesc, 'id' | 'actorFullName' | 'buildTag' | 'readme' | 'input' | 'description' | 'defaultRunOptions'>;
|
|
35
|
-
|
|
36
|
-
* Base interface for all tools in the MCP server.
|
|
37
|
-
* Contains common properties shared by all tool types.
|
|
38
|
-
*/
|
|
39
|
-
export interface ToolBase {
|
|
40
|
-
/** Unique name/identifier for the tool */
|
|
41
|
+
export interface Tool {
|
|
41
42
|
name: string;
|
|
42
|
-
|
|
43
|
+
actorFullName: string;
|
|
43
44
|
description: string;
|
|
44
|
-
/** JSON schema defining the tool's input parameters */
|
|
45
45
|
inputSchema: object;
|
|
46
|
-
/** AJV validation function for the input schema */
|
|
47
46
|
ajvValidate: ValidateFunction;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Interface for Actor-based tools - tools that wrap Apify Actors.
|
|
51
|
-
* Extends ToolBase with Actor-specific properties.
|
|
52
|
-
*/
|
|
53
|
-
export interface ActorTool extends ToolBase {
|
|
54
|
-
/** Full name of the Apify Actor (username/name) */
|
|
55
|
-
actorFullName: string;
|
|
56
|
-
/** Optional memory limit in MB for the Actor execution */
|
|
57
47
|
memoryMbytes?: number;
|
|
58
48
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Arguments passed to internal tool calls.
|
|
61
|
-
* Contains both the tool arguments and server references.
|
|
62
|
-
*/
|
|
63
|
-
export type InternalToolArgs = {
|
|
64
|
-
/** Arguments passed to the tool */
|
|
65
|
-
args: Record<string, unknown>;
|
|
66
|
-
/** Reference to the Apify MCP server instance */
|
|
67
|
-
apifyMcpServer: ActorsMcpServer;
|
|
68
|
-
/** Reference to the MCP server instance */
|
|
69
|
-
mcpServer: Server;
|
|
70
|
-
/** Apify API token */
|
|
71
|
-
apifyToken: string;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Interface for internal tools - tools implemented directly in the MCP server.
|
|
75
|
-
* Extends ToolBase with a call function implementation.
|
|
76
|
-
*/
|
|
77
|
-
export interface HelperTool extends ToolBase {
|
|
78
|
-
/**
|
|
79
|
-
* Executes the tool with the given arguments
|
|
80
|
-
* @param toolArgs - Arguments and server references
|
|
81
|
-
* @returns Promise resolving to the tool's output
|
|
82
|
-
*/
|
|
83
|
-
call: (toolArgs: InternalToolArgs) => Promise<object>;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Actorized MCP server tool where this MCP server acts as a proxy.
|
|
87
|
-
* Extends ToolBase with tool associated MCP server.
|
|
88
|
-
*/
|
|
89
|
-
export interface ActorMCPTool extends ToolBase {
|
|
90
|
-
originToolName: string;
|
|
91
|
-
actorID: string;
|
|
92
|
-
/**
|
|
93
|
-
* ID of the Actorized MCP server the tool is associated with.
|
|
94
|
-
* See getMCPServerID()
|
|
95
|
-
*/
|
|
96
|
-
serverId: string;
|
|
97
|
-
serverUrl: string;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Type discriminator for tools - indicates whether a tool is internal or Actor-based.
|
|
101
|
-
*/
|
|
102
|
-
export type ToolType = 'internal' | 'actor' | 'actor-mcp';
|
|
103
|
-
/**
|
|
104
|
-
* Wrapper interface that combines a tool with its type discriminator.
|
|
105
|
-
* Used to store and manage tools of different types uniformly.
|
|
106
|
-
*/
|
|
107
|
-
export interface ToolWrap {
|
|
108
|
-
/** Type of the tool (internal or actor) */
|
|
109
|
-
type: ToolType;
|
|
110
|
-
/** The tool instance */
|
|
111
|
-
tool: ActorTool | HelperTool | ActorMCPTool;
|
|
112
|
-
}
|
|
113
49
|
export interface ActorStats {
|
|
114
50
|
totalRuns: number;
|
|
115
51
|
totalUsers30Days: number;
|
|
@@ -132,23 +68,4 @@ export interface ActorStorePruned {
|
|
|
132
68
|
url: string;
|
|
133
69
|
totalStars?: number | null;
|
|
134
70
|
}
|
|
135
|
-
/**
|
|
136
|
-
* Interface for internal tools - tools implemented directly in the MCP server.
|
|
137
|
-
* Extends ToolBase with a call function implementation.
|
|
138
|
-
*/
|
|
139
|
-
export interface InternalTool extends ToolBase {
|
|
140
|
-
/**
|
|
141
|
-
* Executes the tool with the given arguments
|
|
142
|
-
* @param toolArgs - Arguments and server references
|
|
143
|
-
* @returns Promise resolving to the tool's output
|
|
144
|
-
*/
|
|
145
|
-
call: (toolArgs: InternalToolArgs) => Promise<object>;
|
|
146
|
-
}
|
|
147
|
-
export type Input = {
|
|
148
|
-
actors: string[] | string;
|
|
149
|
-
enableActorAutoLoading?: boolean;
|
|
150
|
-
maxActorMemoryBytes?: number;
|
|
151
|
-
debugActor?: string;
|
|
152
|
-
debugActorInput?: unknown;
|
|
153
|
-
};
|
|
154
71
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE5E,MAAM,MAAM,KAAK,GAAG;IAChB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IAEpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC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tB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,kBAAkB,EAAE,WAAW,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/actors-mcp-server",
|
|
3
|
-
"version": "0.1.22
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Model Context Protocol Server for Apify",
|
|
5
|
+
"description": "Model Context Protocol Server for Apify Actors",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18.0.0"
|
|
8
8
|
},
|
|
9
9
|
"main": "dist/index.js",
|
|
10
10
|
"bin": {
|
|
11
|
-
"actors-mcp-server": "./dist/
|
|
11
|
+
"actors-mcp-server": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
@@ -30,43 +30,41 @@
|
|
|
30
30
|
"model context protocol"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"@modelcontextprotocol/sdk": "^1.9.0",
|
|
33
|
+
"@modelcontextprotocol/sdk": "^1.3.1",
|
|
35
34
|
"ajv": "^8.17.1",
|
|
36
|
-
"apify": "^3.
|
|
37
|
-
"apify-client": "^2.
|
|
35
|
+
"apify": "^3.2.6",
|
|
36
|
+
"apify-client": "^2.11.2",
|
|
38
37
|
"express": "^4.21.2",
|
|
39
|
-
"
|
|
38
|
+
"yargs-parser": "^21.1.1",
|
|
40
39
|
"zod": "^3.24.1",
|
|
41
40
|
"zod-to-json-schema": "^3.24.1"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
43
|
"@anthropic-ai/sdk": "^0.33.1",
|
|
45
44
|
"@anthropic-ai/tokenizer": "^0.0.4",
|
|
46
|
-
"@apify/eslint-config": "^
|
|
45
|
+
"@apify/eslint-config": "^0.5.0-beta.2",
|
|
47
46
|
"@apify/tsconfig": "^0.1.0",
|
|
48
47
|
"@types/express": "^4.0.0",
|
|
49
48
|
"@types/minimist": "^1.2.5",
|
|
49
|
+
"@types/yargs-parser": "^21.0.3",
|
|
50
50
|
"dotenv": "^16.4.7",
|
|
51
|
-
"eslint": "^9.
|
|
51
|
+
"eslint": "^9.17.0",
|
|
52
52
|
"eventsource": "^3.0.2",
|
|
53
53
|
"tsx": "^4.6.2",
|
|
54
54
|
"typescript": "^5.3.3",
|
|
55
|
-
"typescript-eslint": "^8.
|
|
55
|
+
"typescript-eslint": "^8.18.2",
|
|
56
56
|
"vitest": "^3.0.8"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"start": "npm run start:dev",
|
|
60
60
|
"start:prod": "node dist/main.js",
|
|
61
61
|
"start:dev": "tsx src/main.ts",
|
|
62
|
-
"lint": "
|
|
63
|
-
"lint:fix": "
|
|
62
|
+
"lint": "eslint .",
|
|
63
|
+
"lint:fix": "eslint . --fix",
|
|
64
64
|
"build": "tsc",
|
|
65
|
-
"
|
|
66
|
-
"inspector": "npx @modelcontextprotocol/inspector dist/
|
|
67
|
-
"test": "vitest run"
|
|
68
|
-
"type-check": "tsc --noEmit",
|
|
69
|
-
"clean": "tsc -b src --clean"
|
|
65
|
+
"watch": "tsc --watch",
|
|
66
|
+
"inspector": "npx @modelcontextprotocol/inspector dist/index.js",
|
|
67
|
+
"test": "vitest run"
|
|
70
68
|
},
|
|
71
69
|
"author": "Apify",
|
|
72
70
|
"license": "MIT"
|
package/dist/actor/const.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../src/actor/const.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,sBAAsB,6CAA6C,CAAC;AAEjF,oBAAY,MAAM;IACd,IAAI,MAAM;IACV,GAAG,SAAS;IACZ,OAAO,aAAa;CACvB"}
|
package/dist/actor/const.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Constants for the Actor.
|
|
3
|
-
*/
|
|
4
|
-
export const HEADER_READINESS_PROBE = 'x-apify-container-server-readiness-probe';
|
|
5
|
-
export var Routes;
|
|
6
|
-
(function (Routes) {
|
|
7
|
-
Routes["ROOT"] = "/";
|
|
8
|
-
Routes["SSE"] = "/sse";
|
|
9
|
-
Routes["MESSAGE"] = "/message";
|
|
10
|
-
})(Routes || (Routes = {}));
|
|
11
|
-
//# sourceMappingURL=const.js.map
|
package/dist/actor/const.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../src/actor/const.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,0CAA0C,CAAC;AAEjF,MAAM,CAAN,IAAY,MAIX;AAJD,WAAY,MAAM;IACd,oBAAU,CAAA;IACV,sBAAY,CAAA;IACZ,8BAAoB,CAAA;AACxB,CAAC,EAJW,MAAM,KAAN,MAAM,QAIjB"}
|
package/dist/actor/server.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/actor/server.ts"],"names":[],"mappings":"AAMA,OAAO,OAAO,MAAM,SAAS,CAAC;AAK9B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIxD,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,eAAe,GAC3B,OAAO,CAAC,OAAO,CA0EjB"}
|
package/dist/actor/server.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Express server implementation used for standby Actor mode.
|
|
3
|
-
*/
|
|
4
|
-
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
5
|
-
import express from 'express';
|
|
6
|
-
import log from '@apify/log';
|
|
7
|
-
import { HEADER_READINESS_PROBE, Routes } from './const.js';
|
|
8
|
-
import { getActorRunData } from './utils.js';
|
|
9
|
-
import { processParamsGetTools } from '../mcp/utils.js';
|
|
10
|
-
export function createExpressApp(host, mcpServer) {
|
|
11
|
-
const HELP_MESSAGE = `Connect to the server with GET request to ${host}/sse?token=YOUR-APIFY-TOKEN`
|
|
12
|
-
+ ` and then send POST requests to ${host}/message?token=YOUR-APIFY-TOKEN`;
|
|
13
|
-
const app = express();
|
|
14
|
-
let transport;
|
|
15
|
-
app.route(Routes.ROOT)
|
|
16
|
-
.get(async (req, res) => {
|
|
17
|
-
if (req.headers && req.get(HEADER_READINESS_PROBE) !== undefined) {
|
|
18
|
-
log.debug('Received readiness probe');
|
|
19
|
-
res.status(200).json({ message: 'Server is ready' }).end();
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
log.info(`Received GET message at: ${Routes.ROOT}`);
|
|
24
|
-
const tools = await processParamsGetTools(req.url, process.env.APIFY_TOKEN);
|
|
25
|
-
if (tools) {
|
|
26
|
-
mcpServer.updateTools(tools);
|
|
27
|
-
}
|
|
28
|
-
res.setHeader('Content-Type', 'text/event-stream');
|
|
29
|
-
res.setHeader('Cache-Control', 'no-cache');
|
|
30
|
-
res.setHeader('Connection', 'keep-alive');
|
|
31
|
-
res.status(200).json({ message: `Actor is using Model Context Protocol. ${HELP_MESSAGE}`, data: getActorRunData() }).end();
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
log.error(`Error in GET ${Routes.ROOT} ${error}`);
|
|
35
|
-
res.status(500).json({ message: 'Internal Server Error' }).end();
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
.head((_req, res) => {
|
|
39
|
-
res.status(200).end();
|
|
40
|
-
});
|
|
41
|
-
app.route(Routes.SSE)
|
|
42
|
-
.get(async (req, res) => {
|
|
43
|
-
try {
|
|
44
|
-
log.info(`Received GET message at: ${Routes.SSE}`);
|
|
45
|
-
const tools = await processParamsGetTools(req.url, process.env.APIFY_TOKEN);
|
|
46
|
-
if (tools) {
|
|
47
|
-
mcpServer.updateTools(tools);
|
|
48
|
-
}
|
|
49
|
-
transport = new SSEServerTransport(Routes.MESSAGE, res);
|
|
50
|
-
await mcpServer.connect(transport);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
log.error(`Error in GET ${Routes.SSE}: ${error}`);
|
|
54
|
-
res.status(500).json({ message: 'Internal Server Error' }).end();
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
app.route(Routes.MESSAGE)
|
|
58
|
-
.post(async (req, res) => {
|
|
59
|
-
try {
|
|
60
|
-
log.info(`Received POST message at: ${Routes.MESSAGE}`);
|
|
61
|
-
if (transport) {
|
|
62
|
-
await transport.handlePostMessage(req, res);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
res.status(400).json({
|
|
66
|
-
message: 'Server is not connected to the client. '
|
|
67
|
-
+ 'Connect to the server with GET request to /sse endpoint',
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
log.error(`Error in POST ${Routes.MESSAGE}: ${error}`);
|
|
73
|
-
res.status(500).json({ message: 'Internal Server Error' }).end();
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
// Catch-all for undefined routes
|
|
77
|
-
app.use((req, res) => {
|
|
78
|
-
res.status(404).json({ message: `There is nothing at route ${req.method} ${req.originalUrl}. ${HELP_MESSAGE}` }).end();
|
|
79
|
-
});
|
|
80
|
-
return app;
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=server.js.map
|
package/dist/actor/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/actor/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,UAAU,gBAAgB,CAC5B,IAAY,EACZ,SAA0B;IAE1B,MAAM,YAAY,GAAG,6CAA6C,IAAI,6BAA6B;UAC7F,mCAAmC,IAAI,iCAAiC,CAAC;IAE/E,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IAEtB,IAAI,SAA6B,CAAC;IAElC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;SACjB,GAAG,CAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QACvC,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,sBAAsB,CAAC,KAAK,SAAS,EAAE,CAAC;YAC/D,GAAG,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;YACtC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;YAC3D,OAAO;QACX,CAAC;QACD,IAAI,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,4BAA4B,MAAM,CAAC,IAAI,EAAE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AAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;QACrE,CAAC;IACL,CAAC,CAAC,CAAC;IAEP,iCAAiC;IACjC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;QACpC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,6BAA6B,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,WAAW,KAAK,YAAY,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;IAC3H,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACf,CAAC"}
|
package/dist/actor/types.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface ActorRunData {
|
|
2
|
-
id?: string;
|
|
3
|
-
actId?: string;
|
|
4
|
-
userId?: string;
|
|
5
|
-
startedAt?: string;
|
|
6
|
-
finishedAt: null;
|
|
7
|
-
status: 'RUNNING';
|
|
8
|
-
meta: {
|
|
9
|
-
origin?: string;
|
|
10
|
-
};
|
|
11
|
-
options: {
|
|
12
|
-
build?: string;
|
|
13
|
-
memoryMbytes?: string;
|
|
14
|
-
};
|
|
15
|
-
buildId?: string;
|
|
16
|
-
defaultKeyValueStoreId?: string;
|
|
17
|
-
defaultDatasetId?: string;
|
|
18
|
-
defaultRequestQueueId?: string;
|
|
19
|
-
buildNumber?: string;
|
|
20
|
-
containerUrl?: string;
|
|
21
|
-
standbyUrl?: string;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/actor/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,YAAY;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE;QACF,MAAM,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,OAAO,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
package/dist/actor/types.js
DELETED
package/dist/actor/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/actor/types.ts"],"names":[],"mappings":""}
|
package/dist/actor/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/actor/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,wBAAgB,eAAe,IAAI,YAAY,GAAG,IAAI,CAuBrD"}
|
package/dist/actor/utils.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Actor } from 'apify';
|
|
2
|
-
export function getActorRunData() {
|
|
3
|
-
return Actor.isAtHome() ? {
|
|
4
|
-
id: process.env.ACTOR_RUN_ID,
|
|
5
|
-
actId: process.env.ACTOR_ID,
|
|
6
|
-
userId: process.env.APIFY_USER_ID,
|
|
7
|
-
startedAt: process.env.ACTOR_STARTED_AT,
|
|
8
|
-
finishedAt: null,
|
|
9
|
-
status: 'RUNNING',
|
|
10
|
-
meta: {
|
|
11
|
-
origin: process.env.APIFY_META_ORIGIN,
|
|
12
|
-
},
|
|
13
|
-
options: {
|
|
14
|
-
build: process.env.ACTOR_BUILD_NUMBER,
|
|
15
|
-
memoryMbytes: process.env.ACTOR_MEMORY_MBYTES,
|
|
16
|
-
},
|
|
17
|
-
buildId: process.env.ACTOR_BUILD_ID,
|
|
18
|
-
defaultKeyValueStoreId: process.env.ACTOR_DEFAULT_KEY_VALUE_STORE_ID,
|
|
19
|
-
defaultDatasetId: process.env.ACTOR_DEFAULT_DATASET_ID,
|
|
20
|
-
defaultRequestQueueId: process.env.ACTOR_DEFAULT_REQUEST_QUEUE_ID,
|
|
21
|
-
buildNumber: process.env.ACTOR_BUILD_NUMBER,
|
|
22
|
-
containerUrl: process.env.ACTOR_WEB_SERVER_URL,
|
|
23
|
-
standbyUrl: process.env.ACTOR_STANDBY_URL,
|
|
24
|
-
} : null;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/actor/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/actor/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAI9B,MAAM,UAAU,eAAe;IAC3B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QACtB,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QAC5B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;QAC3B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;QACjC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;QACvC,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE;YACF,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;SACxC;QACD,OAAO,EAAE;YACL,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;YACrC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;SAChD;QACD,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;QACnC,sBAAsB,EAAE,OAAO,CAAC,GAAG,CAAC,gCAAgC;QACpE,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB;QACtD,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,8BAA8B;QACjE,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;QAC3C,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;QAC9C,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;KAC5C,CAAC,CAAC,CAAC,IAAI,CAAC;AACb,CAAC"}
|
package/dist/apify-client.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apify-client.d.ts","sourceRoot":"","sources":["../src/apify-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAiB3D,qBAAa,WAAY,SAAQ,YAAY;gBAC7B,OAAO,EAAE,kBAAkB;CAO1C"}
|
package/dist/apify-client.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ApifyClient as _ApifyClient } from 'apify-client';
|
|
2
|
-
import { USER_AGENT_ORIGIN } from './const.js';
|
|
3
|
-
/**
|
|
4
|
-
* Adds a User-Agent header to the request config.
|
|
5
|
-
* @param config
|
|
6
|
-
* @private
|
|
7
|
-
*/
|
|
8
|
-
function addUserAgent(config) {
|
|
9
|
-
const updatedConfig = { ...config };
|
|
10
|
-
updatedConfig.headers = updatedConfig.headers ?? {};
|
|
11
|
-
updatedConfig.headers['User-Agent'] = `${updatedConfig.headers['User-Agent'] ?? ''}; ${USER_AGENT_ORIGIN}`;
|
|
12
|
-
return updatedConfig;
|
|
13
|
-
}
|
|
14
|
-
export class ApifyClient extends _ApifyClient {
|
|
15
|
-
constructor(options) {
|
|
16
|
-
super({
|
|
17
|
-
...options,
|
|
18
|
-
baseUrl: process.env.APIFY_API_BASE_URL || undefined,
|
|
19
|
-
requestInterceptors: [addUserAgent],
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=apify-client.js.map
|
package/dist/apify-client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apify-client.js","sourceRoot":"","sources":["../src/apify-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAG3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AACH,SAAS,YAAY,CAAC,MAA0B;IAC5C,MAAM,aAAa,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IACpC,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC;IACpD,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,iBAAiB,EAAE,CAAC;IAC3G,OAAO,aAAa,CAAC;AACzB,CAAC;AAED,MAAM,OAAO,WAAY,SAAQ,YAAY;IACzC,YAAY,OAA2B;QACnC,KAAK,CAAC;YACF,GAAG,OAAO;YACV,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,SAAS;YACpD,mBAAmB,EAAE,CAAC,YAAY,CAAC;SACtC,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/dist/mcp/actors.d.ts
DELETED
package/dist/mcp/actors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../../src/mcp/actors.ts"],"names":[],"mappings":"AAGA,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG7F;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMjG"}
|
package/dist/mcp/actors.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { getActorStandbyURL } from "./utils.js";
|
|
2
|
-
export async function isActorMCPServer(actorID, _apifyToken) {
|
|
3
|
-
// TODO: implement the logic
|
|
4
|
-
return actorID.toLowerCase().includes('mcp-') || actorID.toLowerCase().includes('-mcp');
|
|
5
|
-
}
|
|
6
|
-
export async function getActorsMCPServerURL(actorID, _apifyToken) {
|
|
7
|
-
// TODO: get from API instead
|
|
8
|
-
const standbyBaseUrl = process.env.HOSTNAME === 'mcp-securitybyobscurity.apify.com' ?
|
|
9
|
-
'.mcp-securitybyobscurity.apify.actor' : '.apify.actor';
|
|
10
|
-
const standbyUrl = getActorStandbyURL(actorID, standbyBaseUrl);
|
|
11
|
-
return `${standbyUrl}/sse`;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=actors.js.map
|
package/dist/mcp/actors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actors.js","sourceRoot":"","sources":["../../src/mcp/actors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAe,EAAE,WAAmB;IACvE,4BAA4B;IAC5B,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC5F,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAe,EAAE,WAAmB;IAC5E,6BAA6B;IAC7B,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,mCAAmC,CAAC,CAAC;QACjF,sCAAsC,CAAC,CAAC,CAAC,cAAc,CAAC;IAC5D,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC/D,OAAO,GAAG,UAAU,MAAM,CAAC;AAC/B,CAAC"}
|
package/dist/mcp/client.d.ts
DELETED
package/dist/mcp/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAInE;;GAEG;AACH,wBAAsB,eAAe,CACjC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAC3B,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
package/dist/mcp/client.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
-
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
3
|
-
import { getMCPServerID } from "./utils.js";
|
|
4
|
-
/**
|
|
5
|
-
* Creates and connects a ModelContextProtocol client.
|
|
6
|
-
*/
|
|
7
|
-
export async function createMCPClient(url, token) {
|
|
8
|
-
const transport = new SSEClientTransport(new URL(url), {
|
|
9
|
-
requestInit: {
|
|
10
|
-
headers: {
|
|
11
|
-
authorization: `Bearer ${token}`,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
eventSourceInit: {
|
|
15
|
-
// The EventSource package augments EventSourceInit with a "fetch" parameter.
|
|
16
|
-
// You can use this to set additional headers on the outgoing request.
|
|
17
|
-
// Based on this example: https://github.com/modelcontextprotocol/typescript-sdk/issues/118
|
|
18
|
-
async fetch(input, init) {
|
|
19
|
-
const headers = new Headers(init?.headers || {});
|
|
20
|
-
headers.set('authorization', `Bearer ${token}`);
|
|
21
|
-
return fetch(input, { ...init, headers });
|
|
22
|
-
},
|
|
23
|
-
// We have to cast to "any" to use it, since it's non-standard
|
|
24
|
-
}, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
25
|
-
});
|
|
26
|
-
const client = new Client({
|
|
27
|
-
name: getMCPServerID(url),
|
|
28
|
-
version: "1.0.0",
|
|
29
|
-
});
|
|
30
|
-
await client.connect(transport);
|
|
31
|
-
return client;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=client.js.map
|
package/dist/mcp/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,GAAW,EAAE,KAAa;IAE1B,MAAM,SAAS,GAAG,IAAI,kBAAkB,CACpC,IAAI,GAAG,CAAC,GAAG,CAAC,EACZ;QACI,WAAW,EAAE;YACT,OAAO,EAAE;gBACL,aAAa,EAAE,UAAU,KAAK,EAAE;aACnC;SACJ;QACD,eAAe,EAAE;YACb,6EAA6E;YAC7E,sEAAsE;YACtE,2FAA2F;YAC3F,KAAK,CAAC,KAAK,CAAC,KAA6B,EAAE,IAAkB;gBACzD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;gBACjD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,KAAK,EAAE,CAAC,CAAC;gBAChD,OAAO,KAAK,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9C,CAAC;YACL,8DAA8D;SACtD,EAAE,yDAAyD;KACtE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACtB,IAAI,EAAE,cAAc,CAAC,GAAG,CAAC;QACzB,OAAO,EAAE,OAAO;KACnB,CAAC,CAAC;IAEH,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/dist/mcp/const.d.ts
DELETED
package/dist/mcp/const.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../src/mcp/const.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,gBAAgB,IAAI,CAAA"}
|
package/dist/mcp/const.js
DELETED
package/dist/mcp/const.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../src/mcp/const.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAA"}
|
package/dist/mcp/proxy.d.ts
DELETED
package/dist/mcp/proxy.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/mcp/proxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,QAAQ,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGnE,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EAEd,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,QAAQ,EAAE,CAAC,CA8BrB"}
|
package/dist/mcp/proxy.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import Ajv from "ajv";
|
|
2
|
-
import { getMCPServerID, getProxyMCPServerToolName } from "./utils.js";
|
|
3
|
-
export async function getMCPServerTools(actorID, client,
|
|
4
|
-
// Name of the MCP server
|
|
5
|
-
serverUrl) {
|
|
6
|
-
const res = await client.listTools();
|
|
7
|
-
const tools = res.tools;
|
|
8
|
-
const ajv = new Ajv({ coerceTypes: 'array', strict: false });
|
|
9
|
-
const compiledTools = [];
|
|
10
|
-
for (const tool of tools) {
|
|
11
|
-
const mcpTool = {
|
|
12
|
-
actorID,
|
|
13
|
-
serverId: getMCPServerID(serverUrl),
|
|
14
|
-
serverUrl,
|
|
15
|
-
originToolName: tool.name,
|
|
16
|
-
name: getProxyMCPServerToolName(serverUrl, tool.name),
|
|
17
|
-
description: tool.description || "",
|
|
18
|
-
inputSchema: tool.inputSchema,
|
|
19
|
-
ajvValidate: ajv.compile(tool.inputSchema)
|
|
20
|
-
};
|
|
21
|
-
const wrap = {
|
|
22
|
-
type: 'actor-mcp',
|
|
23
|
-
tool: mcpTool,
|
|
24
|
-
};
|
|
25
|
-
compiledTools.push(wrap);
|
|
26
|
-
}
|
|
27
|
-
return compiledTools;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=proxy.js.map
|
package/dist/mcp/proxy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/mcp/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,OAAe,EACf,MAAc;AACd,yBAAyB;AACzB,SAAiB;IAEjB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;IACrC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IAGxB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAE7D,MAAM,aAAa,GAAe,EAAE,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,OAAO,GAAiB;YAC1B,OAAO;YACP,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC;YACnC,SAAS;YACT,cAAc,EAAE,IAAI,CAAC,IAAI;YAEzB,IAAI,EAAE,yBAAyB,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC;YACrD,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;YACnC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;SAC7C,CAAA;QAED,MAAM,IAAI,GAAa;YACnB,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,OAAO;SAChB,CAAA;QAED,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,aAAa,CAAC;AACzB,CAAC"}
|