@apify/actors-mcp-server 0.1.22-beta.14 → 0.1.22-beta.15

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 (104) hide show
  1. package/README.md +62 -64
  2. package/dist/actors.d.ts +74 -0
  3. package/dist/actors.d.ts.map +1 -0
  4. package/dist/actors.js +327 -0
  5. package/dist/actors.js.map +1 -0
  6. package/dist/const.d.ts +19 -14
  7. package/dist/const.d.ts.map +1 -1
  8. package/dist/const.js +23 -22
  9. package/dist/const.js.map +1 -1
  10. package/dist/examples/clientSse.d.ts +1 -11
  11. package/dist/examples/clientSse.d.ts.map +1 -1
  12. package/dist/examples/clientSse.js +10 -13
  13. package/dist/examples/clientSse.js.map +1 -1
  14. package/dist/examples/clientStdio.js +6 -6
  15. package/dist/examples/clientStdio.js.map +1 -1
  16. package/dist/examples/clientStdioChat.js +16 -31
  17. package/dist/examples/clientStdioChat.js.map +1 -1
  18. package/dist/index.d.ts +14 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +51 -6
  21. package/dist/index.js.map +1 -1
  22. package/dist/{actor/input.d.ts → input.d.ts} +1 -1
  23. package/dist/input.d.ts.map +1 -0
  24. package/dist/input.js +23 -0
  25. package/dist/input.js.map +1 -0
  26. package/dist/logger.d.ts +3 -0
  27. package/dist/logger.d.ts.map +1 -0
  28. package/dist/logger.js +4 -0
  29. package/dist/logger.js.map +1 -0
  30. package/dist/main.d.ts +0 -4
  31. package/dist/main.d.ts.map +1 -1
  32. package/dist/main.js +122 -23
  33. package/dist/main.js.map +1 -1
  34. package/dist/server.d.ts +43 -0
  35. package/dist/server.d.ts.map +1 -0
  36. package/dist/server.js +178 -0
  37. package/dist/server.js.map +1 -0
  38. package/dist/tools.d.ts +46 -0
  39. package/dist/tools.d.ts.map +1 -0
  40. package/dist/tools.js +128 -0
  41. package/dist/tools.js.map +1 -0
  42. package/dist/tsconfig.tsbuildinfo +1 -1
  43. package/dist/types.d.ts +10 -70
  44. package/dist/types.d.ts.map +1 -1
  45. package/package.json +15 -17
  46. package/dist/actor/const.d.ts +0 -12
  47. package/dist/actor/const.d.ts.map +0 -1
  48. package/dist/actor/const.js +0 -18
  49. package/dist/actor/const.js.map +0 -1
  50. package/dist/actor/input.d.ts.map +0 -1
  51. package/dist/actor/input.js +0 -21
  52. package/dist/actor/input.js.map +0 -1
  53. package/dist/actor/server.d.ts +0 -4
  54. package/dist/actor/server.d.ts.map +0 -1
  55. package/dist/actor/server.js +0 -154
  56. package/dist/actor/server.js.map +0 -1
  57. package/dist/actor/types.d.ts +0 -30
  58. package/dist/actor/types.d.ts.map +0 -1
  59. package/dist/actor/types.js +0 -2
  60. package/dist/actor/types.js.map +0 -1
  61. package/dist/actor/utils.d.ts +0 -11
  62. package/dist/actor/utils.d.ts.map +0 -1
  63. package/dist/actor/utils.js +0 -50
  64. package/dist/actor/utils.js.map +0 -1
  65. package/dist/examples/clientStreamableHttp.d.ts +0 -2
  66. package/dist/examples/clientStreamableHttp.d.ts.map +0 -1
  67. package/dist/examples/clientStreamableHttp.js +0 -93
  68. package/dist/examples/clientStreamableHttp.js.map +0 -1
  69. package/dist/mcp-server.d.ts +0 -39
  70. package/dist/mcp-server.d.ts.map +0 -1
  71. package/dist/mcp-server.js +0 -165
  72. package/dist/mcp-server.js.map +0 -1
  73. package/dist/stdio.d.ts +0 -15
  74. package/dist/stdio.d.ts.map +0 -1
  75. package/dist/stdio.js +0 -46
  76. package/dist/stdio.js.map +0 -1
  77. package/dist/tools/actor.d.ts +0 -37
  78. package/dist/tools/actor.d.ts.map +0 -1
  79. package/dist/tools/actor.js +0 -90
  80. package/dist/tools/actor.js.map +0 -1
  81. package/dist/tools/build.d.ts +0 -12
  82. package/dist/tools/build.d.ts.map +0 -1
  83. package/dist/tools/build.js +0 -121
  84. package/dist/tools/build.js.map +0 -1
  85. package/dist/tools/helpers.d.ts +0 -19
  86. package/dist/tools/helpers.d.ts.map +0 -1
  87. package/dist/tools/helpers.js +0 -62
  88. package/dist/tools/helpers.js.map +0 -1
  89. package/dist/tools/index.d.ts +0 -6
  90. package/dist/tools/index.d.ts.map +0 -1
  91. package/dist/tools/index.js +0 -8
  92. package/dist/tools/index.js.map +0 -1
  93. package/dist/tools/mcp-apify-client.d.ts +0 -6
  94. package/dist/tools/mcp-apify-client.d.ts.map +0 -1
  95. package/dist/tools/mcp-apify-client.js +0 -24
  96. package/dist/tools/mcp-apify-client.js.map +0 -1
  97. package/dist/tools/store_collection.d.ts +0 -21
  98. package/dist/tools/store_collection.d.ts.map +0 -1
  99. package/dist/tools/store_collection.js +0 -81
  100. package/dist/tools/store_collection.js.map +0 -1
  101. package/dist/tools/utils.d.ts +0 -77
  102. package/dist/tools/utils.d.ts.map +0 -1
  103. package/dist/tools/utils.js +0 -202
  104. package/dist/tools/utils.js.map +0 -1
