@apify/actors-mcp-server 0.8.3 → 0.8.6

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.
Files changed (207) hide show
  1. package/README.md +54 -11
  2. package/dist/actor/const.js +4 -1
  3. package/dist/actor/const.js.map +1 -1
  4. package/dist/actor/server.js +9 -6
  5. package/dist/actor/server.js.map +1 -1
  6. package/dist/actor/types.js +4 -1
  7. package/dist/actor/types.js.map +1 -1
  8. package/dist/actor/utils.js +4 -1
  9. package/dist/actor/utils.js.map +1 -1
  10. package/dist/apify-client.js +4 -1
  11. package/dist/apify-client.js.map +1 -1
  12. package/dist/const.d.ts +3 -0
  13. package/dist/const.d.ts.map +1 -1
  14. package/dist/const.js +7 -1
  15. package/dist/const.js.map +1 -1
  16. package/dist/errors.js +4 -1
  17. package/dist/errors.js.map +1 -1
  18. package/dist/index-internals.d.ts +6 -4
  19. package/dist/index-internals.d.ts.map +1 -1
  20. package/dist/index-internals.js +9 -4
  21. package/dist/index-internals.js.map +1 -1
  22. package/dist/index.js +4 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/input.js +4 -1
  25. package/dist/input.js.map +1 -1
  26. package/dist/instrument.d.ts +2 -0
  27. package/dist/instrument.d.ts.map +1 -0
  28. package/dist/instrument.js +38 -0
  29. package/dist/instrument.js.map +1 -0
  30. package/dist/main.js +5 -2
  31. package/dist/main.js.map +1 -1
  32. package/dist/mcp/actors.js +4 -1
  33. package/dist/mcp/actors.js.map +1 -1
  34. package/dist/mcp/client.d.ts +1 -1
  35. package/dist/mcp/client.d.ts.map +1 -1
  36. package/dist/mcp/client.js +9 -5
  37. package/dist/mcp/client.js.map +1 -1
  38. package/dist/mcp/const.js +4 -1
  39. package/dist/mcp/const.js.map +1 -1
  40. package/dist/mcp/proxy.js +4 -1
  41. package/dist/mcp/proxy.js.map +1 -1
  42. package/dist/mcp/server.d.ts +2 -1
  43. package/dist/mcp/server.d.ts.map +1 -1
  44. package/dist/mcp/server.js +76 -28
  45. package/dist/mcp/server.js.map +1 -1
  46. package/dist/mcp/utils.d.ts +2 -2
  47. package/dist/mcp/utils.d.ts.map +1 -1
  48. package/dist/mcp/utils.js +6 -3
  49. package/dist/mcp/utils.js.map +1 -1
  50. package/dist/prompts/index.js +4 -1
  51. package/dist/prompts/index.js.map +1 -1
  52. package/dist/prompts/latest-news-on-topic.js +4 -1
  53. package/dist/prompts/latest-news-on-topic.js.map +1 -1
  54. package/dist/resources/resource_service.js +4 -1
  55. package/dist/resources/resource_service.js.map +1 -1
  56. package/dist/resources/widgets.js +4 -1
  57. package/dist/resources/widgets.js.map +1 -1
  58. package/dist/server_card.d.ts +4 -0
  59. package/dist/server_card.d.ts.map +1 -0
  60. package/dist/server_card.js +36 -0
  61. package/dist/server_card.js.map +1 -0
  62. package/dist/state.js +4 -1
  63. package/dist/state.js.map +1 -1
  64. package/dist/stdio.d.ts +1 -14
  65. package/dist/stdio.d.ts.map +1 -1
  66. package/dist/stdio.js +20 -3
  67. package/dist/stdio.js.map +1 -1
  68. package/dist/telemetry.js +4 -1
  69. package/dist/telemetry.js.map +1 -1
  70. package/dist/tools/actor.d.ts +21 -7
  71. package/dist/tools/actor.d.ts.map +1 -1
  72. package/dist/tools/actor.js +89 -28
  73. package/dist/tools/actor.js.map +1 -1
  74. package/dist/tools/build.d.ts.map +1 -1
  75. package/dist/tools/build.js +6 -1
  76. package/dist/tools/build.js.map +1 -1
  77. package/dist/tools/categories.d.ts +6 -0
  78. package/dist/tools/categories.d.ts.map +1 -1
  79. package/dist/tools/categories.js +6 -3
  80. package/dist/tools/categories.js.map +1 -1
  81. package/dist/tools/dataset.js +4 -1
  82. package/dist/tools/dataset.js.map +1 -1
  83. package/dist/tools/dataset_collection.js +4 -1
  84. package/dist/tools/dataset_collection.js.map +1 -1
  85. package/dist/tools/fetch-actor-details-internal.d.ts.map +1 -1
  86. package/dist/tools/fetch-actor-details-internal.js +12 -3
  87. package/dist/tools/fetch-actor-details-internal.js.map +1 -1
  88. package/dist/tools/fetch-actor-details.d.ts.map +1 -1
  89. package/dist/tools/fetch-actor-details.js +13 -8
  90. package/dist/tools/fetch-actor-details.js.map +1 -1
  91. package/dist/tools/fetch-apify-docs.js +4 -1
  92. package/dist/tools/fetch-apify-docs.js.map +1 -1
  93. package/dist/tools/get-actor-output.js +4 -1
  94. package/dist/tools/get-actor-output.js.map +1 -1
  95. package/dist/tools/get-html-skeleton.js +4 -1
  96. package/dist/tools/get-html-skeleton.js.map +1 -1
  97. package/dist/tools/helpers.js +4 -1
  98. package/dist/tools/helpers.js.map +1 -1
  99. package/dist/tools/index.js +4 -1
  100. package/dist/tools/index.js.map +1 -1
  101. package/dist/tools/key_value_store.js +4 -1
  102. package/dist/tools/key_value_store.js.map +1 -1
  103. package/dist/tools/key_value_store_collection.js +4 -1
  104. package/dist/tools/key_value_store_collection.js.map +1 -1
  105. package/dist/tools/run.d.ts.map +1 -1
  106. package/dist/tools/run.js +15 -6
  107. package/dist/tools/run.js.map +1 -1
  108. package/dist/tools/run_collection.js +4 -1
  109. package/dist/tools/run_collection.js.map +1 -1
  110. package/dist/tools/search-actors-internal.js +4 -1
  111. package/dist/tools/search-actors-internal.js.map +1 -1
  112. package/dist/tools/search-apify-docs.js +4 -1
  113. package/dist/tools/search-apify-docs.js.map +1 -1
  114. package/dist/tools/store_collection.d.ts +1 -2
  115. package/dist/tools/store_collection.d.ts.map +1 -1
  116. package/dist/tools/store_collection.js +16 -21
  117. package/dist/tools/store_collection.js.map +1 -1
  118. package/dist/tools/structured-output-schemas.d.ts +47 -6
  119. package/dist/tools/structured-output-schemas.d.ts.map +1 -1
  120. package/dist/tools/structured-output-schemas.js +41 -3
  121. package/dist/tools/structured-output-schemas.js.map +1 -1
  122. package/dist/tools/utils.js +4 -1
  123. package/dist/tools/utils.js.map +1 -1
  124. package/dist/tsconfig.tsbuildinfo +1 -1
  125. package/dist/types.d.ts +133 -28
  126. package/dist/types.d.ts.map +1 -1
  127. package/dist/types.js +4 -1
  128. package/dist/types.js.map +1 -1
  129. package/dist/utils/actor-card.d.ts +25 -21
  130. package/dist/utils/actor-card.d.ts.map +1 -1
  131. package/dist/utils/actor-card.js +44 -33
  132. package/dist/utils/actor-card.js.map +1 -1
  133. package/dist/utils/actor-details.d.ts +17 -4
  134. package/dist/utils/actor-details.d.ts.map +1 -1
  135. package/dist/utils/actor-details.js +45 -17
  136. package/dist/utils/actor-details.js.map +1 -1
  137. package/dist/utils/actor-response.js +4 -1
  138. package/dist/utils/actor-response.js.map +1 -1
  139. package/dist/utils/actor-search.d.ts +3 -2
  140. package/dist/utils/actor-search.d.ts.map +1 -1
  141. package/dist/utils/actor-search.js +14 -2
  142. package/dist/utils/actor-search.js.map +1 -1
  143. package/dist/utils/actor.js +4 -1
  144. package/dist/utils/actor.js.map +1 -1
  145. package/dist/utils/ajv.js +4 -1
  146. package/dist/utils/ajv.js.map +1 -1
  147. package/dist/utils/apify-docs.js +4 -1
  148. package/dist/utils/apify-docs.js.map +1 -1
  149. package/dist/utils/apify-properties.js +4 -1
  150. package/dist/utils/apify-properties.js.map +1 -1
  151. package/dist/utils/auth.d.ts +9 -0
  152. package/dist/utils/auth.d.ts.map +1 -0
  153. package/dist/utils/auth.js +39 -0
  154. package/dist/utils/auth.js.map +1 -0
  155. package/dist/utils/generic.d.ts +11 -0
  156. package/dist/utils/generic.d.ts.map +1 -1
  157. package/dist/utils/generic.js +21 -1
  158. package/dist/utils/generic.js.map +1 -1
  159. package/dist/utils/html-to-md.js +4 -1
  160. package/dist/utils/html-to-md.js.map +1 -1
  161. package/dist/utils/html.js +4 -1
  162. package/dist/utils/html.js.map +1 -1
  163. package/dist/utils/logging.d.ts +8 -0
  164. package/dist/utils/logging.d.ts.map +1 -1
  165. package/dist/utils/logging.js +25 -1
  166. package/dist/utils/logging.js.map +1 -1
  167. package/dist/utils/mcp-clients.js +4 -1
  168. package/dist/utils/mcp-clients.js.map +1 -1
  169. package/dist/utils/mcp.d.ts +12 -0
  170. package/dist/utils/mcp.d.ts.map +1 -1
  171. package/dist/utils/mcp.js +21 -1
  172. package/dist/utils/mcp.js.map +1 -1
  173. package/dist/utils/pricing-info.d.ts +4 -5
  174. package/dist/utils/pricing-info.d.ts.map +1 -1
  175. package/dist/utils/pricing-info.js +20 -12
  176. package/dist/utils/pricing-info.js.map +1 -1
  177. package/dist/utils/progress.js +4 -1
  178. package/dist/utils/progress.js.map +1 -1
  179. package/dist/utils/schema-generation.js +4 -1
  180. package/dist/utils/schema-generation.js.map +1 -1
  181. package/dist/utils/server-instructions.js +4 -1
  182. package/dist/utils/server-instructions.js.map +1 -1
  183. package/dist/utils/skyfire.js +4 -1
  184. package/dist/utils/skyfire.js.map +1 -1
  185. package/dist/utils/tool-categories-helpers.js +4 -1
  186. package/dist/utils/tool-categories-helpers.js.map +1 -1
  187. package/dist/utils/tool-status.js +4 -1
  188. package/dist/utils/tool-status.js.map +1 -1
  189. package/dist/utils/tools-loader.d.ts +2 -2
  190. package/dist/utils/tools-loader.d.ts.map +1 -1
  191. package/dist/utils/tools-loader.js +24 -13
  192. package/dist/utils/tools-loader.js.map +1 -1
  193. package/dist/utils/tools.js +4 -1
  194. package/dist/utils/tools.js.map +1 -1
  195. package/dist/utils/ttl-lru.js +4 -1
  196. package/dist/utils/ttl-lru.js.map +1 -1
  197. package/dist/utils/userid-cache.js +4 -1
  198. package/dist/utils/userid-cache.js.map +1 -1
  199. package/dist/utils/version.d.ts.map +1 -1
  200. package/dist/utils/version.js +6 -4
  201. package/dist/utils/version.js.map +1 -1
  202. package/dist/web/dist/actor-detail-widget.js +4330 -0
  203. package/dist/web/dist/actor-run-widget.js +3431 -3149
  204. package/dist/web/dist/search-actors-widget.js +1454 -929
  205. package/manifest.json +1 -1
  206. package/package.json +6 -3
  207. package/server.json +1 -1
