autochrome-bridge 0.0.0-stage → 1.0.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 +114 -2
- package/dist/cli.js +20575 -0
- package/package.json +49 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 fahaddhruba
|
|
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
CHANGED
|
@@ -1,3 +1,115 @@
|
|
|
1
|
-
#
|
|
1
|
+
# autochrome-bridge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lets outside tools control your real Chrome through the autochrome extension: Claude Code,
|
|
4
|
+
Cursor or any MCP client over stdio, and your own scripts over HTTP or WebSocket.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
Claude Code ─stdio─ autochrome-bridge ─┐
|
|
8
|
+
Cursor ─stdio─ autochrome-bridge ─┼─ hub (127.0.0.1:47800) ─ Chrome extension
|
|
9
|
+
script ─HTTP / WebSocket─────────┘
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
One process owns the port (the hub) and holds the extension connection. Every
|
|
13
|
+
`autochrome-bridge` MCP process joins the hub, or starts it if nobody is listening. If the hub's
|
|
14
|
+
process exits, one of the others takes over.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Requires Node 22 or newer and the autochrome extension.
|
|
19
|
+
|
|
20
|
+
**Claude Code**
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
claude mcp add autochrome -- npx -y autochrome-bridge
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Cursor** (`~/.cursor/mcp.json`) and other MCP clients:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"autochrome": { "command": "npx", "args": ["-y", "autochrome-bridge"] }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Tools
|
|
37
|
+
|
|
38
|
+
All 21 tools are exposed over MCP and the HTTP/WebSocket API: tabs (`tabs_list`, `tab_open`,
|
|
39
|
+
`tab_switch`, `tab_close`, `navigate`, `go_back`, `go_forward`), reading (`read_page`, `find`,
|
|
40
|
+
`get_text`, `screenshot`), acting (`click`, `type`, `key`, `scroll`, `form_input`, `wait`) and
|
|
41
|
+
debugging (`console_logs`, `network_requests`, `network_response`, `js_eval`). Use `GET /v1/tools`
|
|
42
|
+
for the exact descriptions and input schemas. Tabs the agent opens go in their own tab group; pass
|
|
43
|
+
the `tabId` that `tab_open` returns to work across several tabs.
|
|
44
|
+
|
|
45
|
+
## Approvals
|
|
46
|
+
|
|
47
|
+
Bridge calls go through the same safety checks as the side panel agent, using the mode chosen in
|
|
48
|
+
the extension's Settings → Safety (default: per-site). A call that needs approval waits until you
|
|
49
|
+
answer:
|
|
50
|
+
|
|
51
|
+
- If the side panel is open, the prompt appears in the chat, labelled "From an external tool".
|
|
52
|
+
Otherwise a small popup window opens.
|
|
53
|
+
- Choose Allow once, Allow on this site (not offered for risky actions) or Deny. No answer within
|
|
54
|
+
2 minutes counts as a denial.
|
|
55
|
+
- A denial comes back as a normal failed result (`ok: false`, "The user denied this action."), so
|
|
56
|
+
the client can adapt instead of hanging.
|
|
57
|
+
- `js_eval` asks every time, in every mode. Risky clicks and form entries (purchases, sending,
|
|
58
|
+
deleting, password and card fields) ask even on allowed sites, except in Auto mode.
|
|
59
|
+
|
|
60
|
+
Because a waiting approval keeps the call open, set a long enough timeout in your client. The HTTP
|
|
61
|
+
API gives up on a call after 120 seconds.
|
|
62
|
+
|
|
63
|
+
## Pair the extension
|
|
64
|
+
|
|
65
|
+
The first run creates a token in `~/.autochrome/token` (directory `0700`, file `0600`).
|
|
66
|
+
|
|
67
|
+
1. Run `npx autochrome-bridge token` and copy the output.
|
|
68
|
+
2. Open the autochrome side panel in Chrome, go to Settings → Bridge, paste the token and save.
|
|
69
|
+
3. The status dot turns green once the extension is connected.
|
|
70
|
+
|
|
71
|
+
Set `AUTOCHROME_TOKEN` to use a different token without touching the file.
|
|
72
|
+
|
|
73
|
+
## Port
|
|
74
|
+
|
|
75
|
+
The default port is `47800`. Change it with `--port <n>` or `AUTOCHROME_PORT`, and enter the same
|
|
76
|
+
port in the extension's Bridge settings. The hub only listens on `127.0.0.1`.
|
|
77
|
+
|
|
78
|
+
## Commands
|
|
79
|
+
|
|
80
|
+
| Command | What it does |
|
|
81
|
+
| --------------------------- | ------------------------------------------------ |
|
|
82
|
+
| `autochrome-bridge` (`mcp`) | MCP server on stdio; joins or starts the hub |
|
|
83
|
+
| `autochrome-bridge serve` | Standalone hub for scripts, no MCP client needed |
|
|
84
|
+
| `autochrome-bridge token` | Prints the pairing token |
|
|
85
|
+
|
|
86
|
+
## HTTP API
|
|
87
|
+
|
|
88
|
+
Every request needs `Authorization: Bearer <token>`. Requests that carry a browser `Origin`
|
|
89
|
+
header are refused, so web pages cannot reach the hub.
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
TOKEN=$(npx autochrome-bridge token)
|
|
93
|
+
|
|
94
|
+
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:47800/v1/status
|
|
95
|
+
curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:47800/v1/tools
|
|
96
|
+
|
|
97
|
+
curl -X POST -H "Authorization: Bearer $TOKEN" \
|
|
98
|
+
-d '{"url":"https://example.com"}' http://127.0.0.1:47800/v1/tools/tab_open
|
|
99
|
+
|
|
100
|
+
curl -X POST -H "Authorization: Bearer $TOKEN" http://127.0.0.1:47800/v1/tools/read_page
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- `GET /v1/status` returns `{ "extensionConnected": boolean, "protocolVersion": number }`.
|
|
104
|
+
- `GET /v1/tools` returns each tool's name, description and JSON Schema input.
|
|
105
|
+
- `POST /v1/tools/:name` takes the tool input as the JSON body and returns
|
|
106
|
+
`{ "id", "ok", "content": [...] }`. The status is `200` even when `ok` is `false` (for example
|
|
107
|
+
when Chrome is not connected); `4xx` is only for a bad token, an unknown tool or invalid JSON.
|
|
108
|
+
Calls time out after 120 seconds.
|
|
109
|
+
|
|
110
|
+
## WebSocket API
|
|
111
|
+
|
|
112
|
+
Connect to `ws://127.0.0.1:47800/client` and send `{"type":"hello","role":"client","token":"…",
|
|
113
|
+
"protocolVersion":1}` first. Then send `{"type":"call","call":{"id":"1","name":"tabs_list","input":{}}}`
|
|
114
|
+
and read `{"type":"result","result":{…}}`. The hub also sends `status` messages when the extension
|
|
115
|
+
connects or disconnects. The message schemas live in `packages/shared/src/bridge.ts`.
|