@apify/actors-mcp-server 0.20.1-beta.9 → 0.20.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,10 @@
1
1
  import type { ValidateFunction } from 'ajv';
2
2
  import Ajv from 'ajv';
3
- export declare const ajv: Ajv;
3
+ /**
4
+ * Ajv with the server's validation policy. One instance per compile, never shared: Ajv caches every compiled
5
+ * schema in a Map that is never evicted.
6
+ */
7
+ export declare function createAjv(): Ajv;
4
8
  /**
5
9
  * Removes the `$schema` property and drops fields with real `default` values from `required`.
6
10
  *
@@ -22,7 +26,7 @@ export declare function fixZodSchemaRequired(schema: Record<string, unknown>): R
22
26
  * and fixing the required array.
23
27
  *
24
28
  * **Unknown properties are silently stripped** by the AJV `removeAdditional: true` option
25
- * (set on the shared `ajv` instance). MCP / LLM clients regularly send extra top-level keys
29
+ * (set in `createAjv`). MCP / LLM clients regularly send extra top-level keys
26
30
  * (client metadata, duplicated hints, transport leftovers) that would otherwise cause validation
27
31
  * failures. Stripping them is safer than allowing them through with `additionalProperties: true`,
28
32
  * because no downstream code should rely on undeclared properties.
@@ -1 +1 @@
1
- {"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../src/utils/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,GAAG,KAA2E,CAAC;AAe5F;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAc7F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAE/E"}
1
+ {"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../src/utils/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB;;;GAGG;AACH,wBAAgB,SAAS,IAAI,GAAG,CAgB/B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAc7F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAE/E"}
package/dist/utils/ajv.js CHANGED
@@ -1,17 +1,24 @@
1
1
  import Ajv from 'ajv';
2
- export const ajv = new Ajv({ coerceTypes: 'array', strict: false, removeAdditional: true });
3
- // `pattern`/`patternProperties` compile a RegExp from untrusted Actor / proxied-MCP input schemas;
4
- // a catastrophic-backtracking pattern freezes the single-threaded event loop (ReDoS). `format` is
5
- // inert today (ajv-formats is not registered) but would arm the same vector if it ever were. This
6
- // layer only sanitizes LLM args — the Actor re-validates its real input on the run — so dropping
7
- // regex enforcement removes the DoS surface with no loss of protection. Consequence for `src/`
8
- // schemas: a `.regex()` on a Zod field is NOT enforced here. It still reaches `tools/list` and still
9
- // fires in a tool body's `parse()`, where it throws a raw ZodError at the client instead of a
10
- // readable error — so rely on the API's own validation rather than adding one. `taskNameSchema`
11
- // (`tools/tasks/task_helpers.ts`) still carries one and predates this note.
12
- ajv.removeKeyword('pattern');
13
- ajv.removeKeyword('patternProperties');
14
- ajv.removeKeyword('format');
2
+ /**
3
+ * Ajv with the server's validation policy. One instance per compile, never shared: Ajv caches every compiled
4
+ * schema in a Map that is never evicted.
5
+ */
6
+ export function createAjv() {
7
+ const instance = new Ajv({ coerceTypes: 'array', strict: false, removeAdditional: true });
8
+ // `pattern`/`patternProperties` compile a RegExp from untrusted Actor / proxied-MCP input schemas;
9
+ // a catastrophic-backtracking pattern freezes the single-threaded event loop (ReDoS). `format` is
10
+ // inert today (ajv-formats is not registered) but would arm the same vector if it ever were. This
11
+ // layer only sanitizes LLM args — the Actor re-validates its real input on the run — so dropping
12
+ // regex enforcement removes the DoS surface with no loss of protection. Consequence for `src/`
13
+ // schemas: a `.regex()` on a Zod field is NOT enforced here. It still reaches `tools/list` and still
14
+ // fires in a tool body's `parse()`, where it throws a raw ZodError at the client instead of a
15
+ // readable error — so rely on the API's own validation rather than adding one. `taskNameSchema`
16
+ // (`tools/tasks/task_helpers.ts`) still carries one and predates this note.
17
+ instance.removeKeyword('pattern');
18
+ instance.removeKeyword('patternProperties');
19
+ instance.removeKeyword('format');
20
+ return instance;
21
+ }
15
22
  /**
16
23
  * Removes the `$schema` property and drops fields with real `default` values from `required`.
17
24
  *
@@ -46,7 +53,7 @@ export function fixZodSchemaRequired(schema) {
46
53
  * and fixing the required array.
47
54
  *
48
55
  * **Unknown properties are silently stripped** by the AJV `removeAdditional: true` option
49
- * (set on the shared `ajv` instance). MCP / LLM clients regularly send extra top-level keys
56
+ * (set in `createAjv`). MCP / LLM clients regularly send extra top-level keys
50
57
  * (client metadata, duplicated hints, transport leftovers) that would otherwise cause validation
51
58
  * failures. Stripping them is safer than allowing them through with `additionalProperties: true`,
52
59
  * because no downstream code should rely on undeclared properties.
@@ -56,6 +63,6 @@ export function fixZodSchemaRequired(schema) {
56
63
  * so they are never subject to this stripping.
57
64
  */
58
65
  export function compileSchema(schema) {
59
- return ajv.compile(fixZodSchemaRequired(schema));
66
+ return createAjv().compile(fixZodSchemaRequired(schema));
60
67
  }
61
68
  //# sourceMappingURL=ajv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../src/utils/ajv.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,CAAC,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OAAO,IAAI,CAAC;YACzE,OAAQ,WAAqC,CAAC,OAAO,KAAK,SAAS,CAAC;QACxE,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,MAA+B;IACzD,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7D,CAAC"}
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "manifest_version": "0.3",
3
3
  "name": "apify-mcp-server",
4
4
  "display_name": "Apify",
5
- "version": "0.20.1",
5
+ "version": "0.20.2",
6
6
  "description": "Extract data from any website with thousands of scrapers, crawlers, and automations on Apify Store.",
7
7
  "long_description": "Apify is the world's largest marketplace of tools for web scraping, crawling, data extraction, and web automation. Get structured data from social media, e-commerce, search engines, maps, travel sites, or any other website.",
8
8
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/actors-mcp-server",
3
- "version": "0.20.1-beta.9",
3
+ "version": "0.20.2-beta.0",
4
4
  "type": "module",
5
5
  "description": "Apify MCP Server",
6
6
  "mcpName": "com.apify/apify-mcp-server",
package/server.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/apify/apify-mcp-server",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.20.1",
9
+ "version": "0.20.2",
10
10
  "remotes": [
11
11
  {
12
12
  "type": "streamable-http",