@ingcreators/annot-mcp 0.1.1 → 0.3.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.
@@ -0,0 +1,29 @@
1
+ import { EncodeOptions } from '@ingcreators/annot-annotator';
2
+ export interface EncodedToolOutput {
3
+ bytes: Uint8Array;
4
+ mimeType: "image/png" | "image/jpeg";
5
+ chosen: "png" | "jpeg";
6
+ width: number;
7
+ height: number;
8
+ reason?: string;
9
+ }
10
+ /**
11
+ * Apply the agent-provided `encode` options to a PNG byte stream
12
+ * the tool just produced. Returns the original bytes verbatim
13
+ * when no options are passed (the fast path for back-compat).
14
+ */
15
+ export declare function applyEncodeOptions(pngBytes: Uint8Array, dimensions: {
16
+ width: number;
17
+ height: number;
18
+ }, encode: Partial<EncodeOptions> | undefined): Promise<EncodedToolOutput>;
19
+ /**
20
+ * Apply the agent-provided `encode` options to RGBA bytes (rather
21
+ * than already-encoded PNG bytes). Used by the annotate tools that
22
+ * go through `annotator.toEncoded()` directly — but currently
23
+ * unused because the tools opt for the "encode the PNG output"
24
+ * path via {@link applyEncodeOptions} for code uniformity.
25
+ *
26
+ * Exported for power callers who want to drive the pipeline
27
+ * themselves.
28
+ */
29
+ export { decodeAndEncodeImage } from '@ingcreators/annot-annotator';
@@ -29,6 +29,10 @@ export declare const annotateScreenshotTool: {
29
29
  readonly type: "string";
30
30
  readonly description: string;
31
31
  };
32
+ readonly encode: {
33
+ readonly $ref: "#/$defs/EncodeOptions";
34
+ readonly description: string;
35
+ };
32
36
  };
33
37
  readonly $defs: {
34
38
  readonly BboxAnnotation: {
@@ -190,6 +194,38 @@ export declare const annotateScreenshotTool: {
190
194
  };
191
195
  })[];
192
196
  };
197
+ readonly EncodeOptions: {
198
+ type: string;
199
+ additionalProperties: boolean;
200
+ properties: {
201
+ format: {
202
+ type: string;
203
+ enum: string[];
204
+ description: string;
205
+ };
206
+ saveSizePreset: {
207
+ type: string;
208
+ enum: string[];
209
+ description: string;
210
+ };
211
+ smartFallback: {
212
+ type: string;
213
+ enum: string[];
214
+ description: string;
215
+ };
216
+ smartColorThreshold: {
217
+ type: string;
218
+ minimum: number;
219
+ description: string;
220
+ };
221
+ jpegPercent: {
222
+ type: string;
223
+ minimum: number;
224
+ maximum: number;
225
+ description: string;
226
+ };
227
+ };
228
+ };
193
229
  readonly Locator: {
194
230
  type: string;
195
231
  minLength: number;
@@ -268,6 +304,7 @@ interface AnnotateScreenshotInput {
268
304
  image?: unknown;
269
305
  annotations?: unknown;
270
306
  output?: unknown;
307
+ encode?: unknown;
271
308
  }
272
309
  /** MCP `tools/call` result content block. */
273
310
  type ContentBlock = {
@@ -58,6 +58,10 @@ export declare const annotateUrlTool: {
58
58
  readonly type: "string";
59
59
  readonly description: string;
60
60
  };
61
+ readonly encode: {
62
+ readonly $ref: "#/$defs/EncodeOptions";
63
+ readonly description: string;
64
+ };
61
65
  };
62
66
  readonly $defs: {
63
67
  readonly LocatorAnnotation: {
@@ -259,6 +263,38 @@ export declare const annotateUrlTool: {
259
263
  };
260
264
  })[];
261
265
  };
