@jobshimo/browser-link 0.4.1 → 0.5.1
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 -21
- package/README.md +139 -139
- package/dist/bridge/server.d.ts +6 -0
- package/dist/bridge/server.js +2 -1
- package/dist/bridge/server.js.map +1 -1
- package/dist/cli.js +73 -73
- package/dist/commands/free-port.js +8 -2
- package/dist/commands/free-port.js.map +1 -1
- package/dist/extension/background.js +90 -90
- package/dist/extension/icons/icon.svg +14 -14
- package/dist/extension/manifest.json +28 -28
- package/dist/extension/popup.html +88 -88
- package/dist/map/db.js +28 -28
- package/dist/map/queries.js +4 -4
- package/dist/tools/server-instructions.js +50 -50
- package/package.json +70 -70
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
/** Usage protocol pushed to the MCP client on `initialize`. Plain string,
|
|
2
2
|
* intentionally kept short. Edit here when the protocol changes. */
|
|
3
|
-
export const SERVER_INSTRUCTIONS = `browser-link bridges Claude Code to the Chrome tabs the user has
|
|
4
|
-
explicitly connected through the companion extension, and ships a
|
|
5
|
-
persistent UI map backed by a local SQLite DB. The data dir resolves
|
|
6
|
-
per-OS via env-paths (\$XDG_DATA_HOME/browser-link on Linux,
|
|
7
|
-
~/Library/Application Support/browser-link on macOS, %APPDATA%/browser-link
|
|
8
|
-
on Windows). Override with \$BROWSER_LINK_DATA_DIR. The map is private
|
|
9
|
-
and per-machine; never persisted in any repo.
|
|
10
|
-
|
|
11
|
-
## When operating on a tab
|
|
12
|
-
|
|
13
|
-
1. Before doing anything on a tab whose URL you don't already know,
|
|
14
|
-
call \`browser.map.recall\` with { origin } (and optionally url) to load
|
|
15
|
-
selectors, flows and gotchas previously learned for that app.
|
|
16
|
-
2. If recall returns entries with \`failed_at\` more recent than
|
|
17
|
-
\`verified_at\`, treat them as suspect: re-verify (snapshot / evaluate)
|
|
18
|
-
before reusing, or replace them.
|
|
19
|
-
3. After every interaction that used a map entry, call
|
|
20
|
-
\`browser.map.record_use\` with { entry_id, ok }. ok=true updates
|
|
21
|
-
verified_at; ok=false updates failed_at. Keep the map honest.
|
|
22
|
-
4. After a non-trivial flow that worked end-to-end, persist it with
|
|
23
|
-
\`browser.map.save\`. Three \`kind\` values:
|
|
24
|
-
- selector: { selector, evidence? } — a CSS selector tied to a purpose.
|
|
25
|
-
- flow: { steps: [...] } — an ordered list of actions to reach an outcome.
|
|
26
|
-
- gotcha: { body } — free-form note about something non-obvious.
|
|
27
|
-
Use \`url_pattern\` = pathname (exact). Promote to glob only if you have
|
|
28
|
-
evidence of a parametric route. Provide \`purpose\` as a stable, reusable
|
|
29
|
-
label ("open task detail dialog", not "open IB0311 detail").
|
|
30
|
-
5. Never save selectors or flows you have not just successfully executed.
|
|
31
|
-
6. Never store domain data (IDs, user names, dates, etc.). The map captures
|
|
32
|
-
UI structure only.
|
|
33
|
-
|
|
34
|
-
## Identifying the app
|
|
35
|
-
|
|
36
|
-
- \`origin\` = scheme://host:port of the tab.
|
|
37
|
-
- \`app_key\` distinguishes apps that share an origin over time. On first
|
|
38
|
-
save you may omit it; it will be derived from the page title (slugified).
|
|
39
|
-
Use \`browser.map.rename_app\` if that initial guess is poor.
|
|
40
|
-
|
|
41
|
-
## When something is wrong
|
|
42
|
-
|
|
43
|
-
- A selector from recall fails → record_use({ok:false}), learn the new
|
|
44
|
-
one, save it (upsert on purpose).
|
|
45
|
-
- A whole app got refactored → \`browser.map.forget\` the app_id and let
|
|
46
|
-
the map repopulate as you learn the new structure.
|
|
47
|
-
- A tool call fails with "Tab not connected: tab_X" → call
|
|
48
|
-
\`browser.events\` to see whether the bridge changed primary (the
|
|
49
|
-
Chrome tab probably got a new tab_id after a reconnect). Look for a
|
|
50
|
-
\`tab-renamed\` event with previous=tab_X and resume on the current id.
|
|
51
|
-
|
|
52
|
-
The map is a cache of navigation, not a substitute for \`browser.snapshot\`.
|
|
3
|
+
export const SERVER_INSTRUCTIONS = `browser-link bridges Claude Code to the Chrome tabs the user has
|
|
4
|
+
explicitly connected through the companion extension, and ships a
|
|
5
|
+
persistent UI map backed by a local SQLite DB. The data dir resolves
|
|
6
|
+
per-OS via env-paths (\$XDG_DATA_HOME/browser-link on Linux,
|
|
7
|
+
~/Library/Application Support/browser-link on macOS, %APPDATA%/browser-link
|
|
8
|
+
on Windows). Override with \$BROWSER_LINK_DATA_DIR. The map is private
|
|
9
|
+
and per-machine; never persisted in any repo.
|
|
10
|
+
|
|
11
|
+
## When operating on a tab
|
|
12
|
+
|
|
13
|
+
1. Before doing anything on a tab whose URL you don't already know,
|
|
14
|
+
call \`browser.map.recall\` with { origin } (and optionally url) to load
|
|
15
|
+
selectors, flows and gotchas previously learned for that app.
|
|
16
|
+
2. If recall returns entries with \`failed_at\` more recent than
|
|
17
|
+
\`verified_at\`, treat them as suspect: re-verify (snapshot / evaluate)
|
|
18
|
+
before reusing, or replace them.
|
|
19
|
+
3. After every interaction that used a map entry, call
|
|
20
|
+
\`browser.map.record_use\` with { entry_id, ok }. ok=true updates
|
|
21
|
+
verified_at; ok=false updates failed_at. Keep the map honest.
|
|
22
|
+
4. After a non-trivial flow that worked end-to-end, persist it with
|
|
23
|
+
\`browser.map.save\`. Three \`kind\` values:
|
|
24
|
+
- selector: { selector, evidence? } — a CSS selector tied to a purpose.
|
|
25
|
+
- flow: { steps: [...] } — an ordered list of actions to reach an outcome.
|
|
26
|
+
- gotcha: { body } — free-form note about something non-obvious.
|
|
27
|
+
Use \`url_pattern\` = pathname (exact). Promote to glob only if you have
|
|
28
|
+
evidence of a parametric route. Provide \`purpose\` as a stable, reusable
|
|
29
|
+
label ("open task detail dialog", not "open IB0311 detail").
|
|
30
|
+
5. Never save selectors or flows you have not just successfully executed.
|
|
31
|
+
6. Never store domain data (IDs, user names, dates, etc.). The map captures
|
|
32
|
+
UI structure only.
|
|
33
|
+
|
|
34
|
+
## Identifying the app
|
|
35
|
+
|
|
36
|
+
- \`origin\` = scheme://host:port of the tab.
|
|
37
|
+
- \`app_key\` distinguishes apps that share an origin over time. On first
|
|
38
|
+
save you may omit it; it will be derived from the page title (slugified).
|
|
39
|
+
Use \`browser.map.rename_app\` if that initial guess is poor.
|
|
40
|
+
|
|
41
|
+
## When something is wrong
|
|
42
|
+
|
|
43
|
+
- A selector from recall fails → record_use({ok:false}), learn the new
|
|
44
|
+
one, save it (upsert on purpose).
|
|
45
|
+
- A whole app got refactored → \`browser.map.forget\` the app_id and let
|
|
46
|
+
the map repopulate as you learn the new structure.
|
|
47
|
+
- A tool call fails with "Tab not connected: tab_X" → call
|
|
48
|
+
\`browser.events\` to see whether the bridge changed primary (the
|
|
49
|
+
Chrome tab probably got a new tab_id after a reconnect). Look for a
|
|
50
|
+
\`tab-renamed\` event with previous=tab_X and resume on the current id.
|
|
51
|
+
|
|
52
|
+
The map is a cache of navigation, not a substitute for \`browser.snapshot\`.
|
|
53
53
|
The live snapshot is always the source of truth.`;
|
|
54
54
|
//# sourceMappingURL=server-instructions.js.map
|
package/package.json
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@jobshimo/browser-link",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MCP server that bridges Claude Code, OpenCode, GitHub Copilot CLI and other MCP clients to a Chrome tab. Per-tool permissions, multi-agent mode (multiple MCP clients sharing one bridge), persistent UI map across sessions.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"mcp",
|
|
7
|
-
"model-context-protocol",
|
|
8
|
-
"claude",
|
|
9
|
-
"claude-code",
|
|
10
|
-
"opencode",
|
|
11
|
-
"github-copilot",
|
|
12
|
-
"copilot-cli",
|
|
13
|
-
"chrome",
|
|
14
|
-
"browser-automation",
|
|
15
|
-
"ai-tools",
|
|
16
|
-
"permissions"
|
|
17
|
-
],
|
|
18
|
-
"homepage": "https://github.com/jobshimo/browser-link#readme",
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/jobshimo/browser-link/issues"
|
|
21
|
-
},
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/jobshimo/browser-link.git",
|
|
25
|
-
"directory": "packages/server"
|
|
26
|
-
},
|
|
27
|
-
"license": "MIT",
|
|
28
|
-
"author": "Martín Miguel Bernal",
|
|
29
|
-
"type": "module",
|
|
30
|
-
"main": "./dist/index.js",
|
|
31
|
-
"bin": {
|
|
32
|
-
"browser-link": "./dist/cli.js"
|
|
33
|
-
},
|
|
34
|
-
"files": [
|
|
35
|
-
"dist",
|
|
36
|
-
"README.md",
|
|
37
|
-
"LICENSE"
|
|
38
|
-
],
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "tsc",
|
|
44
|
-
"dev": "tsx watch src/cli.ts",
|
|
45
|
-
"try": "tsx src/cli.ts",
|
|
46
|
-
"start": "node dist/cli.js",
|
|
47
|
-
"typecheck": "tsc --noEmit",
|
|
48
|
-
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
49
|
-
"test": "vitest run",
|
|
50
|
-
"test:watch": "vitest",
|
|
51
|
-
"prepublishOnly": "npm run clean && npm run build && node ./scripts/prepare-publish.mjs"
|
|
52
|
-
},
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
55
|
-
"better-sqlite3": "^
|
|
56
|
-
"env-paths": "^3.0.0",
|
|
57
|
-
"ink": "^
|
|
58
|
-
"react": "^
|
|
59
|
-
"ws": "^8.18.0"
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@types/better-sqlite3": "^7.6.11",
|
|
63
|
-
"@types/node": "^22.0.0",
|
|
64
|
-
"@types/react": "^
|
|
65
|
-
"@types/ws": "^8.5.13",
|
|
66
|
-
"tsx": "^4.19.0",
|
|
67
|
-
"typescript": "^
|
|
68
|
-
"vitest": "^
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@jobshimo/browser-link",
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "MCP server that bridges Claude Code, OpenCode, GitHub Copilot CLI and other MCP clients to a Chrome tab. Per-tool permissions, multi-agent mode (multiple MCP clients sharing one bridge), persistent UI map across sessions.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"model-context-protocol",
|
|
8
|
+
"claude",
|
|
9
|
+
"claude-code",
|
|
10
|
+
"opencode",
|
|
11
|
+
"github-copilot",
|
|
12
|
+
"copilot-cli",
|
|
13
|
+
"chrome",
|
|
14
|
+
"browser-automation",
|
|
15
|
+
"ai-tools",
|
|
16
|
+
"permissions"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/jobshimo/browser-link#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/jobshimo/browser-link/issues"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/jobshimo/browser-link.git",
|
|
25
|
+
"directory": "packages/server"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"author": "Martín Miguel Bernal",
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"bin": {
|
|
32
|
+
"browser-link": "./dist/cli.js"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc",
|
|
44
|
+
"dev": "tsx watch src/cli.ts",
|
|
45
|
+
"try": "tsx src/cli.ts",
|
|
46
|
+
"start": "node dist/cli.js",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"test:watch": "vitest",
|
|
51
|
+
"prepublishOnly": "npm run clean && npm run build && node ./scripts/prepare-publish.mjs"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
55
|
+
"better-sqlite3": "^12.9.0",
|
|
56
|
+
"env-paths": "^3.0.0",
|
|
57
|
+
"ink": "^7.0.2",
|
|
58
|
+
"react": "^19.2.0",
|
|
59
|
+
"ws": "^8.18.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/better-sqlite3": "^7.6.11",
|
|
63
|
+
"@types/node": "^22.0.0",
|
|
64
|
+
"@types/react": "^19.2.0",
|
|
65
|
+
"@types/ws": "^8.5.13",
|
|
66
|
+
"tsx": "^4.19.0",
|
|
67
|
+
"typescript": "^6.0.3",
|
|
68
|
+
"vitest": "^4.1.6"
|
|
69
|
+
}
|
|
70
|
+
}
|