package/dist/main.js CHANGED
@@ -2,6 +2,8 @@
2
2
  * Serves as an Actor MCP SSE server entry point.
3
3
  * This file needs to be named `main.ts` to be recognized by the Apify platform.
4
4
  */
5
+
6
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9985651f-f1cb-5f8a-8b1c-87e0af1d2b27")}catch(e){}}();
5
7
  var _a;
6
8
  import { Actor } from 'apify';
7
9
  import log from '@apify/log';
@@ -35,7 +37,7 @@ else {
35
37
  }
36
38
  const options = { memory: input.maxActorMemoryBytes };
37
39
  const apifyClient = new ApifyClient({ token: process.env.APIFY_TOKEN });
38
- const callResult = await callActorGetDataset(input.debugActor, input.debugActorInput, apifyClient, options);
40
+ const callResult = await callActorGetDataset({ actorName: input.debugActor, input: input.debugActorInput, apifyClient, callOptions: options });
39
41
  if (callResult && callResult.previewItems.length > 0) {
40
42
  await Actor.pushData(callResult.previewItems);
41
43
  log.info('Pushed items to dataset', { itemCount: callResult.previewItems.length });
@@ -47,4 +49,5 @@ process.on('SIGINT', async () => {
47
49
  log.info('Received SIGINT, shutting down gracefully...');
48
50
  await Actor.exit();
49
51
  });
50
- //# sourceMappingURL=main.js.map
52
+ //# sourceMappingURL=main.js.map
53
+ //# debugId=9985651f-f1cb-5f8a-8b1c-87e0af1d2b27
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAG9B,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,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of global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a493f85b-e828-5a85-8c6c-c866a1bbbf7b")}catch(e){}}();
1
3
  import { ApifyClient } from '../apify-client.js';
2
4
  import { MCP_STREAMABLE_ENDPOINT } from '../const.js';
3
5
  import { parseCommaSeparatedList } from '../utils/generic.js';
@@ -53,4 +55,5 @@ export async function getRealActorID(actorIdOrName, apifyToken) {
53
55
  export async function getActorStandbyURL(realActorId, standbyBaseUrl = 'apify.actor') {
54
56
  return `https://${realActorId}.${standbyBaseUrl}`;
55
57
  }
56
- //# sourceMappingURL=actors.js.map
58
+ //# sourceMappingURL=actors.js.map
59
+ //# debugId=a493f85b-e828-5a85-8c6c-c866a1bbbf7b
@@ -1 +1 @@
1
- {"version":3,"file":"actors.js","sourceRoot":"","sources":["../../src/mcp/actors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;;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,C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CAAC;AAED;;EAEE;AACF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,aAAqB,EAAE,UAAkB;IAC1E,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;IAE3D,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC;IAC/B,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,SAAS,aAAa,YAAY,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,IAAI,CAAC,EAAE,CAAC;AACnB,CAAC;AAED;;EAEE;AACF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,WAAmB,EAAE,cAAc,GAAG,aAAa;IACxF,OAAO,WAAW,WAAW,IAAI,cAAc,EAAE,CAAC;AACtD,CAAC","debugId":"a493f85b-e828-5a85-8c6c-c866a1bbbf7b"}
@@ -3,5 +3,5 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
3
3
  * Creates and connects a ModelContextProtocol client.
4
4
  * First tries streamable HTTP transport, then falls back to SSE transport.
5
5
  */
6
- export declare function connectMCPClient(url: string, token: string): Promise<Client | null>;
6
+ export declare function connectMCPClient(url: string, token: string, mcpSessionId?: string): Promise<Client | null>;
7
7
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAWnE;;;GAGG;AACH,wBAAsB,gBAAgB,CAClC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BxB"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAWnE;;;GAGG;AACH,wBAAsB,gBAAgB,CAClC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAClD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BxB"}
@@ -1,3 +1,5 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1c491ad2-8a77-5073-be64-28c9b7b8691e")}catch(e){}}();
1
3
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
4
  import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
3
5
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
@@ -10,7 +12,7 @@ import { getMCPServerID } from './utils.js';
10
12
  * Creates and connects a ModelContextProtocol client.
11
13
  * First tries streamable HTTP transport, then falls back to SSE transport.
12
14
  */
13
- export async function connectMCPClient(url, token) {
15
+ export async function connectMCPClient(url, token, mcpSessionId) {
14
16
  let client;
15
17
  try {
16
18
  client = await createMCPStreamableClient(url, token);
@@ -19,12 +21,13 @@ export async function connectMCPClient(url, token) {
19
21
  catch (error) {
20
22
  // If streamable HTTP transport fails on not timeout error, continue with SSE transport
21
23
  if (error instanceof TimeoutError) {
22
- log.warning('Connection to MCP server using streamable HTTP transport timed out', { url });
24
+ log.warning('Connection to MCP server using streamable HTTP transport timed out', { url, mcpSessionId });
23
25
  return null;
24
26
  }
25
27
  // If streamable HTTP transport fails, fall back to SSE transport
26
28
  log.debug('Streamable HTTP transport failed, falling back to SSE transport', {
27
29
  url,
30
+ mcpSessionId,
28
31
  });
29
32
  }
30
33
  try {
@@ -33,10 +36,10 @@ export async function connectMCPClient(url, token) {
33
36
  }
34
37
  catch (error) {
35
38
  if (error instanceof TimeoutError) {
36
- log.warning('Connection to MCP server using SSE transport timed out', { url });
39
+ log.warning('Connection to MCP server using SSE transport timed out', { url, mcpSessionId });
37
40
  return null;
38
41
  }
39
- logHttpError(error, 'Failed to connect to MCP server using SSE transport', { url, cause: error });
42
+ logHttpError(error, 'Failed to connect to MCP server using SSE transport', { url, mcpSessionId, cause: error });
40
43
  throw error;
41
44
  }
42
45
  }
@@ -101,4 +104,5 @@ async function createMCPStreamableClient(url, token) {
101
104
  await withTimeout(ACTORIZED_MCP_CONNECTION_TIMEOUT_MSEC, client.connect(transport));
102
105
  return client;
103
106
  }
104
- //# sourceMappingURL=client.js.map
107
+ //# sourceMappingURL=client.js.map
108
+ //# debugId=1c491ad2-8a77-5073-be64-28c9b7b8691e
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,GAAW,EAAE,KAAa;IAE1B,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACD,MAAM,GAAG,MAAM,yBAAyB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;Q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/const.js CHANGED
@@ -1,3 +1,5 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7c5ef840-6cd3-5004-867f-cf4f3046bc28")}catch(e){}}();
1
3
  export const MAX_TOOL_NAME_LENGTH = 64;
2
4
  export const SERVER_ID_LENGTH = 8;
3
5
  export const EXTERNAL_TOOL_CALL_TIMEOUT_MSEC = 120000; // 2 minutes
@@ -12,4 +14,5 @@ export const LOG_LEVEL_MAP = {
12
14
  alert: 6,
13
15
  emergency: 7,
14
16
  };
15
- //# sourceMappingURL=const.js.map
17
+ //# sourceMappingURL=const.js.map
18
+ //# debugId=7c5ef840-6cd3-5004-867f-cf4f3046bc28
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../src/mcp/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAO,CAAC,CAAC,YAAY;AACpE,MAAM,CAAC,MAAM,qCAAqC,GAAG,KAAM,CAAC,CAAC,aAAa;AAE1E,MAAM,CAAC,MAAM,aAAa,GAA2B;IACjD,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;CACf,CAAC"}
1
+ {"version":3,"file":"const.js","sources":["../../src/mcp/const.ts"],"sourceRoot":"","names":[],"mappings":";;AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAO,CAAC,CAAC,YAAY;AACpE,MAAM,CAAC,MAAM,qCAAqC,GAAG,KAAM,CAAC,CAAC,aAAa;AAE1E,MAAM,CAAC,MAAM,aAAa,GAA2B;IACjD,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;CACf,CAAC","debugId":"7c5ef840-6cd3-5004-867f-cf4f3046bc28"}
package/dist/mcp/proxy.js CHANGED
@@ -1,3 +1,5 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="20731836-5909-588b-be10-804393668984")}catch(e){}}();
1
3
  import { fixedAjvCompile } from '../tools/utils.js';
2
4
  import { ajv } from '../utils/ajv.js';
3
5
  import { getMCPServerID, getProxyMCPServerToolName } from './utils.js';
@@ -25,4 +27,5 @@ serverUrl) {
25
27
  }
26
28
  return compiledTools;
27
29
  }
28
- //# sourceMappingURL=proxy.js.map
30
+ //# sourceMappingURL=proxy.js.map
31
+ //# debugId=20731836-5909-588b-be10-804393668984
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/mcp/proxy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,OAAe,EACf,MAAc;AACd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AE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,OAAO,GAAiB;YAC1B,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,OAAO;YAChB,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,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC;YACnD,6CAA6C;YAC7C,WAAW,EAAE,IAAI,CAAC,WAAW;SAChC,CAAC;QAEF,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,aAAa,CAAC;AACzB,CAAC","debugId":"20731836-5909-588b-be10-804393668984"}
@@ -5,7 +5,7 @@ import type { TaskStore } from '@modelcontextprotocol/sdk/experimental/tasks/int
5
5
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
6
  import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
7
7
  import { ApifyClient } from '../apify-client.js';
8
- import type { ActorsMcpServerOptions, ToolEntry } from '../types.js';
8
+ import type { ActorsMcpServerOptions, ActorStore, ToolEntry } from '../types.js';
9
9
  /**
10
10
  * Create Apify MCP server
11
11
  */
@@ -17,6 +17,7 @@ export declare class ActorsMcpServer {
17
17
  private currentLogLevel;
18
18
  readonly options: ActorsMcpServerOptions;
19
19
  readonly taskStore: TaskStore;
20
+ readonly actorStore?: ActorStore;
20
21
  private telemetryEnabled;
21
22
  private telemetryEnv;
22
23
  private availableWidgets;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OA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EAAE,+BAA+B,UAAQ,GAAG,MAAM,EAAE;IAahG;;;;;OAKG;IACI,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,+BAA+B,UAAQ;IAwC9E,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,qBAAqB;IAoB7B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAyC3B;;QAEI;IACJ,OAAO,CAAC,iBAAiB;IAuFzB,OAAO,CAAC,iBAAiB;IAyUzB;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IAoBjC;;;;;;;;;;;OAWG;YAEW,wBAAwB;YAsLxB,oBAAoB;IAmClC;;OAEG;YACW,cAAc;IA4CtB,OAAO,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAoB/B"}
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Model Context Protocol (MCP) server for Apify Actors
3
3
  */
4
+
5
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="023773cd-fd39-59be-b6d7-229f891875c1")}catch(e){}}();
4
6
  import { randomUUID } from 'node:crypto';
