@keak/webmcp-core 0.1.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.
- package/LICENSE +21 -0
- package/README.md +165 -0
- package/dist/config.d.ts +103 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +54 -0
- package/dist/config.js.map +1 -0
- package/dist/exporter/manifest.d.ts +6 -0
- package/dist/exporter/manifest.d.ts.map +1 -0
- package/dist/exporter/manifest.js +36 -0
- package/dist/exporter/manifest.js.map +1 -0
- package/dist/exporter/snippet.d.ts +7 -0
- package/dist/exporter/snippet.d.ts.map +1 -0
- package/dist/exporter/snippet.js +197 -0
- package/dist/exporter/snippet.js.map +1 -0
- package/dist/exporter/userscript.d.ts +6 -0
- package/dist/exporter/userscript.d.ts.map +1 -0
- package/dist/exporter/userscript.js +53 -0
- package/dist/exporter/userscript.js.map +1 -0
- package/dist/exporter/yaml.d.ts +6 -0
- package/dist/exporter/yaml.d.ts.map +1 -0
- package/dist/exporter/yaml.js +90 -0
- package/dist/exporter/yaml.js.map +1 -0
- package/dist/extractor/api-extractor.d.ts +3 -0
- package/dist/extractor/api-extractor.d.ts.map +1 -0
- package/dist/extractor/api-extractor.js +274 -0
- package/dist/extractor/api-extractor.js.map +1 -0
- package/dist/extractor/click-extractor.d.ts +3 -0
- package/dist/extractor/click-extractor.d.ts.map +1 -0
- package/dist/extractor/click-extractor.js +52 -0
- package/dist/extractor/click-extractor.js.map +1 -0
- package/dist/extractor/form-extractor.d.ts +3 -0
- package/dist/extractor/form-extractor.d.ts.map +1 -0
- package/dist/extractor/form-extractor.js +27 -0
- package/dist/extractor/form-extractor.js.map +1 -0
- package/dist/extractor/route-extractor.d.ts +3 -0
- package/dist/extractor/route-extractor.d.ts.map +1 -0
- package/dist/extractor/route-extractor.js +84 -0
- package/dist/extractor/route-extractor.js.map +1 -0
- package/dist/extractor/schema-inferrer.d.ts +4 -0
- package/dist/extractor/schema-inferrer.d.ts.map +1 -0
- package/dist/extractor/schema-inferrer.js +128 -0
- package/dist/extractor/schema-inferrer.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +170 -0
- package/dist/index.js.map +1 -0
- package/dist/linter/linter.d.ts +10 -0
- package/dist/linter/linter.d.ts.map +1 -0
- package/dist/linter/linter.js +39 -0
- package/dist/linter/linter.js.map +1 -0
- package/dist/linter/rules.d.ts +4 -0
- package/dist/linter/rules.d.ts.map +1 -0
- package/dist/linter/rules.js +111 -0
- package/dist/linter/rules.js.map +1 -0
- package/dist/scanner/browser.d.ts +14 -0
- package/dist/scanner/browser.d.ts.map +1 -0
- package/dist/scanner/browser.js +42 -0
- package/dist/scanner/browser.js.map +1 -0
- package/dist/scanner/crawler.d.ts +12 -0
- package/dist/scanner/crawler.d.ts.map +1 -0
- package/dist/scanner/crawler.js +80 -0
- package/dist/scanner/crawler.js.map +1 -0
- package/dist/scanner/dom-capture.d.ts +4 -0
- package/dist/scanner/dom-capture.d.ts.map +1 -0
- package/dist/scanner/dom-capture.js +148 -0
- package/dist/scanner/dom-capture.js.map +1 -0
- package/dist/scanner/network-capture.d.ts +8 -0
- package/dist/scanner/network-capture.d.ts.map +1 -0
- package/dist/scanner/network-capture.js +112 -0
- package/dist/scanner/network-capture.js.map +1 -0
- package/dist/scanner/screenshot.d.ts +3 -0
- package/dist/scanner/screenshot.d.ts.map +1 -0
- package/dist/scanner/screenshot.js +10 -0
- package/dist/scanner/screenshot.js.map +1 -0
- package/dist/synthesizer/clusterer.d.ts +7 -0
- package/dist/synthesizer/clusterer.d.ts.map +1 -0
- package/dist/synthesizer/clusterer.js +310 -0
- package/dist/synthesizer/clusterer.js.map +1 -0
- package/dist/synthesizer/describer.d.ts +3 -0
- package/dist/synthesizer/describer.d.ts.map +1 -0
- package/dist/synthesizer/describer.js +92 -0
- package/dist/synthesizer/describer.js.map +1 -0
- package/dist/synthesizer/llm-client.d.ts +7 -0
- package/dist/synthesizer/llm-client.d.ts.map +1 -0
- package/dist/synthesizer/llm-client.js +7 -0
- package/dist/synthesizer/llm-client.js.map +1 -0
- package/dist/synthesizer/namer.d.ts +3 -0
- package/dist/synthesizer/namer.d.ts.map +1 -0
- package/dist/synthesizer/namer.js +154 -0
- package/dist/synthesizer/namer.js.map +1 -0
- package/dist/synthesizer/safety-classifier.d.ts +3 -0
- package/dist/synthesizer/safety-classifier.d.ts.map +1 -0
- package/dist/synthesizer/safety-classifier.js +68 -0
- package/dist/synthesizer/safety-classifier.js.map +1 -0
- package/dist/synthesizer/schema-builder.d.ts +3 -0
- package/dist/synthesizer/schema-builder.d.ts.map +1 -0
- package/dist/synthesizer/schema-builder.js +99 -0
- package/dist/synthesizer/schema-builder.js.map +1 -0
- package/dist/types.d.ts +271 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/redact.d.ts +3 -0
- package/dist/utils/redact.d.ts.map +1 -0
- package/dist/utils/redact.js +42 -0
- package/dist/utils/redact.js.map +1 -0
- package/dist/utils/validation.d.ts +876 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +108 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Keak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# @keak/webmcp-core
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@keak/webmcp-core)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
|
|
8
|
+
Auto-generate [WebMCP](https://nicholasc.au/2025/05/02/webmcp.html) tool definitions from any website. Scan interactive elements, propose tool definitions for AI agents, and export in multiple formats.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @keak/webmcp-core
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Playwright is an optional peer dependency — only required if you use `scanUrl()` or `generateToolDefinitions()`:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install playwright
|
|
20
|
+
npx playwright install chromium
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { generateToolDefinitions } from "@keak/webmcp-core";
|
|
27
|
+
|
|
28
|
+
const tools = await generateToolDefinitions("https://example.com", {
|
|
29
|
+
depth: 2,
|
|
30
|
+
headless: true,
|
|
31
|
+
minConfidence: 0.5,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
for (const tool of tools) {
|
|
35
|
+
console.log(`${tool.name}: ${tool.description}`);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- **Page scanning** — BFS crawl with Playwright, capturing forms, buttons, links, and network calls
|
|
42
|
+
- **Action extraction** — Identifies form submissions, API calls, click flows, and route changes
|
|
43
|
+
- **Tool synthesis** — Clusters related actions into named, described tool definitions with input schemas
|
|
44
|
+
- **Safety classification** — Tags each tool as `read`, `write`, or `danger` based on its behavior
|
|
45
|
+
- **Linting** — Validates naming conventions, descriptions, schemas, and safety annotations
|
|
46
|
+
- **Multiple export formats** — TypeScript snippets, JSON manifests, Tampermonkey userscripts, YAML configs
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
### `generateToolDefinitions(url, options?)`
|
|
51
|
+
|
|
52
|
+
Scan a URL and generate tool definitions in a single call. Combines `scanUrl` + `proposeTools`.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const tools = await generateToolDefinitions("https://shop.example.com", {
|
|
56
|
+
depth: 3,
|
|
57
|
+
timeout: 15000,
|
|
58
|
+
minConfidence: 0.6,
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### `scanUrl(options)`
|
|
63
|
+
|
|
64
|
+
Scan a website and capture DOM snapshots, network calls, and page metadata.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const result = await scanUrl({
|
|
68
|
+
url: "https://example.com",
|
|
69
|
+
depth: 2,
|
|
70
|
+
headless: true,
|
|
71
|
+
onProgress: (event) => console.log(event.type, event.url),
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### `proposeTools(scanResult, options?)`
|
|
76
|
+
|
|
77
|
+
Extract actions from scan data and cluster them into tool definitions.
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
const tools = proposeTools(scanResult, { minConfidence: 0.5 });
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `exportTools(tools, format, options?)`
|
|
84
|
+
|
|
85
|
+
Export tool definitions in a specific format.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
const result = exportTools(tools, "manifest", { domain: "example.com" });
|
|
89
|
+
fs.writeFileSync("webmcp.manifest.json", result.files[0].content);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `lintTools(tools)`
|
|
93
|
+
|
|
94
|
+
Run lint rules against tool definitions to catch common issues.
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import { lintTools, lintSummary } from "@keak/webmcp-core";
|
|
98
|
+
|
|
99
|
+
const results = lintTools(tools);
|
|
100
|
+
const summary = lintSummary(results);
|
|
101
|
+
console.log(`${summary.errors} errors, ${summary.warnings} warnings`);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Export Formats
|
|
105
|
+
|
|
106
|
+
| Format | Output | Use Case |
|
|
107
|
+
|--------|--------|----------|
|
|
108
|
+
| `snippet` | `webmcp.tools.ts` | Drop-in `navigator.modelContext.registerTool()` code |
|
|
109
|
+
| `manifest` | `webmcp.manifest.json` | Platform upload / API integration |
|
|
110
|
+
| `userscript` | `webmcp.*.user.js` | Tampermonkey / Greasemonkey script |
|
|
111
|
+
| `yaml` | `webmcp.tools.yaml` | Human-readable config |
|
|
112
|
+
|
|
113
|
+
## Architecture
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
src/
|
|
117
|
+
├── scanner/ Playwright-based page crawling and DOM capture
|
|
118
|
+
├── extractor/ Action extraction (forms, APIs, clicks, routes)
|
|
119
|
+
├── synthesizer/ Clustering, naming, description, safety, schemas
|
|
120
|
+
├── exporter/ Output format generators
|
|
121
|
+
├── linter/ Lint rules for tool quality
|
|
122
|
+
└── utils/ Validation schemas and PII redaction
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Pipeline:** `scanUrl` → extractors → `clusterActions` → `ToolSpec[]` → `exportTools`
|
|
126
|
+
|
|
127
|
+
## Tool Definition Shape
|
|
128
|
+
|
|
129
|
+
Each generated tool follows the `ToolSpec` interface:
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
interface ToolSpec {
|
|
133
|
+
id: string;
|
|
134
|
+
name: string; // snake_case: "site_search_products"
|
|
135
|
+
description: string; // "Search products by keyword"
|
|
136
|
+
inputSchema: JsonSchema; // JSON Schema for tool parameters
|
|
137
|
+
safety: { level: "read" | "write" | "danger"; requiresConfirm: boolean };
|
|
138
|
+
availability: { urlPatterns: string[]; requiresAuth: boolean };
|
|
139
|
+
implementation: {
|
|
140
|
+
kind: "js_handler" | "form_declarative";
|
|
141
|
+
handlerTemplate?: HandlerTemplate;
|
|
142
|
+
form?: { formSelector: string; toolautosubmit?: boolean };
|
|
143
|
+
};
|
|
144
|
+
provenance: { actions: string[]; confidence: number; pageUrl: string };
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Requirements
|
|
149
|
+
|
|
150
|
+
- **Node.js** >= 18
|
|
151
|
+
- **Playwright** >= 1.49 (optional peer dep, only needed for scanning)
|
|
152
|
+
- **TypeScript** >= 5.7 (for development)
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
|
|
156
|
+
Contributions are welcome! Please open an issue first to discuss what you'd like to change.
|
|
157
|
+
|
|
158
|
+
1. Fork the repository
|
|
159
|
+
2. Create your branch: `git checkout -b my-feature`
|
|
160
|
+
3. Make your changes and run `npm run lint`
|
|
161
|
+
4. Submit a pull request
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
[MIT](LICENSE)
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AutogenConfig } from "./types.js";
|
|
3
|
+
export declare const AutogenConfigSchema: z.ZodObject<{
|
|
4
|
+
baseUrl: z.ZodString;
|
|
5
|
+
auth: z.ZodObject<{
|
|
6
|
+
method: z.ZodEnum<["none", "cookie", "browser-login"]>;
|
|
7
|
+
profilePath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
cookie: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
method: "none" | "cookie" | "browser-login";
|
|
11
|
+
cookie?: string | null | undefined;
|
|
12
|
+
profilePath?: string | null | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
method: "none" | "cookie" | "browser-login";
|
|
15
|
+
cookie?: string | null | undefined;
|
|
16
|
+
profilePath?: string | null | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
output: z.ZodObject<{
|
|
19
|
+
target: z.ZodEnum<["snippet", "userscript", "manifest", "yaml"]>;
|
|
20
|
+
lang: z.ZodEnum<["ts", "js"]>;
|
|
21
|
+
outDir: z.ZodString;
|
|
22
|
+
framework: z.ZodEnum<["vanilla", "react", "vue"]>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
target: "snippet" | "userscript" | "manifest" | "yaml";
|
|
25
|
+
lang: "ts" | "js";
|
|
26
|
+
outDir: string;
|
|
27
|
+
framework: "vanilla" | "react" | "vue";
|
|
28
|
+
}, {
|
|
29
|
+
target: "snippet" | "userscript" | "manifest" | "yaml";
|
|
30
|
+
lang: "ts" | "js";
|
|
31
|
+
outDir: string;
|
|
32
|
+
framework: "vanilla" | "react" | "vue";
|
|
33
|
+
}>;
|
|
34
|
+
browser: z.ZodObject<{
|
|
35
|
+
executablePath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
|
+
headless: z.ZodBoolean;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
headless: boolean;
|
|
39
|
+
executablePath?: string | null | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
headless: boolean;
|
|
42
|
+
executablePath?: string | null | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
scan: z.ZodObject<{
|
|
45
|
+
depth: z.ZodNumber;
|
|
46
|
+
ignore: z.ZodArray<z.ZodString, "many">;
|
|
47
|
+
timeout: z.ZodNumber;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
depth: number;
|
|
50
|
+
ignore: string[];
|
|
51
|
+
timeout: number;
|
|
52
|
+
}, {
|
|
53
|
+
depth: number;
|
|
54
|
+
ignore: string[];
|
|
55
|
+
timeout: number;
|
|
56
|
+
}>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
baseUrl: string;
|
|
59
|
+
auth: {
|
|
60
|
+
method: "none" | "cookie" | "browser-login";
|
|
61
|
+
cookie?: string | null | undefined;
|
|
62
|
+
profilePath?: string | null | undefined;
|
|
63
|
+
};
|
|
64
|
+
output: {
|
|
65
|
+
target: "snippet" | "userscript" | "manifest" | "yaml";
|
|
66
|
+
lang: "ts" | "js";
|
|
67
|
+
outDir: string;
|
|
68
|
+
framework: "vanilla" | "react" | "vue";
|
|
69
|
+
};
|
|
70
|
+
browser: {
|
|
71
|
+
headless: boolean;
|
|
72
|
+
executablePath?: string | null | undefined;
|
|
73
|
+
};
|
|
74
|
+
scan: {
|
|
75
|
+
depth: number;
|
|
76
|
+
ignore: string[];
|
|
77
|
+
timeout: number;
|
|
78
|
+
};
|
|
79
|
+
}, {
|
|
80
|
+
baseUrl: string;
|
|
81
|
+
auth: {
|
|
82
|
+
method: "none" | "cookie" | "browser-login";
|
|
83
|
+
cookie?: string | null | undefined;
|
|
84
|
+
profilePath?: string | null | undefined;
|
|
85
|
+
};
|
|
86
|
+
output: {
|
|
87
|
+
target: "snippet" | "userscript" | "manifest" | "yaml";
|
|
88
|
+
lang: "ts" | "js";
|
|
89
|
+
outDir: string;
|
|
90
|
+
framework: "vanilla" | "react" | "vue";
|
|
91
|
+
};
|
|
92
|
+
browser: {
|
|
93
|
+
headless: boolean;
|
|
94
|
+
executablePath?: string | null | undefined;
|
|
95
|
+
};
|
|
96
|
+
scan: {
|
|
97
|
+
depth: number;
|
|
98
|
+
ignore: string[];
|
|
99
|
+
timeout: number;
|
|
100
|
+
};
|
|
101
|
+
}>;
|
|
102
|
+
export declare function getDefaultConfig(baseUrl?: string): AutogenConfig;
|
|
103
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsB9B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,MAA8B,GAAG,aAAa,CAwBvF"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutogenConfigSchema = void 0;
|
|
4
|
+
exports.getDefaultConfig = getDefaultConfig;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.AutogenConfigSchema = zod_1.z.object({
|
|
7
|
+
baseUrl: zod_1.z.string().url(),
|
|
8
|
+
auth: zod_1.z.object({
|
|
9
|
+
method: zod_1.z.enum(["none", "cookie", "browser-login"]),
|
|
10
|
+
profilePath: zod_1.z.string().nullable().optional(),
|
|
11
|
+
cookie: zod_1.z.string().nullable().optional(),
|
|
12
|
+
}),
|
|
13
|
+
output: zod_1.z.object({
|
|
14
|
+
target: zod_1.z.enum(["snippet", "userscript", "manifest", "yaml"]),
|
|
15
|
+
lang: zod_1.z.enum(["ts", "js"]),
|
|
16
|
+
outDir: zod_1.z.string(),
|
|
17
|
+
framework: zod_1.z.enum(["vanilla", "react", "vue"]),
|
|
18
|
+
}),
|
|
19
|
+
browser: zod_1.z.object({
|
|
20
|
+
executablePath: zod_1.z.string().nullable().optional(),
|
|
21
|
+
headless: zod_1.z.boolean(),
|
|
22
|
+
}),
|
|
23
|
+
scan: zod_1.z.object({
|
|
24
|
+
depth: zod_1.z.number().int().min(1).max(10),
|
|
25
|
+
ignore: zod_1.z.array(zod_1.z.string()),
|
|
26
|
+
timeout: zod_1.z.number().int().min(1000),
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
function getDefaultConfig(baseUrl = "https://example.com") {
|
|
30
|
+
return {
|
|
31
|
+
baseUrl,
|
|
32
|
+
auth: {
|
|
33
|
+
method: "none",
|
|
34
|
+
profilePath: null,
|
|
35
|
+
cookie: null,
|
|
36
|
+
},
|
|
37
|
+
output: {
|
|
38
|
+
target: "snippet",
|
|
39
|
+
lang: "ts",
|
|
40
|
+
outDir: "./webmcp-output",
|
|
41
|
+
framework: "vanilla",
|
|
42
|
+
},
|
|
43
|
+
browser: {
|
|
44
|
+
executablePath: null,
|
|
45
|
+
headless: true,
|
|
46
|
+
},
|
|
47
|
+
scan: {
|
|
48
|
+
depth: 2,
|
|
49
|
+
ignore: [],
|
|
50
|
+
timeout: 30000,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AA2BA,4CAwBC;AAnDD,6BAAwB;AAGX,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACzB,IAAI,EAAE,OAAC,CAAC,MAAM,CAAC;QACb,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAA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AI;YACjB,MAAM,EAAE,IAAI;SACb;QACD,MAAM,EAAE;YACN,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,iBAAiB;YACzB,SAAS,EAAE,SAAS;SACrB;QACD,OAAO,EAAE;YACP,cAAc,EAAE,IAAI;YACpB,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,KAAK;SACf;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/exporter/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AAEtE,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,QAAQ,EAAE,EACjB,OAAO,EAAE,eAAe,GACvB,YAAY,CAiCd"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateManifest = generateManifest;
|
|
4
|
+
function generateManifest(tools, options) {
|
|
5
|
+
const manifest = {
|
|
6
|
+
$schema: "https://webmcp.dev/schemas/manifest.json",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
domain: options.domain,
|
|
9
|
+
generatedAt: new Date().toISOString(),
|
|
10
|
+
generatedBy: "webmcp-autogen",
|
|
11
|
+
toolCount: tools.length,
|
|
12
|
+
tools: tools.map((tool) => ({
|
|
13
|
+
id: tool.id,
|
|
14
|
+
name: tool.name,
|
|
15
|
+
description: tool.description,
|
|
16
|
+
inputSchema: tool.inputSchema,
|
|
17
|
+
outputSchema: tool.outputSchema || null,
|
|
18
|
+
safety: tool.safety,
|
|
19
|
+
availability: tool.availability,
|
|
20
|
+
implementation: {
|
|
21
|
+
kind: tool.implementation.kind,
|
|
22
|
+
form: tool.implementation.form || null,
|
|
23
|
+
},
|
|
24
|
+
provenance: tool.provenance,
|
|
25
|
+
})),
|
|
26
|
+
};
|
|
27
|
+
const files = [
|
|
28
|
+
{
|
|
29
|
+
name: "webmcp.manifest.json",
|
|
30
|
+
content: JSON.stringify(manifest, null, 2) + "\n",
|
|
31
|
+
language: "json",
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
return { files, target: "manifest" };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/exporter/manifest.ts"],"names":[],"mappings":";;AAMA,4CAoCC;AApCD,SAAgB,gBAAgB,CAC9B,KAAiB,EACjB,OAAwB;IAExB,MAAM,QAAQ,GAAG;QACf,OAAO,EAAE,0CAA0C;QACnD,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACrC,WAAW,EAAE,gBAAgB;QAC7B,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1B,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI;YACvC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,cAAc,EAAE;gBACd,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI;gBAC9B,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,IAAI,IAAI;aACvC;YACD,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CAAC;KACJ,CAAC;IAEF,MAAM,KAAK,GAAiB;QAC1B;YACE,IAAI,EAAE,sBAAsB;YAC5B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI;YACjD,QAAQ,EAAE,MAAM;SACjB;KACF,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToolSpec, ExportResult, OutputLang } from "../types.js";
|
|
2
|
+
export interface SnippetOptions {
|
|
3
|
+
lang: OutputLang;
|
|
4
|
+
domain: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function generateSnippet(tools: ToolSpec[], options: SnippetOptions): ExportResult;
|
|
7
|
+
//# sourceMappingURL=snippet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../../src/exporter/snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EAEZ,UAAU,EAGX,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,OAAO,EAAE,cAAc,GACtB,YAAY,CAcd"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateSnippet = generateSnippet;
|
|
4
|
+
function generateSnippet(tools, options) {
|
|
5
|
+
const { lang, domain } = options;
|
|
6
|
+
const ext = lang === "ts" ? "ts" : "js";
|
|
7
|
+
const files = [];
|
|
8
|
+
const mainContent = generateMainFile(tools, lang);
|
|
9
|
+
files.push({
|
|
10
|
+
name: `webmcp.tools.${ext}`,
|
|
11
|
+
content: mainContent,
|
|
12
|
+
language: lang === "ts" ? "typescript" : "javascript",
|
|
13
|
+
});
|
|
14
|
+
return { files, target: "snippet" };
|
|
15
|
+
}
|
|
16
|
+
function generateMainFile(tools, lang) {
|
|
17
|
+
const lines = [];
|
|
18
|
+
lines.push("/**");
|
|
19
|
+
lines.push(" * WebMCP Tool Definitions");
|
|
20
|
+
lines.push(" * Auto-generated by webmcp-autogen");
|
|
21
|
+
lines.push(` * Generated: ${new Date().toISOString()}`);
|
|
22
|
+
lines.push(" *");
|
|
23
|
+
lines.push(" * Usage: Include this script on your page to register tools");
|
|
24
|
+
lines.push(" * with the browser's Model Context Protocol.");
|
|
25
|
+
lines.push(" */");
|
|
26
|
+
lines.push("");
|
|
27
|
+
lines.push("// Check for WebMCP API support");
|
|
28
|
+
if (lang === "ts") {
|
|
29
|
+
lines.push("declare global {");
|
|
30
|
+
lines.push(" interface Navigator {");
|
|
31
|
+
lines.push(" modelContext?: {");
|
|
32
|
+
lines.push(" registerTool(def: {");
|
|
33
|
+
lines.push(" name: string;");
|
|
34
|
+
lines.push(" description: string;");
|
|
35
|
+
lines.push(" inputSchema: Record<string, unknown>;");
|
|
36
|
+
lines.push(" handler: (params: Record<string, unknown>) => Promise<unknown>;");
|
|
37
|
+
lines.push(" }): void;");
|
|
38
|
+
lines.push(" unregisterTool(name: string): void;");
|
|
39
|
+
lines.push(" };");
|
|
40
|
+
lines.push(" }");
|
|
41
|
+
lines.push("}");
|
|
42
|
+
lines.push("");
|
|
43
|
+
}
|
|
44
|
+
lines.push("function initWebMCPTools() {");
|
|
45
|
+
lines.push(" if (!navigator.modelContext) {");
|
|
46
|
+
lines.push(' console.warn("[WebMCP] navigator.modelContext not available. Ensure Chrome 146+ with experimental features enabled.");');
|
|
47
|
+
lines.push(" return;");
|
|
48
|
+
lines.push(" }");
|
|
49
|
+
lines.push("");
|
|
50
|
+
for (const tool of tools) {
|
|
51
|
+
lines.push(` // Tool: ${tool.name}`);
|
|
52
|
+
lines.push(` // Safety: ${tool.safety.level}${tool.safety.requiresConfirm ? " (requires confirmation)" : ""}`);
|
|
53
|
+
lines.push(` // Source: ${tool.provenance.pageUrl}`);
|
|
54
|
+
lines.push(" navigator.modelContext.registerTool({");
|
|
55
|
+
lines.push(` name: ${JSON.stringify(tool.name)},`);
|
|
56
|
+
lines.push(` description: ${JSON.stringify(tool.description)},`);
|
|
57
|
+
lines.push(` inputSchema: ${indent(JSON.stringify(tool.inputSchema, null, 2), 4)},`);
|
|
58
|
+
lines.push(` handler: async (params${lang === "ts" ? ": Record<string, unknown>" : ""}) => {`);
|
|
59
|
+
lines.push(...generateHandlerBody(tool, 6));
|
|
60
|
+
lines.push(" },");
|
|
61
|
+
lines.push(" });");
|
|
62
|
+
lines.push("");
|
|
63
|
+
}
|
|
64
|
+
lines.push(` console.log("[WebMCP] Registered ${tools.length} tool${tools.length !== 1 ? "s" : ""}");`);
|
|
65
|
+
lines.push("}");
|
|
66
|
+
lines.push("");
|
|
67
|
+
lines.push("// Initialize when DOM is ready");
|
|
68
|
+
lines.push('if (document.readyState === "loading") {');
|
|
69
|
+
lines.push(' document.addEventListener("DOMContentLoaded", initWebMCPTools);');
|
|
70
|
+
lines.push("} else {");
|
|
71
|
+
lines.push(" initWebMCPTools();");
|
|
72
|
+
lines.push("}");
|
|
73
|
+
lines.push("");
|
|
74
|
+
return lines.join("\n");
|
|
75
|
+
}
|
|
76
|
+
function generateHandlerBody(tool, indentLevel) {
|
|
77
|
+
const lines = [];
|
|
78
|
+
const pad = " ".repeat(indentLevel);
|
|
79
|
+
const template = tool.implementation.handlerTemplate;
|
|
80
|
+
if (!template || !template.steps.length) {
|
|
81
|
+
lines.push(`${pad}// TODO: Implement handler for ${tool.name}`);
|
|
82
|
+
lines.push(`${pad}return { success: true };`);
|
|
83
|
+
return lines;
|
|
84
|
+
}
|
|
85
|
+
for (const step of template.steps) {
|
|
86
|
+
lines.push(...generateStep(step, pad));
|
|
87
|
+
}
|
|
88
|
+
return lines;
|
|
89
|
+
}
|
|
90
|
+
function generateStep(step, pad) {
|
|
91
|
+
const lines = [];
|
|
92
|
+
switch (step.step) {
|
|
93
|
+
case "ensure_page": {
|
|
94
|
+
lines.push(`${pad}// Ensure we're on the right page`);
|
|
95
|
+
lines.push(`${pad}if (!window.location.href.includes(${JSON.stringify(new URL(step.urlPattern).pathname)})) {`);
|
|
96
|
+
lines.push(`${pad} window.location.href = ${JSON.stringify(step.urlPattern)};`);
|
|
97
|
+
lines.push(`${pad} await new Promise(resolve => setTimeout(resolve, 2000));`);
|
|
98
|
+
lines.push(`${pad}}`);
|
|
99
|
+
lines.push("");
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
case "fill_form": {
|
|
103
|
+
lines.push(`${pad}// Fill form fields`);
|
|
104
|
+
lines.push(`${pad}const form = document.querySelector(${JSON.stringify(step.formSelector)});`);
|
|
105
|
+
lines.push(`${pad}if (!form) throw new Error("Form not found: ${step.formSelector}");`);
|
|
106
|
+
lines.push("");
|
|
107
|
+
for (const [fieldName, paramExpr] of Object.entries(step.mapping)) {
|
|
108
|
+
const paramKey = paramExpr.replace("params.", "");
|
|
109
|
+
lines.push(`${pad}const ${safeName(fieldName)}Input = form.querySelector('[name="${fieldName}"]');`);
|
|
110
|
+
lines.push(`${pad}if (${safeName(fieldName)}Input) {`);
|
|
111
|
+
lines.push(`${pad} ${safeName(fieldName)}Input.value = String(params["${paramKey}"] ?? "");`);
|
|
112
|
+
lines.push(`${pad} ${safeName(fieldName)}Input.dispatchEvent(new Event("input", { bubbles: true }));`);
|
|
113
|
+
lines.push(`${pad}}`);
|
|
114
|
+
lines.push("");
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case "click": {
|
|
119
|
+
lines.push(`${pad}// Click element`);
|
|
120
|
+
lines.push(`${pad}const clickTarget = document.querySelector(${JSON.stringify(step.selector)});`);
|
|
121
|
+
lines.push(`${pad}if (clickTarget) {`);
|
|
122
|
+
lines.push(`${pad} (clickTarget as HTMLElement).click();`);
|
|
123
|
+
lines.push(`${pad}}`);
|
|
124
|
+
if (step.waitFor) {
|
|
125
|
+
lines.push(`${pad}await new Promise(resolve => setTimeout(resolve, 1000));`);
|
|
126
|
+
}
|
|
127
|
+
lines.push("");
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case "wait_network": {
|
|
131
|
+
lines.push(`${pad}// Wait for network response`);
|
|
132
|
+
lines.push(`${pad}const response = await new Promise((resolve, reject) => {`);
|
|
133
|
+
lines.push(`${pad} const timeout = setTimeout(() => reject(new Error("Network timeout")), 10000);`);
|
|
134
|
+
lines.push(`${pad} const origFetch = window.fetch;`);
|
|
135
|
+
lines.push(`${pad} window.fetch = async (...args) => {`);
|
|
136
|
+
lines.push(`${pad} const res = await origFetch(...args);`);
|
|
137
|
+
if (step.match.urlIncludes) {
|
|
138
|
+
lines.push(`${pad} if (String(args[0]).includes(${JSON.stringify(step.match.urlIncludes)})) {`);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
lines.push(`${pad} {`);
|
|
142
|
+
}
|
|
143
|
+
lines.push(`${pad} clearTimeout(timeout);`);
|
|
144
|
+
lines.push(`${pad} window.fetch = origFetch;`);
|
|
145
|
+
lines.push(`${pad} resolve(res.clone());`);
|
|
146
|
+
lines.push(`${pad} }`);
|
|
147
|
+
lines.push(`${pad} return res;`);
|
|
148
|
+
lines.push(`${pad} };`);
|
|
149
|
+
lines.push(`${pad}});`);
|
|
150
|
+
lines.push("");
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case "wait_element": {
|
|
154
|
+
lines.push(`${pad}// Wait for element to appear`);
|
|
155
|
+
lines.push(`${pad}await new Promise((resolve) => {`);
|
|
156
|
+
lines.push(`${pad} const check = () => {`);
|
|
157
|
+
lines.push(`${pad} if (document.querySelector(${JSON.stringify(step.selector)})) {`);
|
|
158
|
+
lines.push(`${pad} resolve(undefined);`);
|
|
159
|
+
lines.push(`${pad} } else {`);
|
|
160
|
+
lines.push(`${pad} requestAnimationFrame(check);`);
|
|
161
|
+
lines.push(`${pad} }`);
|
|
162
|
+
lines.push(`${pad} };`);
|
|
163
|
+
lines.push(`${pad} check();`);
|
|
164
|
+
lines.push(`${pad}});`);
|
|
165
|
+
lines.push("");
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
case "extract": {
|
|
169
|
+
lines.push(`${pad}// Extract data from page`);
|
|
170
|
+
lines.push(`${pad}const extracted = document.querySelector(${JSON.stringify(step.selector)});`);
|
|
171
|
+
if (step.attribute) {
|
|
172
|
+
lines.push(`${pad}const extractedValue = extracted?.getAttribute(${JSON.stringify(step.attribute)}) ?? null;`);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
lines.push(`${pad}const extractedValue = extracted?.textContent ?? null;`);
|
|
176
|
+
}
|
|
177
|
+
lines.push("");
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
case "return": {
|
|
181
|
+
lines.push(`${pad}return { success: true };`);
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return lines;
|
|
186
|
+
}
|
|
187
|
+
function indent(text, spaces) {
|
|
188
|
+
const pad = " ".repeat(spaces);
|
|
189
|
+
return text
|
|
190
|
+
.split("\n")
|
|
191
|
+
.map((line, i) => (i === 0 ? line : pad + line))
|
|
192
|
+
.join("\n");
|
|
193
|
+
}
|
|
194
|
+
function safeName(name) {
|
|
195
|
+
return name.replace(/[^a-zA-Z0-9_$]/g, "_");
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=snippet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../src/exporter/snippet.ts"],"names":[],"mappings":";;AAcA,0CAiBC;AAjBD,SAAgB,eAAe,CAC7B,KAAiB,EACjB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