package/dist/actors.js ADDED
@@ -0,0 +1,327 @@
1
+ import { Ajv } from 'ajv';
2
+ import { ApifyClient } from 'apify-client';
3
+ import { ACTOR_ADDITIONAL_INSTRUCTIONS, defaults, MAX_DESCRIPTION_LENGTH, ACTOR_README_MAX_LENGTH, ACTOR_ENUM_MAX_LENGTH } from './const.js';
4
+ import { log } from './logger.js';
5
+ export function actorNameToToolName(actorName) {
6
+ return actorName
7
+ .replace(/\//g, '-slash-')
8
+ .replace(/\./g, '-dot-')
9
+ .slice(0, 64);
10
+ }
11
+ /**
12
+ * Get actor input schema by actor name.
13
+ * First, fetch the actor details to get the default build tag and buildId.
14
+ * Then, fetch the build details and return actorName, description, and input schema.
15
+ * @param {string} actorIdOrName - Actor ID or Actor full name.
16
+ * @param {number} limit - Truncate the README to this limit.
17
+ * @returns {Promise<ActorDefinitionWithDesc | null>} - The actor definition with description or null if not found.
18
+ */
19
+ export async function getActorDefinition(actorIdOrName, limit = ACTOR_README_MAX_LENGTH) {
20
+ const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
21
+ const actorClient = client.actor(actorIdOrName);
22
+ try {
23
+ // Fetch actor details
24
+ const actor = await actorClient.get();
25
+ if (!actor) {
26
+ log.error(`Failed to fetch input schema for Actor: ${actorIdOrName}. Actor not found.`);
27
+ return null;
28
+ }
29
+ // fnesveda: The default build is not necessarily tagged, you can specify any build number as default build.
30
+ // There will be a new API endpoint to fetch a default build.
31
+ // For now, we'll use the tagged build, it will work for 90% of Actors. Later, we can update this.
32
+ const tag = actor.defaultRunOptions?.build || '';
33
+ const buildId = actor.taggedBuilds?.[tag]?.buildId || '';
34
+ if (!buildId) {
35
+ log.error(`Failed to fetch input schema for Actor: ${actorIdOrName}. Build ID not found.`);
36
+ return null;
37
+ }
38
+ // Fetch build details and return the input schema
39
+ const buildDetails = await client.build(buildId).get();
40
+ if (buildDetails?.actorDefinition) {
41
+ const actorDefinitions = buildDetails?.actorDefinition;
42
+ actorDefinitions.id = actor.id;
43
+ actorDefinitions.readme = truncateActorReadme(actorDefinitions.readme || '', limit);
44
+ actorDefinitions.description = actor.description || '';
45
+ actorDefinitions.actorFullName = `${actor.username}/${actor.name}`;
46
+ actorDefinitions.defaultRunOptions = actor.defaultRunOptions;
47
+ return pruneActorDefinition(actorDefinitions);
48
+ }
49
+ return null;
50
+ }
51
+ catch (error) {
52
+ const errorMessage = `Failed to fetch input schema for Actor: ${actorIdOrName} with error ${error}.`;
53
+ log.error(errorMessage);
54
+ throw new Error(errorMessage);
55
+ }
56
+ }
57
+ function pruneActorDefinition(response) {
58
+ return {
59
+ id: response.id,
60
+ actorFullName: response.actorFullName || '',
61
+ buildTag: response?.buildTag || '',
62
+ readme: response?.readme || '',
63
+ input: response?.input && 'type' in response.input && 'properties' in response.input
64
+ ? { ...response.input,
65
+ type: response.input.type,
66
+ properties: response.input.properties }
67
+ : undefined,
68
+ description: response.description,
69
+ defaultRunOptions: response.defaultRunOptions,
70
+ };
71
+ }
72
+ /**
73
+ * Helper function to shorten the enum list if it is too long.
74
+ *
75
+ * @param {string[]} enumList - The list of enum values to be shortened.
76
+ * @returns {string[] | undefined} - The shortened enum list or undefined if the list is too long.
77
+ */
78
+ export function shortenEnum(enumList) {
79
+ let charCount = 0;
80
+ const resultEnumList = enumList.filter((enumValue) => {
81
+ charCount += enumValue.length;
82
+ return charCount <= ACTOR_ENUM_MAX_LENGTH;
83
+ });
84
+ return resultEnumList.length > 0 ? resultEnumList : undefined;
85
+ }
86
+ /**
87
+ * Shortens the description, enum, and items.enum properties of the schema properties.
88
+ * @param properties
89
+ */
90
+ export function shortenProperties(properties) {
91
+ for (const property of Object.values(properties)) {
92
+ if (property.description.length > MAX_DESCRIPTION_LENGTH) {
93
+ property.description = `${property.description.slice(0, MAX_DESCRIPTION_LENGTH)}...`;
94
+ }
95
+ if (property.enum && property.enum?.length > 0) {
96
+ property.enum = shortenEnum(property.enum);
97
+ }
98
+ if (property.items?.enum && property.items.enum.length > 0) {
99
+ property.items.enum = shortenEnum(property.items.enum);
100
+ }
101
+ }
102
+ return properties;
103
+ }
104
+ /** Prune Actor README if it is too long
105
+ * If the README is too long
106
+ * - We keep the README as it is up to the limit.
107
+ * - After the limit, we keep heading only
108
+ * - We add a note that the README was truncated because it was too long.
109
+ */
110
+ export function truncateActorReadme(readme, limit = ACTOR_README_MAX_LENGTH) {
111
+ if (readme.length <= limit) {
112
+ return readme;
113
+ }
114
+ const readmeFirst = readme.slice(0, limit);
115
+ const readmeRest = readme.slice(limit);
116
+ const lines = readmeRest.split('\n');
117
+ const prunedReadme = lines.filter((line) => line.startsWith('#'));
118
+ return `${readmeFirst}\n\nREADME was truncated because it was too long. Remaining headers:\n${prunedReadme.join(', ')}`;
119
+ }
120
+ /**
121
+ * Helps determine the type of items in an array schema property.
122
+ * Priority order: explicit type in items > prefill type > default value type > editor type.
123
+ *
124
+ * Based on JSON schema, the array needs a type, and most of the time Actor input schema does not have this, so we need to infer that.
125
+ *
126
+ */
127
+ export function inferArrayItemType(property) {
128
+ return property.items?.type
129
+ || (Array.isArray(property.prefill) && property.prefill.length > 0 && typeof property.prefill[0])
130
+ || (Array.isArray(property.default) && property.default.length > 0 && typeof property.default[0])
131
+ || (property.editor && getEditorItemType(property.editor))
132
+ || null;
133
+ function getEditorItemType(editor) {
134
+ const editorTypeMap = {
135
+ requestListSources: 'object',
136
+ stringList: 'string',
137
+ json: 'object',
138
+ globs: 'object',
139
+ };
140
+ return editorTypeMap[editor] || null;
141
+ }
142
+ }
143
+ /**
144
+ * Add enum values as string to property descriptions.
145
+ *
146
+ * This is done as a preventive measure to prevent cases where library or agent framework
147
+ * does not handle enums or examples based on JSON schema definition.
148
+ *
149
+ * https://json-schema.org/understanding-json-schema/reference/enum
150
+ * https://json-schema.org/understanding-json-schema/reference/annotations
151
+ *
152
+ * @param properties
153
+ */
154
+ function addEnumsToDescriptionsWithExamples(properties) {
155
+ for (const property of Object.values(properties)) {
156
+ if (property.enum && property.enum.length > 0) {
157
+ property.description = `${property.description}\nPossible values: ${property.enum.slice(0, 20).join(',')}`;
158
+ }
159
+ const value = property.prefill ?? property.default;
160
+ if (value && !(Array.isArray(value) && value.length === 0)) {
161
+ property.examples = Array.isArray(value) ? value : [value];
162
+ property.description = `${property.description}\nExample values: ${JSON.stringify(value)}`;
163
+ }
164
+ }
165
+ return properties;
166
+ }
167
+ /**
168
+ * Filters schema properties to include only the necessary fields.
169
+ *
170
+ * This is done to reduce the size of the input schema and to make it more readable.
171
+ *
172
+ * @param properties
173
+ */
174
+ export function filterSchemaProperties(properties) {
175
+ const filteredProperties = {};
176
+ for (const [key, property] of Object.entries(properties)) {
177
+ filteredProperties[key] = {
178
+ title: property.title,
179
+ description: property.description,
180
+ enum: property.enum,
181
+ type: property.type,
182
+ default: property.default,
183
+ prefill: property.prefill,
184
+ properties: property.properties,
185
+ items: property.items,
186
+ required: property.required,
187
+ };
188
+ if (property.type === 'array' && !property.items?.type) {
189
+ const itemsType = inferArrayItemType(property);
190
+ if (itemsType) {
191
+ filteredProperties[key].items = {
192
+ ...filteredProperties[key].items,
193
+ title: filteredProperties[key].title ?? 'Item',
194
+ description: filteredProperties[key].description ?? 'Item',
195
+ type: itemsType,
196
+ };
197
+ }
198
+ }
199
+ }
200
+ return filteredProperties;
201
+ }
202
+ /**
203
+ * Marks input properties as required by adding a "REQUIRED" prefix to their descriptions.
204
+ * Takes an IActorInput object and returns a modified Record of SchemaProperties.
205
+ *
206
+ * This is done for maximum compatibility in case where library or agent framework does not consider
207
+ * required fields and does not handle the JSON schema properly: we are prepending this to the description
208
+ * as a preventive measure.
209
+ * @param {IActorInputSchema} input - Actor input object containing properties and required fields
210
+ * @returns {Record<string, ISchemaProperties>} - Modified properties with required fields marked
211
+ */
212
+ function markInputPropertiesAsRequired(input) {
213
+ const { required = [], properties } = input;
214
+ for (const property of Object.keys(properties)) {
215
+ if (required.includes(property)) {
216
+ properties[property] = {
217
+ ...properties[property],
218
+ description: `**REQUIRED** ${properties[property].description}`,
219
+ };
220
+ }
221
+ }
222
+ return properties;
223
+ }
224
+ /**
225
+ * Builds nested properties for object types in the schema.
226
+ *
227
+ * Specifically handles special cases like proxy configuration and request list sources
228
+ * by adding predefined nested properties to these object types.
229
+ * This is necessary for the agent to correctly infer how to structure object inputs
230
+ * when passing arguments to the Actor.
231
+ *
232
+ * For proxy objects (type='object', editor='proxy'), adds 'useApifyProxy' property.
233
+ * For request list sources (type='array', editor='requestListSources'), adds URL structure to items.
234
+ *
235
+ * @param {Record<string, ISchemaProperties>} properties - The input schema properties
236
+ * @returns {Record<string, ISchemaProperties>} Modified properties with nested properties
237
+ */
238
+ function buildNestedProperties(properties) {
239
+ const clonedProperties = { ...properties };
240
+ for (const [propertyName, property] of Object.entries(clonedProperties)) {
241
+ if (property.type === 'object' && property.editor === 'proxy') {
242
+ clonedProperties[propertyName] = {
243
+ ...property,
244
+ properties: {
245
+ ...property.properties,
246
+ useApifyProxy: {
247
+ title: 'Use Apify Proxy',
248
+ type: 'boolean',
249
+ description: 'Whether to use Apify Proxy - ALWAYS SET TO TRUE.',
250
+ default: true,
251
+ examples: [true],
252
+ },
253
+ },
254
+ required: ['useApifyProxy'],
255
+ };
256
+ }
257
+ else if (property.type === 'array' && property.editor === 'requestListSources') {
258
+ clonedProperties[propertyName] = {
259
+ ...property,
260
+ items: {
261
+ ...property.items,
262
+ type: 'object',
263
+ title: 'Request list source',
264
+ description: 'Request list source',
265
+ properties: {
266
+ url: {
267
+ title: 'URL',
268
+ type: 'string',
269
+ description: 'URL of the request list source',
270
+ },
271
+ },
272
+ },
273
+ };
274
+ }
275
+ }
276
+ return clonedProperties;
277
+ }
278
+ /**
279
+ * Fetches actor input schemas by Actor IDs or Actor full names and creates MCP tools.
280
+ *
281
+ * This function retrieves the input schemas for the specified actors and compiles them into MCP tools.
282
+ * It uses the AJV library to validate the input schemas.
283
+ *
284
+ * Tool name can't contain /, so it is replaced with _
285
+ *
286
+ * The input schema processing workflow:
287
+ * 1. Properties are marked as required using markInputPropertiesAsRequired() to add "REQUIRED" prefix to descriptions
288
+ * 2. Nested properties are built by analyzing editor type (proxy, requestListSources) using buildNestedProperties()
289
+ * 3. Properties are filtered using filterSchemaProperties()
290
+ * 4. Properties are shortened using shortenProperties()
291
+ * 5. Enums are added to descriptions with examples using addEnumsToDescriptionsWithExamples()
292
+ *
293
+ * @param {string[]} actors - An array of actor IDs or Actor full names.
294
+ * @returns {Promise<Tool[]>} - A promise that resolves to an array of MCP tools.
295
+ */
296
+ export async function getActorsAsTools(actors) {
297
+ const ajv = new Ajv({ coerceTypes: 'array', strict: false });
298
+ const results = await Promise.all(actors.map(getActorDefinition));
299
+ const tools = [];
300
+ for (const result of results) {
301
+ if (result) {
302
+ if (result.input && 'properties' in result.input && result.input) {
303
+ result.input.properties = markInputPropertiesAsRequired(result.input);
304
+ result.input.properties = buildNestedProperties(result.input.properties);
305
+ result.input.properties = filterSchemaProperties(result.input.properties);
306
+ result.input.properties = shortenProperties(result.input.properties);
307
+ result.input.properties = addEnumsToDescriptionsWithExamples(result.input.properties);
308
+ }
309
+ try {
310
+ const memoryMbytes = result.defaultRunOptions?.memoryMbytes || defaults.maxMemoryMbytes;
311
+ tools.push({
312
+ name: actorNameToToolName(result.actorFullName),
313
+ actorFullName: result.actorFullName,
314
+ description: `${result.description} Instructions: ${ACTOR_ADDITIONAL_INSTRUCTIONS}`,
315
+ inputSchema: result.input || {},
316
+ ajvValidate: ajv.compile(result.input || {}),
317
+ memoryMbytes: memoryMbytes > defaults.maxMemoryMbytes ? defaults.maxMemoryMbytes : memoryMbytes,
318
+ });
319
+ }
320
+ catch (validationError) {
321
+ log.error(`Failed to compile AJV schema for Actor: ${result.actorFullName}. Error: ${validationError}`);
322
+ }
323
+ }
324
+ }
325
+ return tools;
326
+ }
327
+ //# sourceMappingURL=actors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actors.js","sourceRoot":"","sources":["../src/actors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,6BAA6B,EAAE,QAAQ,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC7I,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACjD,OAAO,SAAS;SACX,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;SACzB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;SACvB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,aAAqB,EAAE,QAAgB,uBAAuB;IACnG,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACnE,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAEhD,IAAI,CAAC;QACD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C,CAAC,CAAC,YAAY;iBAClG,CAAC,CAAC;YACP,CAAC;YAAC,OAAO,eAAe,EAAE,CAAC;gBACvB,GAAG,CAAC,KAAK,CAAC,2CAA2C,MAAM,CAAC,aAAa,YAAY,eAAe,EAAE,CAAC,CAAC;YAC5G,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
package/dist/const.d.ts CHANGED
@@ -1,22 +1,27 @@
1
- export declare const ACTOR_README_MAX_LENGTH = 5000;
2
- export declare const ACTOR_ENUM_MAX_LENGTH = 200;
3
- export declare const ACTOR_MAX_DESCRIPTION_LENGTH = 500;
4
- export declare const ACTOR_OUTPUT_MAX_CHARS_PER_ITEM = 5000;
5
- export declare const ACTOR_OUTPUT_TRUNCATED_MESSAGE: string;
6
- export declare const ACTOR_ADDITIONAL_INSTRUCTIONS: string;
7
- export declare const ACTOR_MAX_MEMORY_MBYTES = 4096;
8
1
  export declare const SERVER_NAME = "apify-mcp-server";
9
- export declare const SERVER_VERSION = "1.0.0";
2
+ export declare const SERVER_VERSION = "0.1.0";
3
+ export declare const HEADER_READINESS_PROBE = "x-apify-container-server-readiness-probe";
4
+ export declare const MAX_DESCRIPTION_LENGTH = 500;
10
5
  export declare const USER_AGENT_ORIGIN = "Origin/mcp-server";
11
- export declare enum HelperTools {
12
- SEARCH = "search",
13
- ADD_TOOL = "add-tool",
14
- REMOVE_TOOL = "remove-tool",
15
- GET_TOOL_DETAILS = "get-tool-details"
16
- }
17
6
  export declare const defaults: {
18
7
  actors: string[];
19
8
  enableActorAutoLoading: boolean;
20
9
  maxMemoryMbytes: number;
21
10
  };
11
+ export declare const ACTOR_README_MAX_LENGTH = 5000;
12
+ export declare const ACTOR_ENUM_MAX_LENGTH = 200;
13
+ export declare const ACTOR_OUTPUT_MAX_CHARS_PER_ITEM = 5000;
14
+ export declare const ACTOR_OUTPUT_TRUNCATED_MESSAGE: string;
15
+ export declare const ACTOR_ADDITIONAL_INSTRUCTIONS: string;
16
+ export declare enum InternalTools {
17
+ DISCOVER_ACTORS = "discover-actors",
18
+ ADD_ACTOR_TO_TOOLS = "add-actor-to-tools",
19
+ REMOVE_ACTOR_FROM_TOOLS = "remove-actor-from-tools",
20
+ GET_ACTOR_DETAILS = "get-actor-details"
21
+ }
22
+ export declare enum Routes {
23
+ ROOT = "/",
24
+ SSE = "/sse",
25
+ MESSAGE = "/message"
26
+ }
22
27
  //# sourceMappingURL=const.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAC7C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAGhD,eAAO,MAAM,+BAA+B,OAAQ,CAAC;AACrD,eAAO,MAAM,8BAA8B,QACQ,CAAC;AAEpD,eAAO,MAAM,6BAA6B,QACuB,CAAC;AAGlE,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAG7C,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAC9C,eAAO,MAAM,cAAc,UAAU,CAAC;AAGtC,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,oBAAY,WAAW;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,gBAAgB,qBAAqB;CACxC;AAED,eAAO,MAAM,QAAQ;;;;CAQpB,CAAC"}
1
+ {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAC9C,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,eAAO,MAAM,sBAAsB,6CAA6C,CAAC;AACjF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,eAAO,MAAM,QAAQ;;;;CAQpB,CAAC;AAEF,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAC7C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,+BAA+B,OAAQ,CAAC;AACrD,eAAO,MAAM,8BAA8B,QACQ,CAAC;AACpD,eAAO,MAAM,6BAA6B,QACuB,CAAC;AAElE,oBAAY,aAAa;IACrB,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,uBAAuB,4BAA4B;IACnD,iBAAiB,sBAAsB;CAC1C;AAED,oBAAY,MAAM;IACd,IAAI,MAAM;IACV,GAAG,SAAS;IACZ,OAAO,aAAa;CACvB"}
package/dist/const.js CHANGED
@@ -1,27 +1,8 @@
1
- // Actor input const
2
- export const ACTOR_README_MAX_LENGTH = 5000;
3
- export const ACTOR_ENUM_MAX_LENGTH = 200;
4
- export const ACTOR_MAX_DESCRIPTION_LENGTH = 500;
5
- // Actor output const
6
- export const ACTOR_OUTPUT_MAX_CHARS_PER_ITEM = 5000;
7
- export const ACTOR_OUTPUT_TRUNCATED_MESSAGE = `Output was truncated because it will not fit into context.`
8
- + `There is no reason to call this tool again!`;
9
- export const ACTOR_ADDITIONAL_INSTRUCTIONS = 'Never call/execute tool/Actor unless confirmed by the user. '
10
- + 'Always limit the number of results in the call arguments.';
11
- // Actor run const
12
- export const ACTOR_MAX_MEMORY_MBYTES = 4096; // If the Actor requires 8GB of memory, free users can't run actors-mcp-server and requested Actor
13
- // MCP Server
14
1
  export const SERVER_NAME = 'apify-mcp-server';
15
- export const SERVER_VERSION = '1.0.0';
16
- // User agent headers
2
+ export const SERVER_VERSION = '0.1.0';
3
+ export const HEADER_READINESS_PROBE = 'x-apify-container-server-readiness-probe';
4
+ export const MAX_DESCRIPTION_LENGTH = 500;
17
5
  export const USER_AGENT_ORIGIN = 'Origin/mcp-server';
18
- export var HelperTools;
19
- (function (HelperTools) {
20
- HelperTools["SEARCH"] = "search";
21
- HelperTools["ADD_TOOL"] = "add-tool";
22
- HelperTools["REMOVE_TOOL"] = "remove-tool";
23
- HelperTools["GET_TOOL_DETAILS"] = "get-tool-details";
24
- })(HelperTools || (HelperTools = {}));
25
6
  export const defaults = {
26
7
  actors: [
27
8
  'apify/instagram-scraper',
@@ -31,4 +12,24 @@ export const defaults = {
31
12
  enableActorAutoLoading: false,
32
13
  maxMemoryMbytes: 4096,
33
14
  };
15
+ export const ACTOR_README_MAX_LENGTH = 5_000;
16
+ export const ACTOR_ENUM_MAX_LENGTH = 200;
17
+ export const ACTOR_OUTPUT_MAX_CHARS_PER_ITEM = 5_000;
18
+ export const ACTOR_OUTPUT_TRUNCATED_MESSAGE = `Output was truncated because it will not fit into context.`
19
+ + `There is no reason to call this tool again!`;
20
+ export const ACTOR_ADDITIONAL_INSTRUCTIONS = 'Never call/execute tool/Actor unless confirmed by the user. '
21
+ + 'Always limit the number of results in the call arguments.';
22
+ export var InternalTools;
23
+ (function (InternalTools) {
24
+ InternalTools["DISCOVER_ACTORS"] = "discover-actors";
25
+ InternalTools["ADD_ACTOR_TO_TOOLS"] = "add-actor-to-tools";
26
+ InternalTools["REMOVE_ACTOR_FROM_TOOLS"] = "remove-actor-from-tools";
27
+ InternalTools["GET_ACTOR_DETAILS"] = "get-actor-details";
28
+ })(InternalTools || (InternalTools = {}));
29
+ export var Routes;
30
+ (function (Routes) {
31
+ Routes["ROOT"] = "/";
32
+ Routes["SSE"] = "/sse";
33
+ Routes["MESSAGE"] = "/message";
34
+ })(Routes || (Routes = {}));
34
35
  //# sourceMappingURL=const.js.map
package/dist/const.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAK,CAAC;AAC7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACzC,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEhD,qBAAqB;AACrB,MAAM,CAAC,MAAM,+BAA+B,GAAG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CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAC7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACzC,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,CAAC;AACrD,MAAM,CAAC,MAAM,8BAA8B,GAAG,4DAA4D;MACpG,6CAA6C,CAAC;AACpD,MAAM,CAAC,MAAM,6BAA6B,GAAG,8DAA8D;MACrG,2DAA2D,CAAC;AAElE,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACrB,oDAAmC,CAAA;IACnC,0DAAyC,CAAA;IACzC,oEAAmD,CAAA;IACnD,wDAAuC,CAAA;AAC3C,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAED,MAAM,CAAN,IAAY,MAIX;AAJD,WAAY,MAAM;IACd,oBAAU,CAAA;IACV,sBAAY,CAAA;IACZ,8BAAoB,CAAA;AACxB,CAAC,EAJW,MAAM,KAAN,MAAM,QAIjB"}
@@ -4,15 +4,5 @@
4
4
  *
5
5
  * It requires the `APIFY_TOKEN` in the `.env` file.
6
6
  */
7
- import type { EventSourceInit } from 'eventsource';
8
- import { EventSource } from 'eventsource';
9
- declare global {
10
- var EventSource: {
11
- new (url: string, eventSourceInitDict?: EventSourceInit): EventSource;
12
- prototype: EventSource;
13
- CONNECTING: 0;
14
- OPEN: 1;
15
- CLOSED: 2;
16
- };
17
- }
7
+ export {};
18
8
  //# sourceMappingURL=clientSse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clientSse.d.ts","sourceRoot":"","sources":["../../src/examples/clientSse.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAsB1C,OAAO,CAAC,MAAM,CAAC;IAGX,IAAI,WAAW,EAAE;QACb,KAAI,GAAG,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,eAAe,GAAG,WAAW,CAAC;QACrE,SAAS,EAAE,WAAW,CAAC;QACvB,UAAU,EAAE,CAAC,CAAC;QACd,IAAI,EAAE,CAAC,CAAC;QACR,MAAM,EAAE,CAAC,CAAC;KACb,CAAC;CACL"}
1
+ {"version":3,"file":"clientSse.d.ts","sourceRoot":"","sources":["../../src/examples/clientSse.ts"],"names":[],"mappings":"AACA;;;;;GAKG"}
@@ -5,23 +5,22 @@
5
5
  *
6
6
  * It requires the `APIFY_TOKEN` in the `.env` file.
7
7
  */
8
- import path from 'node:path';
9
- import { fileURLToPath } from 'node:url';
8
+ import path from 'path';
9
+ import { fileURLToPath } from 'url';
10
10
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
11
11
  import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
12
12
  import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';
13
- import dotenv from 'dotenv'; // eslint-disable-line import/no-extraneous-dependencies
14
- import { EventSource } from 'eventsource'; // eslint-disable-line import/no-extraneous-dependencies
15
- import { actorNameToToolName } from '../tools/utils.js';
16
- const REQUEST_TIMEOUT = 120000; // 2 minutes
13
+ import dotenv from 'dotenv';
14
+ import { EventSource } from 'eventsource';
15
+ import { actorNameToToolName } from '../actors.js';
16
+ const REQUEST_TIMEOUT = 120_000; // 2 minutes
17
17
  const filename = fileURLToPath(import.meta.url);
18
18
  const dirname = path.dirname(filename);
19
19
  dotenv.config({ path: path.resolve(dirname, '../../.env') });
20
- const SERVER_URL = process.env.MCP_SERVER_URL_BASE || 'https://actors-mcp-server.apify.actor/sse';
20
+ const SERVER_URL = 'https://actors-mcp-server.apify.actor/sse';
21
21
  // We need to change forward slash / to underscore -- in the tool name as Anthropic does not allow forward slashes in the tool name
22
22
  const SELECTED_TOOL = actorNameToToolName('apify/rag-web-browser');
23
- // const QUERY = 'web browser for Anthropic';
24
- const QUERY = 'apify';
23
+ const QUERY = 'web browser for Anthropic';
25
24
  if (!process.env.APIFY_TOKEN) {
26
25
  console.error('APIFY_TOKEN is required but not set in the environment variables.');
27
26
  process.exit(1);
@@ -41,7 +40,7 @@ async function main() {
41
40
  // You can use this to set additional headers on the outgoing request.
42
41
  // Based on this example: https://github.com/modelcontextprotocol/typescript-sdk/issues/118
43
42
  async fetch(input, init) {
44
- const headers = new Headers((init === null || init === void 0 ? void 0 : init.headers) || {});
43
+ const headers = new Headers(init?.headers || {});
45
44
  headers.set('authorization', `Bearer ${process.env.APIFY_TOKEN}`);
46
45
  return fetch(input, { ...init, headers });
47
46
  },
@@ -72,14 +71,12 @@ async function main() {
72
71
  catch (error) {
73
72
  if (error instanceof Error) {
74
73
  console.error('Error:', error.message);
74
+ console.error(error.stack);
75
75
  }
76
76
  else {
77
77
  console.error('An unknown error occurred:', error);
78
78
  }
79
79
  }
80
- finally {
81
- await client.close();
82
- }
83
80
  }
84
81
  await main();
85
82
  //# sourceMappingURL=clientSse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clientSse.js","sourceRoot":"","sources":["../../src/examples/clientSse.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B;;;;;GAKG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,MAAM,MAAM,QAAQ,CAAC,CAAC,wDAAwD;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC,CAAC,wDAAwD;AAEnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,eAAe,GAAG,MAAO,CAAC,CAAC,YAAY;AAC7C,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC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;QAC/B,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACvD,CAAC;IACL,CAAC;AACL,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
@@ -5,19 +5,19 @@
5
5
  * You need to provide the path to the MCP server and `APIFY_TOKEN` in the `.env` file.
6
6
  * You can choose actors to run in the server, for example: `apify/rag-web-browser`.
7
7
  */
8
- import { execSync } from 'node:child_process';
9
- import path from 'node:path';
10
- import { fileURLToPath } from 'node:url';
8
+ import { execSync } from 'child_process';
9
+ import path from 'path';
10
+ import { fileURLToPath } from 'url';
11
11
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
12
12
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
13
13
  import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';
14
- import dotenv from 'dotenv'; // eslint-disable-line import/no-extraneous-dependencies
15
- import { actorNameToToolName } from '../tools/utils.js';
14
+ import dotenv from 'dotenv';
15
+ import { actorNameToToolName } from '../actors.js';
16
16
  // Resolve dirname equivalent in ES module
17
17
  const filename = fileURLToPath(import.meta.url);
18
18
  const dirname = path.dirname(filename);
19
19
  dotenv.config({ path: path.resolve(dirname, '../../.env') });
20
- const SERVER_PATH = path.resolve(dirname, '../../dist/stdio.js');
20
+ const SERVER_PATH = path.resolve(dirname, '../../dist/index.js');
21
21
  const NODE_PATH = execSync(process.platform === 'win32' ? 'where node' : 'which node').toString().trim();
22
22
  const TOOLS = 'apify/rag-web-browser,lukaskrivka/google-maps-with-contact-details';
23
23
  const SELECTED_TOOL = actorNameToToolName('apify/rag-web-browser');
@@ -1 +1 @@
1
- {"version":3,"file":"clientStdio.js","sourceRoot":"","sources":["../../src/examples/clientStdio.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,IAAI,MAAM,WAA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