5
7
  import { InMemoryTaskStore } from '@modelcontextprotocol/sdk/experimental/tasks/stores/in-memory.js';
6
8
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
@@ -16,8 +18,8 @@ import { getTelemetryEnv, trackToolCall } from '../telemetry.js';
16
18
  import { callActorGetDataset, defaultTools, getActorsAsTools, toolCategories } from '../tools/index.js';
17
19
  import { decodeDotPropertyNames } from '../tools/utils.js';
18
20
  import { buildActorResponseContent } from '../utils/actor-response.js';
19
- import { logHttpError } from '../utils/logging.js';
20
- import { buildMCPResponse } from '../utils/mcp.js';
21
+ import { logHttpError, redactSkyfirePayId } from '../utils/logging.js';
22
+ import { buildMCPResponse, buildUsageMeta } from '../utils/mcp.js';
21
23
  import { createProgressTracker } from '../utils/progress.js';
22
24
  import { getServerInstructions } from '../utils/server-instructions.js';
23
25
  import { validateSkyfirePayId } from '../utils/skyfire.js';
@@ -75,6 +77,12 @@ export class ActorsMcpServer {
75
77
  writable: true,
76
78
  value: void 0
77
79
  });
80
+ Object.defineProperty(this, "actorStore", {
81
+ enumerable: true,
82
+ configurable: true,
83
+ writable: true,
84
+ value: void 0
85
+ });
78
86
  // Telemetry configuration (resolved from options and env vars in setupTelemetry)
