@apify/actors-mcp-server 0.11.7-beta.7 → 0.11.7-beta.9
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/index_internals.d.ts +7 -12
- package/dist/index_internals.d.ts.map +1 -1
- package/dist/index_internals.js +6 -11
- package/dist/index_internals.js.map +1 -1
- package/dist/mcp/actors.d.ts +0 -4
- package/dist/mcp/actors.d.ts.map +1 -1
- package/dist/mcp/actors.js +0 -13
- package/dist/mcp/actors.js.map +1 -1
- package/dist/mcp/server.d.ts +0 -19
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +9 -203
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool_dispatch.d.ts +49 -0
- package/dist/mcp/tool_dispatch.d.ts.map +1 -0
- package/dist/mcp/tool_dispatch.js +208 -0
- package/dist/mcp/tool_dispatch.js.map +1 -0
- package/dist/payments/const.d.ts +1 -0
- package/dist/payments/const.d.ts.map +1 -1
- package/dist/payments/const.js +1 -0
- package/dist/payments/const.js.map +1 -1
- package/dist/payments/skyfire.d.ts.map +1 -1
- package/dist/payments/skyfire.js +5 -6
- package/dist/payments/skyfire.js.map +1 -1
- package/dist/tools/actors/fetch_actor_details.d.ts +1 -7
- package/dist/tools/actors/fetch_actor_details.d.ts.map +1 -1
- package/dist/tools/actors/fetch_actor_details.js +14 -22
- package/dist/tools/actors/fetch_actor_details.js.map +1 -1
- package/dist/tools/actors/search_actors.d.ts +1 -6
- package/dist/tools/actors/search_actors.d.ts.map +1 -1
- package/dist/tools/actors/search_actors.js +14 -21
- package/dist/tools/actors/search_actors.js.map +1 -1
- package/dist/tools/runs/get_actor_run.d.ts +1 -6
- package/dist/tools/runs/get_actor_run.d.ts.map +1 -1
- package/dist/tools/runs/get_actor_run.js +17 -24
- package/dist/tools/runs/get_actor_run.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +0 -11
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/logging.d.ts.map +1 -1
- package/dist/utils/logging.js +1 -1
- package/dist/utils/logging.js.map +1 -1
- package/dist/web/dist/actor-run-widget.js +0 -3
- package/dist/web/dist/search-actors-widget.js +0 -3
- package/package.json +1 -1
- package/dist/web/dist/actor-detail-widget.js +0 -4551
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import { ApifyClient } from './apify_client.js';
|
|
2
|
-
import {
|
|
2
|
+
import { defaults, type HelperToolName } from './const.js';
|
|
3
3
|
import { processParamsGetTools } from './mcp/utils.js';
|
|
4
4
|
import { resolvePaymentProvider } from './payments/index.js';
|
|
5
5
|
import type { PaymentProvider } from './payments/types.js';
|
|
6
6
|
import { getServerCard } from './server_card.js';
|
|
7
7
|
import { actorNameToToolName } from './tools/actor_tool_naming.js';
|
|
8
8
|
import { addActor } from './tools/actors/add_actor.js';
|
|
9
|
-
import {
|
|
10
|
-
import type { ActorStore,
|
|
11
|
-
import {
|
|
12
|
-
import { redactSkyfirePayId } from './utils/logging.js';
|
|
9
|
+
import { getCategoryTools, getDefaultTools, getUnauthEnabledToolCategories, unauthEnabledTools } from './tools/index.js';
|
|
10
|
+
import type { ActorStore, ToolCategory } from './types.js';
|
|
11
|
+
import { parseQueryParamList } from './utils/generic.js';
|
|
13
12
|
import { getExpectedToolNamesByCategories } from './utils/tool_categories_helpers.js';
|
|
14
13
|
import { getToolPublicFieldOnly } from './utils/tools.js';
|
|
15
14
|
import { TTLLRUCache } from './utils/ttl_lru.js';
|
|
16
|
-
export {
|
|
15
|
+
export { ApifyClient, getExpectedToolNamesByCategories, getServerCard, TTLLRUCache, actorNameToToolName, defaults, getDefaultTools,
|
|
17
16
|
/**
|
|
18
|
-
* @deprecated
|
|
17
|
+
* @deprecated Backward-compat alias for the `addActor` tool entry. Kept for the apify-mcp-server-internal migration; remove once it no longer imports `addTool`.
|
|
19
18
|
*/
|
|
20
|
-
addActor as addTool, getCategoryTools,
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated Use the server's paymentProvider.redactForLogging instead. This will be removed in a future release.
|
|
23
|
-
*/
|
|
24
|
-
redactSkyfirePayId, };
|
|
19
|
+
addActor as addTool, getCategoryTools, type ActorStore, type ToolCategory, processParamsGetTools, getToolPublicFieldOnly, getUnauthEnabledToolCategories, unauthEnabledTools, parseQueryParamList, resolvePaymentProvider, type PaymentProvider, };
|
|
25
20
|
/** @deprecated Use HELPER_TOOLS / HelperToolName. Kept for backward compatibility with apify-mcp-server-internal. */
|
|
26
21
|
export declare const HelperTools: {
|
|
27
22
|
readonly ACTOR_ADD: "add-actor";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index_internals.d.ts","sourceRoot":"","sources":["../src/index_internals.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index_internals.d.ts","sourceRoot":"","sources":["../src/index_internals.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAgB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,8BAA8B,EAC9B,kBAAkB,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EACH,WAAW,EACX,gCAAgC,EAChC,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,eAAe;AACf;;GAEG;AACH,QAAQ,IAAI,OAAO,EACnB,gBAAgB,EAChB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,EAC9B,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,eAAe,GACvB,CAAC;AAEF,qHAAqH;AACrH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;CAAe,CAAC;AACxC,sCAAsC;AACtC,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC"}
|
package/dist/index_internals.js
CHANGED
|
@@ -2,27 +2,22 @@
|
|
|
2
2
|
This file provides essential internal functions for Apify MCP servers, serving as an internal library.
|
|
3
3
|
*/
|
|
4
4
|
import { ApifyClient } from './apify_client.js';
|
|
5
|
-
import {
|
|
5
|
+
import { defaults, HELPER_TOOLS } from './const.js';
|
|
6
6
|
import { processParamsGetTools } from './mcp/utils.js';
|
|
7
7
|
import { resolvePaymentProvider } from './payments/index.js';
|
|
8
8
|
import { getServerCard } from './server_card.js';
|
|
9
9
|
import { actorNameToToolName } from './tools/actor_tool_naming.js';
|
|
10
10
|
import { addActor } from './tools/actors/add_actor.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { redactSkyfirePayId } from './utils/logging.js';
|
|
11
|
+
import { getCategoryTools, getDefaultTools, getUnauthEnabledToolCategories, unauthEnabledTools, } from './tools/index.js';
|
|
12
|
+
import { parseQueryParamList } from './utils/generic.js';
|
|
14
13
|
import { getExpectedToolNamesByCategories } from './utils/tool_categories_helpers.js';
|
|
15
14
|
import { getToolPublicFieldOnly } from './utils/tools.js';
|
|
16
15
|
import { TTLLRUCache } from './utils/ttl_lru.js';
|
|
17
|
-
export {
|
|
16
|
+
export { ApifyClient, getExpectedToolNamesByCategories, getServerCard, TTLLRUCache, actorNameToToolName, defaults, getDefaultTools,
|
|
18
17
|
/**
|
|
19
|
-
* @deprecated
|
|
18
|
+
* @deprecated Backward-compat alias for the `addActor` tool entry. Kept for the apify-mcp-server-internal migration; remove once it no longer imports `addTool`.
|
|
20
19
|
*/
|
|
21
|
-
addActor as addTool, getCategoryTools,
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated Use the server's paymentProvider.redactForLogging instead. This will be removed in a future release.
|
|
24
|
-
*/
|
|
25
|
-
redactSkyfirePayId, };
|
|
20
|
+
addActor as addTool, getCategoryTools, processParamsGetTools, getToolPublicFieldOnly, getUnauthEnabledToolCategories, unauthEnabledTools, parseQueryParamList, resolvePaymentProvider, };
|
|
26
21
|
/** @deprecated Use HELPER_TOOLS / HelperToolName. Kept for backward compatibility with apify-mcp-server-internal. */
|
|
27
22
|
export const HelperTools = HELPER_TOOLS;
|
|
28
23
|
//# sourceMappingURL=index_internals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index_internals.js","sourceRoot":"","sources":["../src/index_internals.ts"],"names":[],"mappings":"AAAA;;EAEE;AAEF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index_internals.js","sourceRoot":"","sources":["../src/index_internals.ts"],"names":[],"mappings":"AAAA;;EAEE;AAEF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAuB,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACH,gBAAgB,EAChB,eAAe,EACf,8BAA8B,EAC9B,kBAAkB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EACH,WAAW,EACX,gCAAgC,EAChC,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,eAAe;AACf;;GAEG;AACH,QAAQ,IAAI,OAAO,EACnB,gBAAgB,EAGhB,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,EAC9B,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,GAEzB,CAAC;AAEF,qHAAqH;AACrH,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC"}
|
package/dist/mcp/actors.d.ts
CHANGED
|
@@ -16,8 +16,4 @@ export declare function getActorMCPServerPath(actorDefinition: ActorDefinition |
|
|
|
16
16
|
* the MCP client — and the caller's Apify token — to a third-party host.
|
|
17
17
|
*/
|
|
18
18
|
export declare function getActorMCPServerURL(realActorId: string, mcpServerPath: string): Promise<string>;
|
|
19
|
-
/**
|
|
20
|
-
* Gets Actor ID from the Actor object.
|
|
21
|
-
*/
|
|
22
|
-
export declare function getRealActorID(actorIdOrName: string, apifyToken: string): Promise<string>;
|
|
23
19
|
//# sourceMappingURL=actors.d.ts.map
|
package/dist/mcp/actors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../../src/mcp/actors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"actors.d.ts","sourceRoot":"","sources":["../../src/mcp/actors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAIzD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,eAAe,GAAG,qBAAqB,GAAG,MAAM,GAAG,IAAI,CAqB7G;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBtG"}
|
package/dist/mcp/actors.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ApifyClient } from '../apify_client.js';
|
|
2
1
|
import { parseCommaSeparatedList } from '../utils/generic.js';
|
|
3
2
|
import { MCP_STREAMABLE_ENDPOINT } from './const.js';
|
|
4
3
|
/**
|
|
@@ -52,16 +51,4 @@ export async function getActorMCPServerURL(realActorId, mcpServerPath) {
|
|
|
52
51
|
resolved.password = '';
|
|
53
52
|
return resolved.toString();
|
|
54
53
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Gets Actor ID from the Actor object.
|
|
57
|
-
*/
|
|
58
|
-
export async function getRealActorID(actorIdOrName, apifyToken) {
|
|
59
|
-
const apifyClient = new ApifyClient({ token: apifyToken });
|
|
60
|
-
const actor = apifyClient.actor(actorIdOrName);
|
|
61
|
-
const info = await actor.get();
|
|
62
|
-
if (!info) {
|
|
63
|
-
throw new Error(`Actor ${actorIdOrName} not found`);
|
|
64
|
-
}
|
|
65
|
-
return info.id;
|
|
66
|
-
}
|
|
67
54
|
//# sourceMappingURL=actors.js.map
|
package/dist/mcp/actors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actors.js","sourceRoot":"","sources":["../../src/mcp/actors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actors.js","sourceRoot":"","sources":["../../src/mcp/actors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,eAAwD;IAC1F,IAAI,kBAAkB,IAAI,eAAe,IAAI,OAAO,eAAe,CAAC,gBAAgB,KAAK,QAAQ,EAAE,CAAC;QAChG,MAAM,gBAAgB,GAAG,eAAe,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;QAEjE,MAAM,KAAK,GAAG,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;QACxD,gDAAgD;QAChD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,wEAAwE;QACxE,kCAAkC;QAClC,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,uBAAuB,CAAC,CAAC;QAC9E,IAAI,cAAc,EAAE,CAAC;YACjB,OAAO,cAAc,CAAC;QAC1B,CAAC;QACD,mCAAmC;QACnC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,WAAmB,EAAE,aAAqB;IACjF,6BAA6B;IAC7B,MAAM,cAAc,GAChB,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,mCAAmC;QACxD,CAAC,CAAC,iCAAiC;QACnC,CAAC,CAAC,aAAa,CAAC;IACxB,+EAA+E;IAC/E,gFAAgF;IAChF,qFAAqF;IACrF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,WAAW,WAAW,IAAI,cAAc,GAAG,CAAC,CAAC;IAErE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACjD,IAAI,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,SAAS,WAAW,uEAAuE,CAAC,CAAC;IACjH,CAAC;IACD,4GAA4G;IAC5G,QAAQ,CAAC,QAAQ,GAAG,EAAE,CAAC;IACvB,QAAQ,CAAC,QAAQ,GAAG,EAAE,CAAC;IACvB,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAC/B,CAAC"}
|
package/dist/mcp/server.d.ts
CHANGED
|
@@ -228,25 +228,6 @@ export declare class ActorsMcpServer {
|
|
|
228
228
|
* call site stays a plain hand-off — no path can forget to compute or strip them.
|
|
229
229
|
*/
|
|
230
230
|
private logToolCallAndTelemetry;
|
|
231
|
-
/**
|
|
232
|
-
* Runs a validated tool call through the single tool-type dispatch switch and returns the raw
|
|
233
|
-
* result plus derived telemetry. The exhaustive switch turns a future 4th TOOL_TYPE into a compile
|
|
234
|
-
* error (same `satisfies never` idiom as getToolFullName) instead of a silent runtime fall-through.
|
|
235
|
-
* Both the sync `CallToolRequestSchema` handler and `executeToolAndUpdateTask` call this after their
|
|
236
|
-
* own pre-dispatch validation and keep their own try/catch + buildToolCallErrorResult around it.
|
|
237
|
-
* INTERNAL and ACTOR execution errors propagate to the caller's catch; the ACTOR_MCP case keeps its
|
|
238
|
-
* own inner catch and returns a soft-fail result instead of throwing.
|
|
239
|
-
*
|
|
240
|
-
* `extractToolTelemetry` (via `applyToolTelemetry`) runs once here, in the INTERNAL and ACTOR
|
|
241
|
-
* cases, and strips `toolTelemetry` in place, so callers must not re-strip. ACTOR_MCP sets
|
|
242
|
-
* telemetry manually instead. The caller constructs `progressTracker`; dispatch consumes it and stops
|
|
243
|
-
* it in the branch `finally`. The abort source is `extra.signal`: the request signal for sync; the
|
|
244
|
-
* task caller passes a `taskExtra` whose `signal` is the cancel watcher's, so a client disconnect
|
|
245
|
-
* never cancels a task. `shouldForwardNotifications` gates only the ACTOR_MCP raw-notification
|
|
246
|
-
* forwarder (true for sync, false for task, whose originating request is already answered).
|
|
247
|
-
* `taskMode` is a passthrough to `tool.call` / `executeActorTool`, never a dispatch selector.
|
|
248
|
-
*/
|
|
249
|
-
private dispatchToolCall;
|
|
250
231
|
/**
|
|
251
232
|
* Executes a tool asynchronously for a long-running task and updates task status.
|
|
252
233
|
*
|
package/dist/mcp/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"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"}
|
package/dist/mcp/server.js
CHANGED
|
@@ -8,7 +8,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
8
8
|
import { getUiCapability, RESOURCE_MIME_TYPE } from '@modelcontextprotocol/ext-apps/server';
|
|
9
9
|
import { InMemoryTaskStore } from '@modelcontextprotocol/sdk/experimental/tasks/stores/in-memory.js';
|
|
10
10
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
11
|
-
import { CallToolRequestSchema,
|
|
11
|
+
import { CallToolRequestSchema, CancelTaskRequestSchema, ErrorCode, GetPromptRequestSchema, GetTaskPayloadRequestSchema, GetTaskRequestSchema, InitializeRequestSchema, ListPromptsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ListTasksRequestSchema, ListToolsRequestSchema, McpError, ReadResourceRequestSchema, RELATED_TASK_META_KEY, SetLevelRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
12
12
|
import dedent from 'dedent';
|
|
13
13
|
import log from '@apify/log';
|
|
14
14
|
import { parseBooleanOrNull } from '@apify/utilities';
|
|
@@ -22,26 +22,24 @@ import { getServerInfo } from '../server_card.js';
|
|
|
22
22
|
import { buildReportedProblemProperties, getTelemetryEnv, trackReportedProblem, trackToolCall } from '../telemetry.js';
|
|
23
23
|
import { decodeDotPropertyNames } from '../tools/actor_input_schema.js';
|
|
24
24
|
import { legacyToolNameToNew } from '../tools/actor_tool_naming.js';
|
|
25
|
-
import { actorExecutor } from '../tools/actors/actor_executor.js';
|
|
26
25
|
import { checkPaymentProviderStandbyConflict } from '../tools/actors/call_actor.js';
|
|
27
26
|
import { appendReportProblemNudge } from '../tools/dev/report_problem.js';
|
|
28
27
|
import { getActorsAsTools } from '../tools/index.js';
|
|
29
28
|
import { SERVER_MODE, TOOL_TYPE } from '../types.js';
|
|
30
|
-
import { remoteMcpFailureDetail } from '../utils/apify_errors.js';
|
|
31
29
|
import { isMcpClientFaultMessage, logHttpError, sanitizeMezmoMessage } from '../utils/logging.js';
|
|
32
|
-
import { computeToolResponseBytes,
|
|
30
|
+
import { computeToolResponseBytes, respondOk } from '../utils/mcp.js';
|
|
33
31
|
import { isReportProblemBlockedForClient } from '../utils/mcp_clients.js';
|
|
34
32
|
import { createProgressTracker } from '../utils/progress.js';
|
|
35
33
|
import { getServerInstructions } from '../utils/server-instructions/index.js';
|
|
36
34
|
import { parseServerMode, resolveServerMode } from '../utils/server_mode.js';
|
|
37
|
-
import {
|
|
35
|
+
import { deriveResourceIds, extractAjvErrorDetails } from '../utils/tool_status.js';
|
|
38
36
|
import { buildActorFields, extractActorId, extractActorName, getToolFullName, getToolPublicFieldOnly, } from '../utils/tools.js';
|
|
39
37
|
import { getActors, getToolsForServerMode, toolNamesToInput } from '../utils/tools_loader.js';
|
|
40
38
|
import { getUserInfoCached } from '../utils/userid_cache.js';
|
|
41
39
|
import { getPackageVersion } from '../utils/version.js';
|
|
42
|
-
import {
|
|
43
|
-
import { EXTERNAL_TOOL_CALL_TIMEOUT_MSEC, LOG_LEVEL_MAP } from './const.js';
|
|
40
|
+
import { LOG_LEVEL_MAP } from './const.js';
|
|
44
41
|
import { buildToolCallErrorResult, TOOL_CALL_ERROR_KIND } from './tool_call_error_mapper.js';
|
|
42
|
+
import { dispatchToolCall } from './tool_dispatch.js';
|
|
45
43
|
import { createTaskCancellationWatcher, isTaskCancelled, isTaskNotFoundError, parseInputParamsFromUrl, storeTaskResultOrSkipIfExpired, } from './utils.js';
|
|
46
44
|
/**
|
|
47
45
|
* Returns true when the initialize request advertises the MCP Apps UI extension
|
|
@@ -1099,12 +1097,13 @@ export class ActorsMcpServer {
|
|
|
1099
1097
|
const progressTracker = progressTrackerOptIn
|
|
1100
1098
|
? createProgressTracker(progressToken, extra.sendNotification)
|
|
1101
1099
|
: null;
|
|
1102
|
-
const dispatchResult = await
|
|
1100
|
+
const dispatchResult = await dispatchToolCall({
|
|
1103
1101
|
tool,
|
|
1104
1102
|
toolArgs: toolArgs,
|
|
1105
1103
|
logSafeArgs,
|
|
1106
1104
|
apifyToken,
|
|
1107
1105
|
apifyClient: apifyClient,
|
|
1106
|
+
apifyMcpServer: this,
|
|
1108
1107
|
mcpSessionId,
|
|
1109
1108
|
progressToken,
|
|
1110
1109
|
progressTracker,
|
|
@@ -1248,200 +1247,6 @@ export class ActorsMcpServer {
|
|
|
1248
1247
|
}
|
|
1249
1248
|
}
|
|
1250
1249
|
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Runs a validated tool call through the single tool-type dispatch switch and returns the raw
|
|
1253
|
-
* result plus derived telemetry. The exhaustive switch turns a future 4th TOOL_TYPE into a compile
|
|
1254
|
-
* error (same `satisfies never` idiom as getToolFullName) instead of a silent runtime fall-through.
|
|
1255
|
-
* Both the sync `CallToolRequestSchema` handler and `executeToolAndUpdateTask` call this after their
|
|
1256
|
-
* own pre-dispatch validation and keep their own try/catch + buildToolCallErrorResult around it.
|
|
1257
|
-
* INTERNAL and ACTOR execution errors propagate to the caller's catch; the ACTOR_MCP case keeps its
|
|
1258
|
-
* own inner catch and returns a soft-fail result instead of throwing.
|
|
1259
|
-
*
|
|
1260
|
-
* `extractToolTelemetry` (via `applyToolTelemetry`) runs once here, in the INTERNAL and ACTOR
|
|
1261
|
-
* cases, and strips `toolTelemetry` in place, so callers must not re-strip. ACTOR_MCP sets
|
|
1262
|
-
* telemetry manually instead. The caller constructs `progressTracker`; dispatch consumes it and stops
|
|
1263
|
-
* it in the branch `finally`. The abort source is `extra.signal`: the request signal for sync; the
|
|
1264
|
-
* task caller passes a `taskExtra` whose `signal` is the cancel watcher's, so a client disconnect
|
|
1265
|
-
* never cancels a task. `shouldForwardNotifications` gates only the ACTOR_MCP raw-notification
|
|
1266
|
-
* forwarder (true for sync, false for task, whose originating request is already answered).
|
|
1267
|
-
* `taskMode` is a passthrough to `tool.call` / `executeActorTool`, never a dispatch selector.
|
|
1268
|
-
*/
|
|
1269
|
-
async dispatchToolCall(params) {
|
|
1270
|
-
var _a, _b, _c, _d;
|
|
1271
|
-
const { tool, toolArgs, logSafeArgs, apifyToken, apifyClient, mcpSessionId, progressToken, progressTracker, shouldForwardNotifications, extra, actorName, actorId, taskMode, logContext, } = params;
|
|
1272
|
-
let result = {};
|
|
1273
|
-
let toolStatus = TOOL_STATUS.SUCCEEDED;
|
|
1274
|
-
// Always populate actor fields so they're tracked on both success and failure paths.
|
|
1275
|
-
let callDiagnostics = { ...buildActorFields(actorName, actorId) };
|
|
1276
|
-
switch (tool.type) {
|
|
1277
|
-
case TOOL_TYPE.INTERNAL: {
|
|
1278
|
-
try {
|
|
1279
|
-
log.info(`Calling internal tool${(_a = logContext === null || logContext === void 0 ? void 0 : logContext.messageSuffix) !== null && _a !== void 0 ? _a : ''}`, {
|
|
1280
|
-
...logContext === null || logContext === void 0 ? void 0 : logContext.fields,
|
|
1281
|
-
toolName: tool.name,
|
|
1282
|
-
mcpSessionId,
|
|
1283
|
-
input: logSafeArgs,
|
|
1284
|
-
});
|
|
1285
|
-
const res = (await tool.call({
|
|
1286
|
-
args: toolArgs,
|
|
1287
|
-
extra,
|
|
1288
|
-
apifyMcpServer: this,
|
|
1289
|
-
mcpServer: this.server,
|
|
1290
|
-
apifyToken,
|
|
1291
|
-
apifyClient,
|
|
1292
|
-
progressTracker,
|
|
1293
|
-
mcpSessionId,
|
|
1294
|
-
taskMode,
|
|
1295
|
-
}));
|
|
1296
|
-
// Extract diagnostics and strip internal fields from res before returning to client.
|
|
1297
|
-
({ toolStatus, callDiagnostics } = applyToolTelemetry(res, actorName, actorId, callDiagnostics));
|
|
1298
|
-
result = res;
|
|
1299
|
-
}
|
|
1300
|
-
finally {
|
|
1301
|
-
progressTracker === null || progressTracker === void 0 ? void 0 : progressTracker.stop();
|
|
1302
|
-
}
|
|
1303
|
-
break;
|
|
1304
|
-
}
|
|
1305
|
-
case TOOL_TYPE.ACTOR_MCP: {
|
|
1306
|
-
// This case never throws: connect/exec failures resolve to a soft-fail `result`
|
|
1307
|
-
// (isError body) below instead. As a task, that means the outer completeTask
|
|
1308
|
-
// stores it via the 'completed' path (isError body) — deliberately matching sync's
|
|
1309
|
-
// own soft-fail semantics, unlike ACTOR/INTERNAL, whose thrown errors land in the
|
|
1310
|
-
// task caller's 'failed' path.
|
|
1311
|
-
let client = null;
|
|
1312
|
-
try {
|
|
1313
|
-
client = await connectMCPClient(tool.serverUrl, apifyToken, mcpSessionId);
|
|
1314
|
-
if (!client) {
|
|
1315
|
-
const msg = dedent `
|
|
1316
|
-
Failed to connect to MCP server at "${tool.serverUrl}".
|
|
1317
|
-
Please verify the server URL is correct and accessible, and ensure you have a valid Apify token with appropriate permissions.
|
|
1318
|
-
`;
|
|
1319
|
-
log.softFail(msg, { mcpSessionId, failureCategory: FAILURE_CATEGORY.INTERNAL_ERROR });
|
|
1320
|
-
await this.server.sendLoggingMessage({ level: 'error', data: msg });
|
|
1321
|
-
toolStatus = TOOL_STATUS.SOFT_FAIL;
|
|
1322
|
-
callDiagnostics = { ...callDiagnostics, failure_category: FAILURE_CATEGORY.INTERNAL_ERROR };
|
|
1323
|
-
result = respondErrorNoTelemetry(msg);
|
|
1324
|
-
break;
|
|
1325
|
-
}
|
|
1326
|
-
// Only set up notification handlers if progressToken is provided by the client.
|
|
1327
|
-
// Gated off for tasks (shouldForwardNotifications=false): the originating request is
|
|
1328
|
-
// already answered, so forwarding against its progressToken would misroute.
|
|
1329
|
-
if (shouldForwardNotifications && progressToken !== undefined && progressToken !== null) {
|
|
1330
|
-
// Set up notification handlers for the client
|
|
1331
|
-
for (const schema of ServerNotificationSchema.options) {
|
|
1332
|
-
const method = schema.shape.method.value;
|
|
1333
|
-
// Forward notifications from the proxy client to the server
|
|
1334
|
-
client.setNotificationHandler(schema, async (notification) => {
|
|
1335
|
-
log.debug('Sending MCP notification', {
|
|
1336
|
-
method,
|
|
1337
|
-
mcpSessionId,
|
|
1338
|
-
notification,
|
|
1339
|
-
});
|
|
1340
|
-
await extra.sendNotification(notification);
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
log.info(`Calling Actor-MCP${(_b = logContext === null || logContext === void 0 ? void 0 : logContext.messageSuffix) !== null && _b !== void 0 ? _b : ''}`, {
|
|
1345
|
-
...logContext === null || logContext === void 0 ? void 0 : logContext.fields,
|
|
1346
|
-
toolName: tool.name,
|
|
1347
|
-
actorMcpToolName: tool.originToolName,
|
|
1348
|
-
actorId: tool.actorId,
|
|
1349
|
-
mcpSessionId,
|
|
1350
|
-
input: logSafeArgs,
|
|
1351
|
-
});
|
|
1352
|
-
const res = await client.callTool({
|
|
1353
|
-
name: tool.originToolName,
|
|
1354
|
-
arguments: toolArgs,
|
|
1355
|
-
// Without forwarding there is no route back for remote progress — don't
|
|
1356
|
-
// hand the remote a token nobody listens to.
|
|
1357
|
-
...(shouldForwardNotifications ? { _meta: { progressToken } } : {}),
|
|
1358
|
-
}, CallToolResultSchema, {
|
|
1359
|
-
timeout: EXTERNAL_TOOL_CALL_TIMEOUT_MSEC,
|
|
1360
|
-
});
|
|
1361
|
-
// TODO: actor-mcp responses are opaque — isError could be a user input problem
|
|
1362
|
-
// (e.g. invalid query) or a genuine server failure. We can't distinguish without
|
|
1363
|
-
// parsing the error text. Defaulting to INTERNAL_ERROR for now; revisit when
|
|
1364
|
-
// actor-mcp gets deeper telemetry treatment.
|
|
1365
|
-
if ('isError' in res && res.isError) {
|
|
1366
|
-
toolStatus = TOOL_STATUS.SOFT_FAIL;
|
|
1367
|
-
callDiagnostics = {
|
|
1368
|
-
failure_category: FAILURE_CATEGORY.INTERNAL_ERROR,
|
|
1369
|
-
...buildActorFields(actorName, actorId),
|
|
1370
|
-
};
|
|
1371
|
-
}
|
|
1372
|
-
result = { ...res };
|
|
1373
|
-
}
|
|
1374
|
-
catch (error) {
|
|
1375
|
-
toolStatus = getToolStatusFromError(error, Boolean((_c = extra.signal) === null || _c === void 0 ? void 0 : _c.aborted));
|
|
1376
|
-
const failureDetail = error instanceof Error ? error.message.slice(0, 200) : String(error).slice(0, 200);
|
|
1377
|
-
callDiagnostics = {
|
|
1378
|
-
failure_category: classifyFailureCategory(error),
|
|
1379
|
-
failure_detail: failureDetail,
|
|
1380
|
-
...buildActorFields(actorName, actorId),
|
|
1381
|
-
};
|
|
1382
|
-
logHttpError(error, `Failed to call MCP tool '${tool.originToolName}' on Actor '${tool.actorId}'`, {
|
|
1383
|
-
actorId: tool.actorId,
|
|
1384
|
-
toolName: tool.originToolName,
|
|
1385
|
-
failureCategory: callDiagnostics.failure_category,
|
|
1386
|
-
});
|
|
1387
|
-
result = respondErrorNoTelemetry(`Failed to call MCP tool '${tool.originToolName}' on Actor '${tool.actorId}': ${remoteMcpFailureDetail(error)}`);
|
|
1388
|
-
}
|
|
1389
|
-
finally {
|
|
1390
|
-
if (client)
|
|
1391
|
-
await client.close();
|
|
1392
|
-
}
|
|
1393
|
-
break;
|
|
1394
|
-
}
|
|
1395
|
-
case TOOL_TYPE.ACTOR: {
|
|
1396
|
-
try {
|
|
1397
|
-
log.info(`Calling Actor${(_d = logContext === null || logContext === void 0 ? void 0 : logContext.messageSuffix) !== null && _d !== void 0 ? _d : ''}`, {
|
|
1398
|
-
...logContext === null || logContext === void 0 ? void 0 : logContext.fields,
|
|
1399
|
-
toolName: tool.name,
|
|
1400
|
-
actorName: tool.actorFullName,
|
|
1401
|
-
mcpSessionId,
|
|
1402
|
-
input: logSafeArgs,
|
|
1403
|
-
});
|
|
1404
|
-
const executorResult = await actorExecutor.executeActorTool({
|
|
1405
|
-
actorFullName: tool.actorFullName,
|
|
1406
|
-
input: toolArgs,
|
|
1407
|
-
apifyClient,
|
|
1408
|
-
callOptions: { memory: tool.memoryMbytes },
|
|
1409
|
-
progressTracker,
|
|
1410
|
-
abortSignal: extra.signal,
|
|
1411
|
-
mcpSessionId,
|
|
1412
|
-
datasetItemsSchema: tool.datasetItemsSchema,
|
|
1413
|
-
taskMode,
|
|
1414
|
-
});
|
|
1415
|
-
if (!executorResult) {
|
|
1416
|
-
toolStatus = TOOL_STATUS.ABORTED;
|
|
1417
|
-
// Receivers of cancellation notifications SHOULD NOT send a response for the cancelled request
|
|
1418
|
-
// https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/cancellation#behavior-requirements
|
|
1419
|
-
result = {};
|
|
1420
|
-
break;
|
|
1421
|
-
}
|
|
1422
|
-
// Mirror the INTERNAL branch: read the telemetry the executor embedded on error
|
|
1423
|
-
// results (e.g. respondUserError → SOFT_FAIL/INVALID_INPUT), strip it from the wire,
|
|
1424
|
-
// and set failure_category so the report-problem nudge picks the softer variant.
|
|
1425
|
-
({ toolStatus, callDiagnostics } = applyToolTelemetry(executorResult, actorName, actorId, callDiagnostics));
|
|
1426
|
-
result = executorResult;
|
|
1427
|
-
}
|
|
1428
|
-
finally {
|
|
1429
|
-
if (progressTracker) {
|
|
1430
|
-
progressTracker.stop();
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
break;
|
|
1434
|
-
}
|
|
1435
|
-
default:
|
|
1436
|
-
// Exhaustiveness guard mirroring getToolFullName: a new TOOL_TYPE member makes `tool`
|
|
1437
|
-
// non-`never` here and fails `satisfies never` at compile time. Unreachable at runtime —
|
|
1438
|
-
// ToolEntry is a closed 3-way union. Unlike the pre-extraction fall-through (which also
|
|
1439
|
-
// listed available tools, called log.softFail, and sent a logging message before
|
|
1440
|
-
// throwing), this just throws InvalidParams with no side effects.
|
|
1441
|
-
throw new McpError(ErrorCode.InvalidParams, `Unknown tool type "${tool.type}"`);
|
|
1442
|
-
}
|
|
1443
|
-
return { result, toolStatus, callDiagnostics };
|
|
1444
|
-
}
|
|
1445
1250
|
// TODO: outer orchestration here (pre-flight, telemetry bookkeeping, task-store handling) still duplicates the CallToolRequestSchema handler's logic; the dispatch ladder is now shared. Refactor.
|
|
1446
1251
|
/**
|
|
1447
1252
|
* Executes a tool asynchronously for a long-running task and updates task status.
|
|
@@ -1548,12 +1353,13 @@ export class ActorsMcpServer {
|
|
|
1548
1353
|
const progressTracker = tool.type === TOOL_TYPE.ACTOR_MCP
|
|
1549
1354
|
? null
|
|
1550
1355
|
: createProgressTracker(progressToken, extra.sendNotification, taskId, onStatusMessage);
|
|
1551
|
-
const dispatchResult = await
|
|
1356
|
+
const dispatchResult = await dispatchToolCall({
|
|
1552
1357
|
tool,
|
|
1553
1358
|
toolArgs,
|
|
1554
1359
|
logSafeArgs,
|
|
1555
1360
|
apifyToken,
|
|
1556
1361
|
apifyClient,
|
|
1362
|
+
apifyMcpServer: this,
|
|
1557
1363
|
mcpSessionId,
|
|
1558
1364
|
progressToken,
|
|
1559
1365
|
progressTracker,
|