@ricardochen1996/browser-use-mcp 0.0.0-stage → 0.1.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/CHANGELOG.md +185 -0
- package/LICENSE +27 -0
- package/NOTICE +34 -0
- package/README.md +456 -2
- package/README.zh-CN.md +328 -0
- package/bin/browser-use-mcp.mjs +83 -0
- package/docs/architecture.md +210 -0
- package/docs/clients.md +425 -0
- package/docs/config.md +260 -0
- package/lib/cli.js +146 -0
- package/lib/config.js +341 -0
- package/lib/doctor.js +62 -0
- package/lib/engine.js +717 -0
- package/lib/http.js +222 -0
- package/lib/jev.js +105 -0
- package/lib/log.js +32 -0
- package/lib/provision.js +585 -0
- package/lib/python.js +470 -0
- package/lib/render.js +75 -0
- package/lib/server.js +193 -0
- package/lib/session.js +484 -0
- package/lib/sidecar.js +472 -0
- package/lib/tools.js +352 -0
- package/package.json +69 -4
- package/sidecar/bridge.py +982 -0
- package/vendor/jev-ultrafast.json +6 -0
- package/vendor/jev_ultrafast-0.1.1-py3-none-any.whl +0 -0
- package/vendor/requirements.txt +74 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
6
|
+
uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.1] - 2026-10-27
|
|
11
|
+
|
|
12
|
+
Release tooling and documentation only: the server behaves exactly as 0.1.0.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **npm Trusted Publishing.** A `vX.Y.Z` tag release now publishes through npm's OIDC trusted
|
|
17
|
+
publishing when no `NPM_TOKEN` secret is configured: the package names this repository,
|
|
18
|
+
`.github/workflows/release.yml` and the `npm` environment, so npm exchanges the job's short-lived
|
|
19
|
+
OIDC token for publish access and generates provenance without a long-lived token. A repository
|
|
20
|
+
that adds an `NPM_TOKEN` secret keeps working the old way.
|
|
21
|
+
- GitHub Actions runs the unit suite on Node 22.19 and 24 and every end-to-end suite as its own
|
|
22
|
+
annotated step on Ubuntu (Chrome plus a managed Python 3.12 environment); a failing unit test is
|
|
23
|
+
published as an annotation, so a red run is diagnosable from the run page without the job log.
|
|
24
|
+
- The release workflow fetches annotated tag objects explicitly (checkout can leave a lightweight
|
|
25
|
+
ref), refuses to continue when the tag or version disagree, skips a version that is already on
|
|
26
|
+
npm, and attaches the verified `dist/` tarball to the GitHub Release.
|
|
27
|
+
- README (English and Chinese) documents the trusted-publisher path and the tag workflow.
|
|
28
|
+
|
|
29
|
+
## [0.1.0] - 2026-10-27
|
|
30
|
+
|
|
31
|
+
The first public version of `browser-use-mcp`: an MCP server that gives any agent a browser it can
|
|
32
|
+
see and click, built on the `dsh-browser-use` engine.
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- **Attach mode is the default.** Out of the box the server drives the Chrome you already use: turn
|
|
37
|
+
remote debugging on once (`chrome://inspect/#remote-debugging`) and the agent sees your logins and
|
|
38
|
+
tabs, with no new profile per run. `--mode launch` keeps the old behaviour of a dedicated browser
|
|
39
|
+
with a profile under the state root (and is still what the e2e suites use).
|
|
40
|
+
`--attach-sharing shared` (default) lets several sessions — and several server processes — drive
|
|
41
|
+
that browser at once, each in its own tab; `exclusive` refuses a second live holder with a fix.
|
|
42
|
+
- **Named, persistent HTTP profiles.** In launch mode an HTTP client may name its profile on the
|
|
43
|
+
initialize request (`/mcp?profile=<name>` or header `X-Browser-Use-Profile: <name>`): the
|
|
44
|
+
directory `<state root>/profiles/<server profile>-<name>` is kept across reconnects, so logins
|
|
45
|
+
survive; different names run concurrently on different profiles, and two live sessions with the
|
|
46
|
+
same name are refused by the profile lock. Anonymous sessions keep the old behaviour (unique
|
|
47
|
+
profile, removed when the session ends). Invalid names are refused at initialize.
|
|
48
|
+
- **The action-space browser tools**, `dsh-browser-use`'s direct-mode surface over MCP:
|
|
49
|
+
`browser_open`, `browser_page`, `browser_act`, `browser_eval`, `browser_screenshot`,
|
|
50
|
+
`browser_console`, `browser_goal`, `browser_close`, `browser_doctor`. A page is rendered as one
|
|
51
|
+
line per reachable element with its operations and exact target indices; every step is one
|
|
52
|
+
operation on one target from the observation it names.
|
|
53
|
+
- **The freshness guard.** Each observation is recorded with its page fingerprint; `browser_act`
|
|
54
|
+
sends the fingerprint with the operation, and a page that moved makes the engine execute nothing
|
|
55
|
+
and answer with the fresh table. The server returns that as a normal tool result starting with
|
|
56
|
+
`Nothing was executed:`. A mutation is never retried automatically, so there are no double clicks
|
|
57
|
+
and no double submits.
|
|
58
|
+
- **One connection, one driver.** Every tool — `browser_eval` included — runs over the single CDP
|
|
59
|
+
connection the session's sidecar owns. The server instructions and tool descriptions state the
|
|
60
|
+
rule, because a model that needs a programmatic read must not start a second client (Chrome 144+
|
|
61
|
+
asks "Allow remote debugging?" once per connection).
|
|
62
|
+
- **Two transports.** stdio (default; one server process = one browser) and Streamable HTTP
|
|
63
|
+
(`--transport http --host --port --path`, default `http://127.0.0.1:7331/mcp`). Each MCP session
|
|
64
|
+
on the HTTP endpoint gets its own browser, profile and sidecar; an idle session's browser is
|
|
65
|
+
closed after 15 minutes (`BROWSER_USE_MCP_HTTP_IDLE_MS` overrides it) and its profile directory is
|
|
66
|
+
removed. HTTP has no authentication; the default bind is loopback.
|
|
67
|
+
- **Two connection modes.** `launch` (default) starts a dedicated Chrome with its own profile under
|
|
68
|
+
the state root; `attach` drives a running browser, either a configured
|
|
69
|
+
`--cdp-endpoint` (`http(s)` or `ws(s)`) or the Chrome you browse with, discovered through
|
|
70
|
+
`DevToolsActivePort`. `browser_close` never closes an attached browser.
|
|
71
|
+
- **Exclusive ownership.** A launched profile is claimed by one server at a time through a lock file
|
|
72
|
+
in the profile directory; an attach-mode DevTools endpoint is claimed under
|
|
73
|
+
`<state root>/attachments/`. A second live server is refused with a fix naming `--profile`; a lock
|
|
74
|
+
left by a dead process is reclaimed.
|
|
75
|
+
- **Managed Python provisioning.** The package bundles `jev_ultrafast` 0.1.1 as a wheel and the
|
|
76
|
+
sidecar's dependencies (`browser-harness` 0.1.13) as hash-pinned requirements. On first use it
|
|
77
|
+
builds `<state root>/env` with `uv` when available, otherwise with a probed Python 3.12+ and
|
|
78
|
+
`pip --require-hashes`; installs are serialized per state root by a lock directory with stale-lock
|
|
79
|
+
reclaim, `install.json` records what was built, and `serve` prewarms the check in the background.
|
|
80
|
+
`browser-use-mcp install` builds eagerly; `--python` hands the interpreter choice to the user and
|
|
81
|
+
disables automatic installation.
|
|
82
|
+
- **`browser_doctor` and `browser-use-mcp doctor`.** The same look-only self-check from the agent
|
|
83
|
+
and from a terminal: interpreter, engine and browser-harness versions, managed environment,
|
|
84
|
+
browser to launch or attach target, resolved configuration, offered tools, live session, and a
|
|
85
|
+
fix per problem. It never installs, opens a page, or prints a secret (`set`/`unset` only).
|
|
86
|
+
`browser_doctor` with `install: true` is the explicit opt-in that builds a missing environment.
|
|
87
|
+
- **The Jev policy, optional and configurable.** `browser_goal` runs a whole decision loop in its own
|
|
88
|
+
tab; `browser_act` with an `intent` and no operation delegates exactly one decision. The
|
|
89
|
+
`typesafe` decider (default) uses `TYPESAFE_API_KEY`; the `chat` decider uses `TEXT_MODEL_*`.
|
|
90
|
+
Policy variables travel only with the request that spends quota, a missing credential is a
|
|
91
|
+
refusal naming the variable, and `--no-jev` withdraws `browser_goal` and `intent` entirely.
|
|
92
|
+
- **One resolved configuration.** Flags and environment are read in one place
|
|
93
|
+
(`lib/config.js`): flag > environment > default, with strict validation, `~`/relative path
|
|
94
|
+
handling, boolean and enum parsing, and a configuration error exit code of `2`.
|
|
95
|
+
- **Tool-surface switches.** `--no-eval`, `--no-screenshots` and `--no-jev` (with
|
|
96
|
+
`BROWSER_USE_MCP_*` aliases) withdraw their tools without touching the rest of the surface.
|
|
97
|
+
- **Documentation.** `README.md`, `README.zh-CN.md`, `docs/clients.md` (Claude Code, Claude Desktop,
|
|
98
|
+
Cursor, Codex, DSH and generic `mcpServers`, stdio and HTTP), `docs/config.md` (exhaustive flag
|
|
99
|
+
and variable reference), `docs/architecture.md` (design and rationale), `AGENTS.md` (the working
|
|
100
|
+
contract) and `NOTICE` (third-party attribution).
|
|
101
|
+
- **CI and release automation.** GitHub Actions runs the unit suite on Node 22.19 and 24, the
|
|
102
|
+
release gate (manifest, changelog and the exact packed file list must agree) and a real-browser
|
|
103
|
+
end-to-end job on Ubuntu (Chrome plus a managed Python 3.12 environment). A `vX.Y.Z` annotated tag
|
|
104
|
+
on `main` triggers the release workflow: it validates that the tag and `package.json` agree, reruns
|
|
105
|
+
the full CI gate, publishes to npm with provenance, and creates the GitHub Release. Publishing is
|
|
106
|
+
idempotent: an already-published version is skipped rather than failing the run.
|
|
107
|
+
- **Tests.** `test/unit/` covers configuration, CLI parsing, rendering, sessions/locks and
|
|
108
|
+
provisioning (including a real install into a temporary home); five real-browser end-to-end
|
|
109
|
+
suites drive the real protocol: `test/e2e/stdio.mjs` (tools, freshness guard, refusals,
|
|
110
|
+
eval/screenshot/console, crash recovery, profile lock, tool switches), `test/e2e/http.mjs` (two
|
|
111
|
+
MCP sessions on one endpoint never share a page, idle cleanup, a long profile name),
|
|
112
|
+
`test/e2e/attach.mjs` (attach mode against a Chrome the test launches: the attached browser
|
|
113
|
+
survives every close), `test/e2e/intent.mjs` (the Jev intent/goal path against a loopback chat
|
|
114
|
+
stub, plus the no-credentials refusal) and `test/e2e/protocol.mjs` (hand-written JSON-RPC with no
|
|
115
|
+
MCP SDK on the client side). No paid model calls and no credentials are needed.
|
|
116
|
+
|
|
117
|
+
### Fixed
|
|
118
|
+
|
|
119
|
+
These are the pre-release fixes that made the first version safe to publish.
|
|
120
|
+
|
|
121
|
+
- A stale page is a **normal tool result** carrying the fresh table, not an `isError`: the agent
|
|
122
|
+
re-reads and chooses again instead of treating a moved page as a broken tool. A broken browser or
|
|
123
|
+
environment, by contrast, is a failed call the agent should report rather than retry.
|
|
124
|
+
- Configuration is validated once, before anything starts: a bad enum, port, timeout, profile name
|
|
125
|
+
or URL ends the process with code `2` and names the field, instead of failing later inside a tool
|
|
126
|
+
call.
|
|
127
|
+
- The doctor only looks: `inspectEngine` never installs, `browser-use-mcp install` is the separate
|
|
128
|
+
command, and `browser_doctor` requires `install: true` to build. A read-only self-check is what a
|
|
129
|
+
person or an agent can safely run at any time.
|
|
130
|
+
- `browser-use-mcp install` succeeds when it built the engine, even in the default attach mode with
|
|
131
|
+
no browser running: the attach target belongs to the doctor and the first browser call, so the
|
|
132
|
+
installer no longer exits non-zero on a machine (or CI runner) where it did its job.
|
|
133
|
+
- Jev credentials are copied into the one model-spending sidecar request and are not left in the
|
|
134
|
+
server's or the sidecar's environment, so a stale key cannot leak into an unrelated call.
|
|
135
|
+
- Install concurrency is safe across processes: a lock directory records its owner, one install runs
|
|
136
|
+
at a time per state root, and a lock whose pid is gone is reclaimed instead of blocking forever.
|
|
137
|
+
- Profile and attach locks behave the same way: a live holder refuses the second server with a
|
|
138
|
+
message and a fix, a dead holder does not.
|
|
139
|
+
- The sidecar is never silently reused after a failed shutdown: the next browser is a new
|
|
140
|
+
generation, and the caller is told what happened.
|
|
141
|
+
- A missing sidecar, engine or browser is reported as a problem with a runnable fix rather than a
|
|
142
|
+
hang or a stack trace; tool failures are returned as tool results, never as transport failures.
|
|
143
|
+
- `browser_eval` reports a thrown expression and an unreturnable value as readable text instead of
|
|
144
|
+
failing the call, and its request deadline covers the expression's own bound.
|
|
145
|
+
- The absolute path of `sidecar/bridge.py`, the bundled wheel and the requirements file is resolved
|
|
146
|
+
from the package, not from the working directory, so a client may start the server from anywhere.
|
|
147
|
+
- `browser_goal` no longer fails in milliseconds: an unbounded request means no deadline timer at
|
|
148
|
+
all, instead of a delay Node clamps to 1 ms. A goal run is bounded by the MCP client's timeout,
|
|
149
|
+
and the engine stops it at `DONE`/`BLOCKED`.
|
|
150
|
+
- A long `--profile` name can no longer overflow the engine daemon's AF_UNIX socket path: the
|
|
151
|
+
daemon name falls back to a stable short digest, and a runtime directory that cannot fit is
|
|
152
|
+
refused with the variable that fixes it.
|
|
153
|
+
- An unexpected sidecar exit marks its generation unusable instead of silently reusing it, and a
|
|
154
|
+
session that replaces a dead generation forgets that generation's page table.
|
|
155
|
+
- An HTTP MCP session is not closed by the idle sweep while a tool call is in flight, and a client's
|
|
156
|
+
long-lived GET event stream does not keep it from ever looking idle.
|
|
157
|
+
- `browser_close` with no page open answers "nothing to close" instead of starting a browser.
|
|
158
|
+
- Numeric tool arguments (a target index that arrives as a JSON number) are accepted where a string
|
|
159
|
+
is meant, instead of failing MCP input validation.
|
|
160
|
+
- A sidecar that dies unexpectedly no longer leaks its Browser Harness daemon: the crash handler
|
|
161
|
+
reaps the generation's daemon (its socket and pid files included) because that generation is
|
|
162
|
+
never reused. The stdio e2e now kills a sidecar mid-session and asserts both the fresh
|
|
163
|
+
generation and the absence of the old daemon.
|
|
164
|
+
|
|
165
|
+
### Notes
|
|
166
|
+
|
|
167
|
+
- **Not published to npm yet.** Run it from a checkout: `npm install`, then
|
|
168
|
+
`node /absolute/path/to/browser-use-mcp/bin/browser-use-mcp.mjs`. There is no `npx` installation
|
|
169
|
+
to document until a release exists; `npm link` puts a `browser-use-mcp` command on `PATH` for
|
|
170
|
+
terminal use.
|
|
171
|
+
- **Requirements:** Node.js `^22.19.0 || >=24.0.0`, Chrome or Chromium, and either a Python 3.12+
|
|
172
|
+
(`python3.12`–`python3.14` or `python3`) or `uv` to build the managed environment.
|
|
173
|
+
- **The Jev key is optional.** Without it, `browser_goal` and `browser_act` intents refuse with one
|
|
174
|
+
sentence naming the variable; everything else works. The default test suites never call a model.
|
|
175
|
+
- **State root:** `${BROWSER_USE_MCP_HOME:-~/.browser-use-mcp}` holds `env/`, `install.json`,
|
|
176
|
+
`profiles/<name>/` and `attachments/`.
|
|
177
|
+
- This checkout was developed and verified on macOS with Node 22 and Chrome. `lib/python.js`
|
|
178
|
+
carries macOS, Linux and Windows branches for interpreter and browser discovery; the end-to-end
|
|
179
|
+
suites require a locally installed Chrome.
|
|
180
|
+
- `browser-use-mcp` is MIT licensed and bundles or vendors MIT work from `dsh-browser-use`,
|
|
181
|
+
`jev-ultrafast` and `browser-harness`; see [NOTICE](NOTICE).
|
|
182
|
+
|
|
183
|
+
[Unreleased]: https://github.com/ricardochen1996/browser-use-mcp/compare/v0.1.1...HEAD
|
|
184
|
+
[0.1.1]: https://github.com/ricardochen1996/browser-use-mcp/releases/tag/v0.1.1
|
|
185
|
+
[0.1.0]: https://github.com/ricardochen1996/browser-use-mcp/releases/tag/v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 browser-use-mcp contributors
|
|
4
|
+
|
|
5
|
+
This project is built on the `dsh-browser-use` project
|
|
6
|
+
(https://github.com/ricardochen1996/dsh-browser-use), also MIT licensed,
|
|
7
|
+
whose `sidecar/bridge.py` is vendored here and whose browser engine
|
|
8
|
+
(`jev_ultrafast`) is bundled as a wheel built from
|
|
9
|
+
https://github.com/ricardochen1996/jev-ultrafast.
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`browser-use-mcp` is MIT licensed (see [LICENSE](LICENSE)). It bundles or vendors the
|
|
4
|
+
following work, all MIT licensed:
|
|
5
|
+
|
|
6
|
+
## `sidecar/bridge.py`
|
|
7
|
+
|
|
8
|
+
The line-delimited JSON sidecar that owns one browser session, reads a page as an indexed
|
|
9
|
+
action space, and executes one guarded operation at a time.
|
|
10
|
+
|
|
11
|
+
- Upstream: [`dsh-browser-use`](https://github.com/ricardochen1996/dsh-browser-use) v0.8.2,
|
|
12
|
+
`sidecar/bridge.py`
|
|
13
|
+
- Upstream revision: `dfe8bfc5221cb6573c1a29bb258059f9a430cd0d`
|
|
14
|
+
- SHA-256 of the vendored file: `7c17aa05afae0f03cff5af63a233d097c5982d273437608b1e9126055561085d`
|
|
15
|
+
- Changes: the module docstring names this project as its host only; behaviour is unchanged.
|
|
16
|
+
|
|
17
|
+
## `vendor/jev_ultrafast-0.1.1-py3-none-any.whl`
|
|
18
|
+
|
|
19
|
+
The browser engine: a dynamic, indexed action space, a guarded executor, and the Jev/TypeSafe
|
|
20
|
+
policy loop. Imported as a library by `sidecar/bridge.py`; no engine source ships in this
|
|
21
|
+
package.
|
|
22
|
+
|
|
23
|
+
- Upstream: [`jev-ultrafast`](https://github.com/ricardochen1996/jev-ultrafast) v0.1.1,
|
|
24
|
+
revision `50b319fd3e56052232b3a8de5695af9d30f77efb`
|
|
25
|
+
- SHA-256: `641dbc1cdf9b502e382e3a9d06d4f2545ebd7e5038f66fab6f3bc2ed68934103`
|
|
26
|
+
|
|
27
|
+
## `vendor/requirements.txt`
|
|
28
|
+
|
|
29
|
+
The sidecar's runtime dependencies (notably [`browser-harness`](https://github.com/browser-use/browser-harness)
|
|
30
|
+
0.1.13, also MIT), pinned by version and by the hash of every artifact, rendered from the
|
|
31
|
+
upstream `uv.lock`.
|
|
32
|
+
|
|
33
|
+
- Upstream: `dsh-browser-use` v0.8.2, `vendor/requirements.txt`
|
|
34
|
+
- SHA-256: `dd3f3ad0cae4e9ae211013aeabe80fed43adbfa1a3673995984555235465c216`
|