79
87
  Object.defineProperty(this, "telemetryEnabled", {
80
88
  enumerable: true,
@@ -106,6 +114,7 @@ export class ActorsMcpServer {
106
114
  else {
107
115
  throw new Error('Task store must be provided for non-stdio transport types');
108
116
  }
117
+ this.actorStore = options.actorStore;
109
118
  const { setupSigintHandler = true } = options;
110
119
  this.server = new Server({
111
120
  name: SERVER_NAME,
@@ -276,7 +285,7 @@ export class ActorsMcpServer {
276
285
  * @returns Promise<ToolEntry[]> - Array of loaded tool entries
277
286
  */
278
287
  async loadActorsAsTools(actorIdsOrNames, apifyClient) {
279
- const actorTools = await getActorsAsTools(actorIdsOrNames, apifyClient);
288
+ const actorTools = await getActorsAsTools(actorIdsOrNames, apifyClient, { actorStore: this.actorStore });
280
289
  if (actorTools.length > 0) {
281
290
  this.upsertTools(actorTools, true);
282
291
  }
@@ -290,7 +299,7 @@ export class ActorsMcpServer {
290
299
  * Used primarily for SSE.
291
300
  */
292
301
  async loadToolsFromUrl(url, apifyClient) {
293
- const tools = await processParamsGetTools(url, apifyClient, this.options.uiMode);
302
+ const tools = await processParamsGetTools(url, apifyClient, this.options.uiMode, this.actorStore);
294
303
  if (tools.length > 0) {
295
304
  log.debug('Loading tools from query parameters');
296
305
  this.upsertTools(tools, false);
@@ -564,7 +573,6 @@ export class ActorsMcpServer {
564
573
  const metaApifyToken = meta === null || meta === void 0 ? void 0 : meta.apifyToken;
565
574
  const apifyToken = (metaApifyToken || this.options.token || process.env.APIFY_TOKEN);
566
575
  const userRentedActorIds = meta === null || meta === void 0 ? void 0 : meta.userRentedActorIds;
567
- const actorOutputSchema = meta === null || meta === void 0 ? void 0 : meta.actorOutputSchema;
568
576
  // mcpSessionId was injected upstream it is important and required for long running tasks as the store uses it and there is not other way to pass it
569
577
  const mcpSessionId = meta === null || meta === void 0 ? void 0 : meta.mcpSessionId;
570
578
  if (!mcpSessionId) {
@@ -576,7 +584,7 @@ export class ActorsMcpServer {
576
584
  const msg = `Apify API token is required but was not provided.
577
585
  Please set the APIFY_TOKEN environment variable or pass it as a parameter in the request header as Authorization Bearer <token>.
578
586
  You can obtain your Apify token from https://console.apify.com/account/integrations.`;
579
- log.softFail(msg, { statusCode: 400 });
587
+ log.softFail(msg, { mcpSessionId, statusCode: 400 });
580
588
  await this.server.sendLoggingMessage({ level: 'error', data: msg });
581
589
  throw new McpError(ErrorCode.InvalidParams, msg);
582
590
  }
@@ -585,7 +593,7 @@ You can obtain your Apify token from https://console.apify.com/account/integrati
585
593
  if (name.startsWith('local__')) {
586
594
  // we split the name by '__' and take the last part, which is the actual Actor name
587
595
  const parts = name.split('__');
588
- log.debug('Tool name with prefix detected', { toolName: name, lastPart: parts[parts.length - 1] });
596
+ log.debug('Tool name with prefix detected', { toolName: name, lastPart: parts[parts.length - 1], mcpSessionId });
589
597
  if (parts.length > 1) {
590
598
  name = parts[parts.length - 1];
591
599
  }
@@ -599,28 +607,28 @@ You can obtain your Apify token from https://console.apify.com/account/integrati
599
607
  const msg = `Tool "${name}" was not found.
600
608
  Available tools: ${availableTools.length > 0 ? availableTools.join(', ') : 'none'}.
601
609
  Please verify the tool name is correct. You can list all available tools using the tools/list request.`;
602
- log.softFail(msg, { statusCode: 404 });
610
+ log.softFail(msg, { mcpSessionId, statusCode: 404 });
603
611
  await this.server.sendLoggingMessage({ level: 'error', data: msg });
604
612
  throw new McpError(ErrorCode.InvalidParams, msg);
605
613
  }
606
614
  if (!args) {
607
615
  const msg = `Missing arguments for tool "${name}".
608
616
  Please provide the required arguments for this tool. Check the tool's input schema using ${HelperTools.ACTOR_GET_DETAILS} tool to see what parameters are required.`;
609
- log.softFail(msg, { statusCode: 400 });
617
+ log.softFail(msg, { mcpSessionId, statusCode: 400 });
610
618
  await this.server.sendLoggingMessage({ level: 'error', data: msg });
611
619
  throw new McpError(ErrorCode.InvalidParams, msg);
612
620
  }
613
621
  // Decode dot property names in arguments before validation,
614
622
  // since validation expects the original, non-encoded property names.
615
623
  args = decodeDotPropertyNames(args);
616
- log.debug('Validate arguments for tool', { toolName: tool.name, input: args });
624
+ log.debug('Validate arguments for tool', { toolName: tool.name, mcpSessionId, input: args });
617
625
  if (!tool.ajvValidate(args)) {
618
626
  const errors = (tool === null || tool === void 0 ? void 0 : tool.ajvValidate.errors) || [];
619
627
  const errorMessages = errors.map((e) => `${e.instancePath || 'root'}: ${e.message || 'validation error'}`).join('; ');
620
628
  const msg = `Invalid arguments for tool "${tool.name}".
621
629
  Validation errors: ${errorMessages}.
622
630
  Please check the tool's input schema using ${HelperTools.ACTOR_GET_DETAILS} tool and ensure all required parameters are provided with correct types and values.`;
623
- log.softFail(msg, { statusCode: 400 });
631
+ log.softFail(msg, { mcpSessionId, statusCode: 400 });
624
632
  await this.server.sendLoggingMessage({ level: 'error', data: msg });
625
633
  throw new McpError(ErrorCode.InvalidParams, msg);
626
634
  }
@@ -631,7 +639,7 @@ Please check the tool's input schema using ${HelperTools.ACTOR_GET_DETAILS} tool
631
639
  if (request.params.task && !ALLOWED_TASK_TOOL_EXECUTION_MODES.includes(taskSupport)) {
632
640
  const msg = `Tool "${tool.name}" does not support long running task calls.
633
641
  Please remove the "task" parameter from the tool call request or use a different tool that supports long running tasks.`;
634
- log.softFail(msg, { statusCode: 400 });
642
+ log.softFail(msg, { mcpSessionId, statusCode: 400 });
635
643
  await this.server.sendLoggingMessage({ level: 'error', data: msg });
636
644
  throw new McpError(ErrorCode.InvalidParams, msg);
637
645
  }
@@ -640,7 +648,7 @@ Please remove the "task" parameter from the tool call request or use a different
640
648
  const task = await this.taskStore.createTask({
641
649
  ttl: request.params.task.ttl,
642
650
  }, `call-tool-${name}-${randomUUID()}`, request);
643
- log.debug('Created task for tool execution', { taskId: task.taskId, toolName: tool.name });
651
+ log.debug('Created task for tool execution', { taskId: task.taskId, toolName: tool.name, mcpSessionId });
644
652
  // Execute the tool asynchronously and update task status
645
653
  setImmediate(async () => {
646
654
  await this.executeToolAndUpdateTask({
@@ -675,7 +683,7 @@ Please remove the "task" parameter from the tool call request or use a different
675
683
  const progressTracker = tool.name === 'call-actor'
676
684
  ? createProgressTracker(progressToken, extra.sendNotification)
677
685
  : null;
678
- log.info('Calling internal tool', { name: tool.name, input: args });
686
+ log.info('Calling internal tool', { name: tool.name, mcpSessionId, input: redactSkyfirePayId(args) });
679
687
  const res = await tool.call({
680
688
  args,
681
689
  extra,
@@ -683,8 +691,8 @@ Please remove the "task" parameter from the tool call request or use a different
683
691
  mcpServer: this.server,
684
692
  apifyToken,
685
693
  userRentedActorIds,
686
- actorOutputSchema,
687
694
  progressTracker,
695
+ mcpSessionId,
688
696
  });
689
697
  if (progressTracker) {
690
698
  progressTracker.stop();
@@ -706,11 +714,11 @@ Please remove the "task" parameter from the tool call request or use a different
706
714
  if (tool.type === 'actor-mcp') {
707
715
  let client = null;
708
716
  try {
709
- client = await connectMCPClient(tool.serverUrl, apifyToken);
717
+ client = await connectMCPClient(tool.serverUrl, apifyToken, mcpSessionId);
710
718
  if (!client) {
711
719
  const msg = `Failed to connect to MCP server at "${tool.serverUrl}".
712
720
  Please verify the server URL is correct and accessible, and ensure you have a valid Apify token with appropriate permissions.`;
713
- log.softFail(msg, { statusCode: 408 }); // 408 Request Timeout
721
+ log.softFail(msg, { mcpSessionId, statusCode: 408 }); // 408 Request Timeout
714
722
  await this.server.sendLoggingMessage({ level: 'error', data: msg });
715
723
  toolStatus = TOOL_STATUS.SOFT_FAIL;
716
724
  return buildMCPResponse({ texts: [msg], isError: true });
@@ -724,13 +732,14 @@ Please verify the server URL is correct and accessible, and ensure you have a va
724
732
  client.setNotificationHandler(schema, async (notification) => {
725
733
  log.debug('Sending MCP notification', {
726
734
  method,
735
+ mcpSessionId,
727
736
  notification,
728
737
  });
729
738
  await extra.sendNotification(notification);
730
739
  });
731
740
  }
732
741
  }
733
- log.info('Calling Actor-MCP', { actorId: tool.actorId, toolName: tool.originToolName, input: args });
742
+ log.info('Calling Actor-MCP', { actorId: tool.actorId, toolName: tool.originToolName, mcpSessionId, input: redactSkyfirePayId(args) });
734
743
  const res = await client.callTool({
735
744
  name: tool.originToolName,
736
745
  arguments: args,
@@ -744,6 +753,17 @@ Please verify the server URL is correct and accessible, and ensure you have a va
744
753
  // We treat the call as succeeded at the telemetry layer unless an actual error is thrown.
745
754
  return { ...res };
746
755
  }
756
+ catch (error) {
757
+ logHttpError(error, `Failed to call MCP tool '${tool.originToolName}' on Actor '${tool.actorId}'`, {
758
+ actorId: tool.actorId,
759
+ toolName: tool.originToolName,
760
+ });
761
+ toolStatus = TOOL_STATUS.FAILED;
762
+ return buildMCPResponse({
763
+ texts: [`Failed to call MCP tool '${tool.originToolName}' on Actor '${tool.actorId}': ${error instanceof Error ? error.message : String(error)}. The MCP server may be temporarily unavailable.`],
764
+ isError: true,
765
+ });
766
+ }
747
767
  finally {
748
768
  if (client)
749
769
  await client.close();
@@ -757,8 +777,16 @@ Please verify the server URL is correct and accessible, and ensure you have a va
757
777
  const { 'skyfire-pay-id': _skyfirePayId, ...actorArgs } = args;
758
778
  const apifyClient = createApifyClientWithSkyfireSupport(this, args, apifyToken);
759
779
  try {
760
- log.info('Calling Actor', { actorName: tool.actorFullName, input: actorArgs });
761
- const callResult = await callActorGetDataset(tool.actorFullName, actorArgs, apifyClient, callOptions, progressTracker, extra.signal);
780
+ log.info('Calling Actor', { actorName: tool.actorFullName, mcpSessionId, input: redactSkyfirePayId(actorArgs) });
781
+ const callResult = await callActorGetDataset({
782
+ actorName: tool.actorFullName,
783
+ input: actorArgs,
784
+ apifyClient,
785
+ callOptions,
786
+ progressTracker,
787
+ abortSignal: extra.signal,
788
+ mcpSessionId,
789
+ });
762
790
  if (!callResult) {
763
791
  toolStatus = TOOL_STATUS.ABORTED;
764
792
  // Receivers of cancellation notifications SHOULD NOT send a response for the cancelled request
@@ -766,7 +794,12 @@ Please verify the server URL is correct and accessible, and ensure you have a va
766
794
  return {};
767
795
  }
768
796
  const { content, structuredContent } = buildActorResponseContent(tool.actorFullName, callResult);
769
- return { content, structuredContent };
797
+ const _meta = buildUsageMeta(callResult);
798
+ return {
799
+ content,
800
+ structuredContent,
801
+ ...(_meta && { _meta }),
802
+ };
770
803
  }
771
804
  finally {
772
805
  if (progressTracker) {
@@ -794,7 +827,7 @@ Please verify the server URL is correct and accessible, and ensure you have a va
794
827
  const msg = `Unknown tool type for "${name}".
795
828
  Available tools: ${availableTools.length > 0 ? availableTools.join(', ') : 'none'}.
796
829
  Please verify the tool name and ensure the tool is properly registered.`;
797
- log.softFail(msg, { statusCode: 404 });
830
+ log.softFail(msg, { mcpSessionId, statusCode: 404 });
798
831
  await this.server.sendLoggingMessage({
799
832
  level: 'error',
800
833
  data: msg,
@@ -880,7 +913,7 @@ Please verify the tool name and ensure the tool is properly registered.`;
880
913
  // Handle internal tool execution in task mode
881
914
  if (toolStatus === TOOL_STATUS.SUCCEEDED && tool.type === 'internal') {
882
915
  const progressTracker = createProgressTracker(progressToken, extra.sendNotification, taskId);
883
- log.info('Calling internal tool for task', { taskId, name: tool.name, input: args });
916
+ log.info('Calling internal tool for task', { taskId, name: tool.name, mcpSessionId, input: redactSkyfirePayId(args) });
884
917
  const res = await tool.call({
885
918
  args,
886
919
  extra,
@@ -889,6 +922,7 @@ Please verify the tool name and ensure the tool is properly registered.`;
889
922
  apifyToken,
890
923
  userRentedActorIds,
891
924
  progressTracker,
925
+ mcpSessionId,
892
926
  });
893
927
  if (progressTracker) {
894
928
  progressTracker.stop();
@@ -912,15 +946,28 @@ Please verify the tool name and ensure the tool is properly registered.`;
912
946
  const callOptions = { memory: tool.memoryMbytes };
913
947
  const { 'skyfire-pay-id': _skyfirePayId, ...actorArgs } = args;
914
948
  const apifyClient = createApifyClientWithSkyfireSupport(this, args, apifyToken);
915
- log.info('Calling Actor for task', { taskId, actorName: tool.actorFullName, input: actorArgs });
916
- const callResult = await callActorGetDataset(tool.actorFullName, actorArgs, apifyClient, callOptions, progressTracker, extra.signal);
949
+ log.info('Calling Actor for task', { taskId, actorName: tool.actorFullName, mcpSessionId, input: redactSkyfirePayId(actorArgs) });
950
+ const callResult = await callActorGetDataset({
951
+ actorName: tool.actorFullName,
952
+ input: actorArgs,
953
+ apifyClient,
954
+ callOptions,
955
+ progressTracker,
956
+ abortSignal: extra.signal,
957
+ mcpSessionId,
958
+ });
917
959
  if (!callResult) {
918
960
  toolStatus = TOOL_STATUS.ABORTED;
919
961
  result = {};
920
962
  }
921
963
  else {
922
964
  const { content, structuredContent } = buildActorResponseContent(tool.actorFullName, callResult);
923
- result = { content, structuredContent };
965
+ const _meta = buildUsageMeta(callResult);
966
+ result = {
967
+ content,
968
+ structuredContent,
969
+ ...(_meta && { _meta }),
970
+ };
924
971
  }
925
972
  if (progressTracker) {
926
973
  progressTracker.stop();
@@ -989,7 +1036,7 @@ Please verify the tool name and ensure the tool is properly registered.`;
989
1036
  if (apifyToken) {
990
1037
  const apifyClient = new ApifyClient({ token: apifyToken });
991
1038
  userId = await getUserIdFromTokenCached(apifyToken, apifyClient);
992
- log.debug('Telemetry: fetched userId', { userId });
1039
+ log.debug('Telemetry: fetched userId', { userId, mcpSessionId });
993
1040
  }
994
1041
  const capabilities = (_b = (_a = this.options.initializeRequestData) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.capabilities;
995
1042
  const params = (_c = this.options.initializeRequestData) === null || _c === void 0 ? void 0 : _c.params;
@@ -1074,4 +1121,5 @@ Please verify the tool name and ensure the tool is properly registered.`;
1074
1121
  await this.server.close();
1075
1122
  }
1076
1123
  }
1077
- //# sourceMappingURL=server.js.map
1124
+ //# sourceMappingURL=server.js.map
1125
+ //# debugId=023773cd-fd39-59be-b6d7-229f891875c1