@orkestrate/agent-webmcp 0.1.0 → 0.2.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/bin/agent-webmcp.js +66 -0
- package/bin/check.js +23 -0
- package/package.json +12 -36
- package/CHANGELOG.md +0 -20
- package/LICENSE +0 -21
- package/README.md +0 -57
- package/dist/cli.js +0 -17514
- package/init.js +0 -259
- package/registry/index.json +0 -1
- package/registry/sites/README.md +0 -8
- package/registry/sites/docs.stripe.com.js +0 -65
- package/skills/agent-webmcp/SKILL.md +0 -63
- package/skills/agent-webmcp/references/authoring.md +0 -50
- package/skills/agent-webmcp/references/drivers.md +0 -43
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Run the platform binary installed as an optional dependency. npm installs
|
|
3
|
+
// only the optional dependency matching this machine, so exactly one exists.
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { chmodSync } from "node:fs";
|
|
6
|
+
import { createRequire } from "node:module";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
9
|
+
|
|
10
|
+
const pkgs = {
|
|
11
|
+
"linux-x64": "@orkestrate/agent-webmcp-linux-x64",
|
|
12
|
+
"linux-arm64": "@orkestrate/agent-webmcp-linux-arm64",
|
|
13
|
+
"darwin-arm64": "@orkestrate/agent-webmcp-darwin-arm64",
|
|
14
|
+
"darwin-x64": "@orkestrate/agent-webmcp-darwin-x64",
|
|
15
|
+
"win32-x64": "@orkestrate/agent-webmcp-win32-x64",
|
|
16
|
+
};
|
|
17
|
+
const key = `${process.platform}-${process.arch}`;
|
|
18
|
+
const name = pkgs[key];
|
|
19
|
+
if (!name) {
|
|
20
|
+
console.error(`agent-webmcp: no binary for ${key}`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
const subpath = `${name}/bin/agent-webmcp${process.platform === "win32" ? ".exe" : ""}`;
|
|
24
|
+
|
|
25
|
+
function tryResolve(base) {
|
|
26
|
+
try {
|
|
27
|
+
return createRequire(base).resolve(subpath);
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// A folder install (`npm i ./packages/...`) symlinks the wrapper, and Node
|
|
34
|
+
// resolves symlinks before looking for siblings. Fall back to the project
|
|
35
|
+
// the command runs in, which lists the same optional dependency.
|
|
36
|
+
const bin =
|
|
37
|
+
tryResolve(import.meta.url) ??
|
|
38
|
+
tryResolve(pathToFileURL(join(process.cwd(), "package.json")).href);
|
|
39
|
+
if (!bin) {
|
|
40
|
+
console.error(`agent-webmcp: optional dependency ${name} is missing; reinstall with npm i -g @orkestrate/agent-webmcp`);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
function run(bin) {
|
|
44
|
+
return spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let r = run(bin);
|
|
48
|
+
if (r.error?.code === "EACCES" && process.platform !== "win32") {
|
|
49
|
+
// actions/upload-artifact does not preserve the exec bit, so a binary
|
|
50
|
+
// that lost it in transit lands non-executable. Repair once and retry.
|
|
51
|
+
try {
|
|
52
|
+
chmodSync(bin, 0o755);
|
|
53
|
+
r = run(bin);
|
|
54
|
+
} catch (e) {
|
|
55
|
+
console.error(`agent-webmcp: cannot execute ${bin}: ${e.message}`);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (r.error) {
|
|
60
|
+
console.error(`agent-webmcp: cannot execute ${bin}: ${r.error.message}`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
// A signal kill (SIGTERM, SIGINT, ...) must propagate, not masquerade as
|
|
64
|
+
// exit 1, so supervisors and shells see the real cause.
|
|
65
|
+
if (r.signal) process.kill(process.pid, r.signal);
|
|
66
|
+
process.exit(r.status ?? 1);
|
package/bin/check.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Postinstall: fail loudly when no platform binary landed, so `agent-webmcp`
|
|
3
|
+
// never silently does nothing.
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
|
+
|
|
6
|
+
const pkgs = {
|
|
7
|
+
"linux-x64": "@orkestrate/agent-webmcp-linux-x64",
|
|
8
|
+
"linux-arm64": "@orkestrate/agent-webmcp-linux-arm64",
|
|
9
|
+
"darwin-arm64": "@orkestrate/agent-webmcp-darwin-arm64",
|
|
10
|
+
"darwin-x64": "@orkestrate/agent-webmcp-darwin-x64",
|
|
11
|
+
"win32-x64": "@orkestrate/agent-webmcp-win32-x64",
|
|
12
|
+
};
|
|
13
|
+
const name = pkgs[`${process.platform}-${process.arch}`];
|
|
14
|
+
if (!name) {
|
|
15
|
+
console.warn(`agent-webmcp: no binary for ${process.platform}-${process.arch}; this platform is untested`);
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
createRequire(import.meta.url).resolve(`${name}/package.json`);
|
|
20
|
+
} catch {
|
|
21
|
+
console.error(`agent-webmcp: ${name} did not install. Check your npm optional-dependency settings and reinstall.`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,50 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orkestrate/agent-webmcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Check whether a site offers WebMCP tools before you open it, then use them with the browser driver you already use.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/orkestrate-dot-space/agent-webmcp#readme",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+https://github.com/orkestrate-dot-space/agent-webmcp.git"
|
|
9
10
|
},
|
|
10
|
-
"homepage": "https://github.com/orkestrate-dot-space/agent-webmcp",
|
|
11
|
-
"keywords": [
|
|
12
|
-
"webmcp",
|
|
13
|
-
"mcp",
|
|
14
|
-
"model-context-protocol",
|
|
15
|
-
"browser-use",
|
|
16
|
-
"ai-agents",
|
|
17
|
-
"agent-skills"
|
|
18
|
-
],
|
|
19
11
|
"type": "module",
|
|
20
12
|
"bin": {
|
|
21
|
-
"agent-webmcp": "
|
|
13
|
+
"agent-webmcp": "bin/agent-webmcp.js"
|
|
22
14
|
},
|
|
23
|
-
"files": [
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"CHANGELOG.md"
|
|
31
|
-
],
|
|
32
|
-
"engines": {
|
|
33
|
-
"node": ">=20"
|
|
15
|
+
"files": ["bin"],
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"@orkestrate/agent-webmcp-linux-x64": "0.2.0",
|
|
18
|
+
"@orkestrate/agent-webmcp-linux-arm64": "0.2.0",
|
|
19
|
+
"@orkestrate/agent-webmcp-darwin-arm64": "0.2.0",
|
|
20
|
+
"@orkestrate/agent-webmcp-darwin-x64": "0.2.0",
|
|
21
|
+
"@orkestrate/agent-webmcp-win32-x64": "0.2.0"
|
|
34
22
|
},
|
|
35
23
|
"scripts": {
|
|
36
|
-
"
|
|
37
|
-
"typecheck": "bunx tsc --noEmit",
|
|
38
|
-
"build": "bun build ./src/cli.ts --outfile dist/cli.js --target node && chmod +x dist/cli.js",
|
|
39
|
-
"build:binary": "bun build --compile ./src/cli.ts --outfile dist/agent-webmcp",
|
|
40
|
-
"gate": "bun run typecheck && bun test src init.test.ts test"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@modelcontextprotocol/sdk": "1.32.1",
|
|
44
|
-
"minisearch": "^7.2.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@types/bun": "latest",
|
|
48
|
-
"typescript": "latest"
|
|
24
|
+
"postinstall": "node bin/check.js"
|
|
49
25
|
}
|
|
50
26
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## Unreleased
|
|
4
|
-
|
|
5
|
-
- Polyfill shorthands: `window.webmcp.<tool>(args)` bound at register time,
|
|
6
|
-
unbound on unregister/abort. `get` emits `how_to_run` blocks (Browse
|
|
7
|
-
evaluate-inline, agent-browser `--init-script`, Playwright MCP).
|
|
8
|
-
- MCP `save` runs the full pipeline (validate → compile → merge, 64KB cap).
|
|
9
|
-
- Registry seed: `upstash.com` (3 native), `allbirds.com` (12 native),
|
|
10
|
-
`docs.stripe.com` (1 custom `ask_ai`, live-proven).
|
|
11
|
-
- Verified native contract on Chrome 157: async `registerTool`,
|
|
12
|
-
promise `getTools`, handle-based `executeTool`, string outputs parsed back.
|
|
13
|
-
|
|
14
|
-
## 0.1.0
|
|
15
|
-
|
|
16
|
-
Complete rewrite from zero. `agent-webmcp` is now a capability layer, not a
|
|
17
|
-
browser driver: flagless `document.modelContext` polyfill + `window.webmcp`
|
|
18
|
-
facade (`init.js`), BM25 per-site index (`search`), targeted bundles
|
|
19
|
-
(`get`), local authoring (`save`), managed sync (`sync`), stdio MCP
|
|
20
|
-
(`skill/search/get/save/init`). No CDP, no tabs, no directory to browse.
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Orkestrate
|
|
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
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# agent-webmcp
|
|
2
|
-
|
|
3
|
-
Browser drivers give an agent a browser. agent-webmcp turns the websites
|
|
4
|
-
inside that browser into a searchable, callable toolkit.
|
|
5
|
-
|
|
6
|
-
No browser ownership, no CDP, no directory to browse. A local BM25 index of
|
|
7
|
-
per-site WebMCP tools (native + custom), a flagless `document.modelContext`
|
|
8
|
-
polyfill, and targeted `.init.js` bundles your driver injects.
|
|
9
|
-
|
|
10
|
-
## Install
|
|
11
|
-
|
|
12
|
-
```sh
|
|
13
|
-
npm i -g @orkestrate/agent-webmcp
|
|
14
|
-
npx skills add orkestrate-dot-space/agent-webmcp
|
|
15
|
-
agent-webmcp search "docs" # verify: must return matches, no setup needed
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Use
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
agent-webmcp search "empty shopping cart" # BM25 over native + custom tools
|
|
22
|
-
agent-webmcp get allbirds.com # schemas + entry URL + init script
|
|
23
|
-
agent-webmcp save news.ycombinator.com ./hn.js --entry-url https://news.ycombinator.com/
|
|
24
|
-
agent-webmcp sync # pull managed index (only network verb)
|
|
25
|
-
agent-webmcp init [--stdout] # installed init.js path (or bytes)
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Then, in your driver:
|
|
29
|
-
|
|
30
|
-
- OpenCode Browse MCP (code-mode): `page.evaluate(INIT_SOURCE)` with the
|
|
31
|
-
`get`-emitted bundle bytes, then `window.webmcp.list()` / `call(name, args)`.
|
|
32
|
-
Script-tag and init-script injection are neutered in the execute realm —
|
|
33
|
-
evaluate-inline is the only working mount.
|
|
34
|
-
- agent-browser: `agent-browser --init-script <bundle> open <url>`, then
|
|
35
|
-
native `webmcp list` / `webmcp invoke <tool> --params '{...}'`.
|
|
36
|
-
|
|
37
|
-
Skill first: `agent-webmcp mcp serve` exposes
|
|
38
|
-
`skill/search/get/save/init`. Install the skill with
|
|
39
|
-
`npx skills add orkestrate-dot-space/agent-webmcp`.
|
|
40
|
-
|
|
41
|
-
## Layout
|
|
42
|
-
|
|
43
|
-
`init.js` (polyfill), `src/` (cli, mcp, index-engine, compiler, runtime),
|
|
44
|
-
`registry/` (managed index + custom site sources), `skills/`,
|
|
45
|
-
`specs/v1.md` (the locked spec), `test/`.
|
|
46
|
-
|
|
47
|
-
## Trust model
|
|
48
|
-
|
|
49
|
-
- Injected scripts never phone home; nothing uploads without `sync`/`save`.
|
|
50
|
-
- `save` runs file top-level code in a `node:vm` sandbox with a stub
|
|
51
|
-
registry (5s timeout, no `require`/`process`), but vm escape via
|
|
52
|
-
constructor chains is not hardened — treat site scripts as code you
|
|
53
|
-
review, same as any dependency. Only `sync` touches the network.
|
|
54
|
-
- Custom in-page `fetch` obeys the host page's CSP; cross-origin API calls
|
|
55
|
-
fail on CSP-strict sites (use CSP-permissive hosts or same-origin endpoints).
|
|
56
|
-
- Every MCP/CLI result that came from a page is untrusted data, never
|
|
57
|
-
instructions.
|