266
+ readonly EncodeOptions: {
267
+ type: string;
268
+ additionalProperties: boolean;
269
+ properties: {
270
+ format: {
271
+ type: string;
272
+ enum: string[];
273
+ description: string;
274
+ };
275
+ saveSizePreset: {
276
+ type: string;
277
+ enum: string[];
278
+ description: string;
279
+ };
280
+ smartFallback: {
281
+ type: string;
282
+ enum: string[];
283
+ description: string;
284
+ };
285
+ smartColorThreshold: {
286
+ type: string;
287
+ minimum: number;
288
+ description: string;
289
+ };
290
+ jpegPercent: {
291
+ type: string;
292
+ minimum: number;
293
+ maximum: number;
294
+ description: string;
295
+ };
296
+ };
297
+ };
262
298
  readonly Locator: {
263
299
  type: string;
264
300
  minLength: number;
@@ -337,6 +373,7 @@ interface AnnotateUrlInput {
337
373
  fullPage?: unknown;
338
374
  waitFor?: unknown;
339
375
  output?: unknown;
376
+ encode?: unknown;
340
377
  }
341
378
  export declare function handleAnnotateUrl(input: AnnotateUrlInput, deps: AnnotateUrlDeps): Promise<AnnotateToolResult>;
342
379
  export {};
@@ -0,0 +1,73 @@
1
+ import { BrowserPool } from '../browser/pool.js';
2
+ import { AnnotateToolResult } from './annotate-screenshot.js';
3
+ export declare const ARIA_SNAPSHOT_TOOL_NAME = "annot_aria_snapshot";
4
+ export declare const ariaSnapshotTool: {
5
+ readonly name: "annot_aria_snapshot";
6
+ readonly description: string;
7
+ readonly inputSchema: {
8
+ readonly type: "object";
9
+ readonly required: readonly ["url"];
10
+ readonly additionalProperties: false;
11
+ readonly properties: {
12
+ readonly url: {
13
+ readonly type: "string";
14
+ readonly format: "uri";
15
+ readonly description: "Page URL to snapshot.";
16
+ };
17
+ readonly viewport: {
18
+ readonly type: "object";
19
+ readonly additionalProperties: false;
20
+ readonly properties: {
21
+ readonly width: {
22
+ readonly type: "integer";
23
+ readonly minimum: 1;
24
+ readonly default: 1280;
25
+ };
26
+ readonly height: {
27
+ readonly type: "integer";
28
+ readonly minimum: 1;
29
+ readonly default: 800;
30
+ };
31
+ readonly deviceScaleFactor: {
32
+ readonly type: "number";
33
+ readonly minimum: 0.1;
34
+ readonly default: 1;
35
+ };
36
+ };
37
+ readonly description: "Viewport size. Default 1280×800 at 1× device pixel ratio.";
38
+ };
39
+ readonly waitFor: {
40
+ readonly type: "string";
41
+ readonly enum: readonly ["load", "domcontentloaded", "networkidle"];
42
+ readonly default: "load";
43
+ readonly description: "Page event to await before snapshotting.";
44
+ };
45
+ readonly rootSelector: {
46
+ readonly type: "string";
47
+ readonly default: "body";
48
+ readonly description: string;
49
+ };
50
+ readonly timeout: {
51
+ readonly type: "integer";
52
+ readonly minimum: 0;
53
+ readonly description: string;
54
+ };
55
+ readonly output: {
56
+ readonly type: "string";
57
+ readonly description: string;
58
+ };
59
+ };
60
+ };
61
+ };
62
+ export interface AriaSnapshotToolDeps {
63
+ pool: BrowserPool;
64
+ }
65
+ export interface AriaSnapshotToolInput {
66
+ url?: unknown;
67
+ viewport?: unknown;
68
+ waitFor?: unknown;
69
+ rootSelector?: unknown;
70
+ timeout?: unknown;
71
+ output?: unknown;
72
+ }
73
+ export declare function handleAriaSnapshot(args: AriaSnapshotToolInput, deps: AriaSnapshotToolDeps): Promise<AnnotateToolResult>;
@@ -32,6 +32,43 @@ export declare const compareScreenshotsTool: {
32
32
  readonly output: {
33
33
  readonly type: "string";
34
34
  };
35
+ readonly encode: {
36
+ readonly $ref: "#/$defs/EncodeOptions";
37
+ };
38
+ };
39
+ readonly $defs: {
40
+ readonly EncodeOptions: {
41
+ type: string;
42
+ additionalProperties: boolean;
43
+ properties: {
44
+ format: {
45
+ type: string;
46
+ enum: string[];
47
+ description: string;
48
+ };
49
+ saveSizePreset: {
50
+ type: string;
51
+ enum: string[];
52
+ description: string;
53
+ };
54
+ smartFallback: {
55
+ type: string;
56
+ enum: string[];
57
+ description: string;
58
+ };
59
+ smartColorThreshold: {
60
+ type: string;
61
+ minimum: number;
62
+ description: string;
63
+ };
64
+ jpegPercent: {
65
+ type: string;
66
+ minimum: number;
67
+ maximum: number;
68
+ description: string;
69
+ };
70
+ };
71
+ };
35
72
  };
36
73
  };
37
74
  };
@@ -44,6 +81,7 @@ interface CompareScreenshotsInput {
44
81
  threshold?: unknown;
45
82
  includeChangeList?: unknown;
46
83
  output?: unknown;
84
+ encode?: unknown;
47
85
  }
48
86
  export declare function handleCompareScreenshots(input: CompareScreenshotsInput, deps: CompareScreenshotsDeps): Promise<AnnotateToolResult>;
49
87
  export {};
@@ -0,0 +1,75 @@
1
+ import { BrowserPool } from '../browser/pool.js';
2
+ import { AnnotateToolResult } from './annotate-screenshot.js';
3
+ export declare const DRAFT_SCREEN_SPEC_TOOL_NAME = "annot_draft_screen_spec";
4
+ export declare const draftScreenSpecTool: {
5
+ readonly name: "annot_draft_screen_spec";
6
+ readonly description: string;
7
+ readonly inputSchema: {
8
+ readonly type: "object";
9
+ readonly required: readonly ["url", "id"];
10
+ readonly additionalProperties: false;
11
+ readonly properties: {
12
+ readonly url: {
13
+ readonly type: "string";
14
+ readonly format: "uri";
15
+ readonly description: "Page URL to draft from.";
16
+ };
17
+ readonly id: {
18
+ readonly type: "string";
19
+ readonly description: "Screen ID — used as the MDX frontmatter `annot.id` and as the `<Screen id>` prop.";
20
+ };
21
+ readonly title: {
22
+ readonly type: "string";
23
+ readonly description: "Optional screen title (frontmatter `annot.title`).";
24
+ };
25
+ readonly book: {
26
+ readonly type: "string";
27
+ readonly description: "Optional book name (frontmatter `xlsx.book`).";
28
+ };
29
+ readonly screenImageSrc: {
30
+ readonly type: "string";
31
+ readonly default: "./shots/{id}.png";
32
+ readonly description: string;
33
+ };
34
+ readonly viewport: {
35
+ readonly type: "object";
36
+ readonly additionalProperties: false;
37
+ readonly properties: {
38
+ readonly width: {
39
+ readonly type: "integer";
40
+ readonly minimum: 1;
41
+ readonly default: 1280;
42
+ };
43
+ readonly height: {
44
+ readonly type: "integer";
45
+ readonly minimum: 1;
46
+ readonly default: 800;
47
+ };
48
+ readonly deviceScaleFactor: {
49
+ readonly type: "number";
50
+ readonly minimum: 0.1;
51
+ readonly default: 1;
52
+ };
53
+ };
54
+ };
55
+ readonly waitFor: {
56
+ readonly type: "string";
57
+ readonly enum: readonly ["load", "domcontentloaded", "networkidle"];
58
+ readonly default: "load";
59
+ };
60
+ };
61
+ };
62
+ };
63
+ export interface DraftScreenSpecToolDeps {
64
+ pool: BrowserPool;
65
+ }
66
+ export interface DraftScreenSpecToolInput {
67
+ url?: unknown;
68
+ id?: unknown;
69
+ title?: unknown;
70
+ book?: unknown;
71
+ screenImageSrc?: unknown;
72
+ viewport?: unknown;
73
+ waitFor?: unknown;
74
+ }
75
+ export declare function handleDraftScreenSpec(args: DraftScreenSpecToolInput, deps: DraftScreenSpecToolDeps): Promise<AnnotateToolResult>;
@@ -0,0 +1,64 @@
1
+ import { BrowserPool } from '../browser/pool.js';
2
+ import { AnnotateToolResult } from './annotate-screenshot.js';
3
+ export declare const PROPOSE_DRIFT_FIXES_TOOL_NAME = "annot_propose_drift_fixes";
4
+ export declare const proposeDriftFixesTool: {
5
+ readonly name: "annot_propose_drift_fixes";
6
+ readonly description: string;
7
+ readonly inputSchema: {
8
+ readonly type: "object";
9
+ readonly required: readonly ["mdxPath", "url"];
10
+ readonly additionalProperties: false;
11
+ readonly properties: {
12
+ readonly mdxPath: {
13
+ readonly type: "string";
14
+ readonly description: "Absolute or cwd-relative path to the `.mdx` file with `annot:` frontmatter.";
15
+ };
16
+ readonly url: {
17
+ readonly type: "string";
18
+ readonly format: "uri";
19
+ readonly description: "URL to navigate to for the live snapshot.";
20
+ };
21
+ readonly screenId: {
22
+ readonly type: "string";
23
+ readonly description: "Optional `<Screen id>` filter. Default: run drift against every screen in the MDX.";
24
+ };
25
+ readonly viewport: {
26
+ readonly type: "object";
27
+ readonly additionalProperties: false;
28
+ readonly properties: {
29
+ readonly width: {
30
+ readonly type: "integer";
31
+ readonly minimum: 1;
32
+ readonly default: 1280;
33
+ };
34
+ readonly height: {
35
+ readonly type: "integer";
36
+ readonly minimum: 1;
37
+ readonly default: 800;
38
+ };
39
+ readonly deviceScaleFactor: {
40
+ readonly type: "number";
41
+ readonly minimum: 0.1;
42
+ readonly default: 1;
43
+ };
44
+ };
45
+ };
46
+ readonly waitFor: {
47
+ readonly type: "string";
48
+ readonly enum: readonly ["load", "domcontentloaded", "networkidle"];
49
+ readonly default: "load";
50
+ };
51
+ };
52
+ };
53
+ };
54
+ export interface ProposeDriftFixesToolDeps {
55
+ pool: BrowserPool;
56
+ }
57
+ export interface ProposeDriftFixesToolInput {
58
+ mdxPath?: unknown;
59
+ url?: unknown;
60
+ screenId?: unknown;
61
+ viewport?: unknown;
62
+ waitFor?: unknown;
63
+ }
64
+ export declare function handleProposeDriftFixes(args: ProposeDriftFixesToolInput, deps: ProposeDriftFixesToolDeps): Promise<AnnotateToolResult>;
@@ -21,6 +21,10 @@ export declare const redactScreenshotTool: {
21
21
  readonly output: {
22
22
  readonly type: "string";
23
23
  };
24
+ readonly encode: {
25
+ readonly $ref: "#/$defs/EncodeOptions";
26
+ readonly description: string;
27
+ };
24
28
  };
25
29
  readonly $defs: {
26
30
  readonly BboxRedactRegion: {
@@ -40,6 +44,38 @@ export declare const redactScreenshotTool: {
40
44
  };
41
45
  };
42
46
  };
47
+ readonly EncodeOptions: {
48
+ type: string;
49
+ additionalProperties: boolean;
50
+ properties: {
51
+ format: {
52
+ type: string;
53
+ enum: string[];
54
+ description: string;
55
+ };
56
+ saveSizePreset: {
57
+ type: string;
58
+ enum: string[];
59
+ description: string;
60
+ };
61
+ smartFallback: {
62
+ type: string;
63
+ enum: string[];
64
+ description: string;
65
+ };
66
+ smartColorThreshold: {
67
+ type: string;
68
+ minimum: number;
69
+ description: string;
70
+ };
71
+ jpegPercent: {
72
+ type: string;
73
+ minimum: number;
74
+ maximum: number;
75
+ description: string;
76
+ };
77
+ };
78
+ };
43
79
  readonly Locator: {
44
80
  type: string;
45
81
  minLength: number;
@@ -111,6 +147,7 @@ interface RedactScreenshotInput {
111
147
  image?: unknown;
112
148
  regions?: unknown;
113
149
  output?: unknown;
150
+ encode?: unknown;
114
151
  }
115
152
  export declare function handleRedactScreenshot(input: RedactScreenshotInput): Promise<AnnotateToolResult>;
116
153
  export {};
@@ -53,6 +53,9 @@ export declare const redactUrlTool: {
53
53
  readonly output: {
54
54
  readonly type: "string";
55
55
  };
56
+ readonly encode: {
57
+ readonly $ref: "#/$defs/EncodeOptions";
58
+ };
56
59
  };
57
60
  readonly $defs: {
58
61
  readonly LocatorRedactRegion: {
@@ -77,6 +80,38 @@ export declare const redactUrlTool: {
77
80
  required: string[];
78
81
  }[];
79
82
  };
83
+ readonly EncodeOptions: {
84
+ type: string;
85
+ additionalProperties: boolean;
86
+ properties: {
87
+ format: {
88
+ type: string;
89
+ enum: string[];
90
+ description: string;
91
+ };
92
+ saveSizePreset: {
93
+ type: string;
94
+ enum: string[];
95
+ description: string;
96
+ };
97
+ smartFallback: {
98
+ type: string;
99
+ enum: string[];
100
+ description: string;
101
+ };
102
+ smartColorThreshold: {
103
+ type: string;
104
+ minimum: number;
105
+ description: string;
106
+ };
107
+ jpegPercent: {
108
+ type: string;
109
+ minimum: number;
110
+ maximum: number;
111
+ description: string;
112
+ };
113
+ };
114
+ };
80
115
  readonly Locator: {
81
116
  type: string;
82
117
  minLength: number;
@@ -154,6 +189,7 @@ interface RedactUrlInput {
154
189
  fullPage?: unknown;
155
190
  waitFor?: unknown;
156
191
  output?: unknown;
192
+ encode?: unknown;
157
193
  }
158
194
  export declare function handleRedactUrl(input: RedactUrlInput, deps: RedactUrlDeps): Promise<AnnotateToolResult>;
159
195
  export type RedactRegionStyle = RedactStyle;
@@ -0,0 +1,31 @@
1
+ import { AnnotateToolResult } from './annotate-screenshot.js';
2
+ export declare const TRANSLATE_SCREEN_SPEC_TOOL_NAME = "annot_translate_screen_spec";
3
+ export declare const translateScreenSpecTool: {
4
+ readonly name: "annot_translate_screen_spec";
5
+ readonly description: string;
6
+ readonly inputSchema: {
7
+ readonly type: "object";
8
+ readonly required: readonly ["mdxPath", "targetLocale"];
9
+ readonly additionalProperties: false;
10
+ readonly properties: {
11
+ readonly mdxPath: {
12
+ readonly type: "string";
13
+ readonly description: "Absolute or cwd-relative path to the source `.mdx`.";
14
+ };
15
+ readonly sourceLocale: {
16
+ readonly type: "string";
17
+ readonly description: string;
18
+ };
19
+ readonly targetLocale: {
20
+ readonly type: "string";
21
+ readonly description: "BCP-47 locale tag of the locale to produce (e.g. `en-US`).";
22
+ };
23
+ };
24
+ };
25
+ };
26
+ export interface TranslateScreenSpecToolInput {
27
+ mdxPath?: unknown;
28
+ sourceLocale?: unknown;
29
+ targetLocale?: unknown;
30
+ }
31
+ export declare function handleTranslateScreenSpec(args: TranslateScreenSpecToolInput): Promise<AnnotateToolResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ingcreators/annot-mcp",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Model Context Protocol server exposing the Annot headless annotator as agent-callable tools. Drop into Claude Desktop / Claude Code / Cursor and let an AI agent compose Annot with @playwright/mcp + GitHub MCP for one-turn bug-report autopilot, visual-diff PR review, and locator-first annotation workflows.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ingcreators",
@@ -46,17 +46,18 @@
46
46
  "access": "public"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/node": "^25.9.0",
49
+ "@types/node": "^25.9.1",
50
50
  "typescript": "^6.0.3",
51
- "vite": "^6.4.2",
52
- "vite-plugin-dts": "^5.0.0"
51
+ "vite": "^8.0.13",
52
+ "vite-plugin-dts": "^5.0.1"
53
53
  },
54
54
  "dependencies": {
55
55
  "@modelcontextprotocol/sdk": "^1.0.0",
56
- "@napi-rs/canvas": "^0.1.0",
56
+ "@napi-rs/canvas": "^1.0.0",
57
57
  "pixelmatch": "^7.1.0",
58
58
  "playwright-core": "^1.50.0",
59
- "@ingcreators/annot-annotator": "0.2.0"
59
+ "@ingcreators/annot-annotator": "0.5.0",
60
+ "@ingcreators/annot-product-docs": "0.2.0"
60
61
  },
61
62
  "scripts": {
62
63
  "build": "vite build",