slimbrowser-mcp 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/README.md ADDED
@@ -0,0 +1,271 @@
1
+ <p align="center">
2
+ <h1 align="center">slimbrowser-mcp</h1>
3
+ <p align="center">A token-efficient browser MCP for AI agents. Minimal context, maximum visibility.</p>
4
+ </p>
5
+
6
+ <p align="center">
7
+ <a href="#quickstart">Quickstart</a> &middot;
8
+ <a href="#one-command-bootstrap">One-command Bootstrap</a> &middot;
9
+ <a href="#packaging-for-distribution">Packaging</a> &middot;
10
+ <a href="#why-slimbrowser-mcp">Why slimbrowser-mcp</a> &middot;
11
+ <a href="#architecture">Architecture</a> &middot;
12
+ <a href="#tool-catalog">Tools</a> &middot;
13
+ <a href="#claude-code-integration">Claude Code</a> &middot;
14
+ <a href="docs/MCP_TOOL_CATALOG.md">Full Tool Reference</a>
15
+ </p>
16
+
17
+ <p align="center">
18
+ <img src="https://img.shields.io/badge/rust-1.78+-orange?logo=rust" alt="Rust 1.78+">
19
+ <img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT License">
20
+ <img src="https://img.shields.io/badge/MCP-compatible-green" alt="MCP Compatible">
21
+ <img src="https://img.shields.io/badge/browser-Chrome-yellow?logo=googlechrome" alt="Chrome">
22
+ </p>
23
+
24
+ ---
25
+
26
+ ## Why slimbrowser-mcp
27
+
28
+ Browser automation for AI agents is expensive. A single page observation can consume **15,000-30,000 tokens** with traditional tools. Over a typical multi-step workflow, that adds up fast.
29
+
30
+ slimbrowser-mcp takes a different approach:
31
+
32
+ | Approach | Tokens per page read | 12-step workflow |
33
+ |---|---|---|
34
+ | Chrome DevTools MCP | 15,000 - 30,000 | ~200K - 380K |
35
+ | Playwright MCP | 14,000 - 19,000 | ~180K - 250K |
36
+ | Claude in Chrome | 4,000 - 8,000 | ~80K - 120K |
37
+ | **slimbrowser-mcp** | **1,000 - 3,000** | **~30K - 50K** |
38
+
39
+ **Up to 85% fewer tokens** than Chrome DevTools MCP. Up to 56% fewer than Claude in Chrome.
40
+
41
+ ### How
42
+
43
+ - **Compressed observations** &mdash; `browser_observe(SUMMARY)` returns only interactive elements, not the full DOM or accessibility tree
44
+ - **Schema-based extraction** &mdash; `browser_extract` pulls exactly the data you ask for, nothing more
45
+ - **Smart deltas** &mdash; only report what changed between actions, not the entire page state
46
+ - **Budget tracking** &mdash; built-in token/screenshot budget per session so agents stay within limits
47
+
48
+ ---
49
+
50
+ ## Quickstart
51
+
52
+ ```bash
53
+ # Clone
54
+ git clone git@github.com:Naresh084/slimbrowse.git
55
+ cd slimbrowse
56
+
57
+ # Run diagnostics
58
+ cargo run -p slimbrowser-mcp -- doctor
59
+
60
+ # Start the MCP server
61
+ cargo run -p slimbrowser-mcp
62
+ ```
63
+
64
+ No `.env` required. Sensible defaults are built in. Use `.env` only to override (see [`.env.example`](.env.example)).
65
+
66
+ ---
67
+
68
+ ## One-command Bootstrap
69
+
70
+ No manual install flow required:
71
+
72
+ ```bash
73
+ ./scripts/slimbrowser-mcp-bootstrap.sh doctor
74
+ ./scripts/slimbrowser-mcp-bootstrap.sh
75
+ ```
76
+
77
+ This auto-installs `slimbrowser-mcp` under `~/.slimbrowser-mcp/bin` on first run, then runs it directly.
78
+
79
+ `npx`-style local launcher is also available:
80
+
81
+ ```bash
82
+ npx --yes /Users/naresh/Work/Personal/browser-test doctor
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Packaging for Distribution
88
+
89
+ Build distributable artifacts:
90
+
91
+ ```bash
92
+ ./scripts/package-release.sh
93
+ ```
94
+
95
+ This creates platform-specific `.tar.gz` + `.zip` + checksum in `dist/`.
96
+
97
+ Install from an unpacked package:
98
+
99
+ ```bash
100
+ ./scripts/install-from-package.sh ./slimbrowser-mcp-<version>-<target>
101
+ ```
102
+
103
+ Full distribution instructions: [docs/DISTRIBUTION.md](docs/DISTRIBUTION.md)
104
+ Publish instructions: [docs/PUBLISH.md](docs/PUBLISH.md)
105
+
106
+ ---
107
+
108
+ ## Architecture
109
+
110
+ slimbrowser-mcp is a Rust workspace with a modular crate structure:
111
+
112
+ ```
113
+ slimbrowse/
114
+ ├── apps/
115
+ │ ├── slimbrowser-mcp # MCP server binary (stdio + HTTP)
116
+ │ ├── slimbrowser-cli # Standalone CLI
117
+ │ └── slimbrowserd # Daemon mode
118
+ ├── crates/
119
+ │ ├── engine-chromium # Chrome CDP adapter
120
+ │ ├── runtime-observe # Compressed page observations
121
+ │ ├── runtime-extract # Schema-based data extraction
122
+ │ ├── runtime-actions # Click, type, scroll, navigate
123
+ │ ├── runtime-cost # Token budget tracking
124
+ │ ├── runtime-artifacts # Screenshot & artifact storage
125
+ │ ├── runtime-policy # Session policy (strict/unrestricted)
126
+ │ ├── session-manager # Multi-session lifecycle
127
+ │ ├── tab-graph # Tab state management
128
+ │ ├── mcp-server # MCP protocol layer
129
+ │ ├── mcp-types # MCP type definitions
130
+ │ ├── sdk-rust # Rust SDK for embedding
131
+ │ └── ... # 12 more internal crates
132
+ ├── configs/ # Default MCP config (TOML)
133
+ ├── examples/ # Smoke tests & usage scripts
134
+ └── docs/ # Tool catalog & resource docs
135
+ ```
136
+
137
+ ### Key design decisions
138
+
139
+ - **Chrome-only, CDP-first** &mdash; No WebDriver. Direct Chrome DevTools Protocol for speed and reliability.
140
+ - **Embedded auto-launch** &mdash; MCP server auto-launches Chrome on first session. Auto-stops on shutdown.
141
+ - **Headed by default** &mdash; You see exactly what the agent sees. Switch to headless with one env var.
142
+ - **Session capture** &mdash; Every session records a playback trace for debugging and demos.
143
+
144
+ ---
145
+
146
+ ## Tool Catalog
147
+
148
+ 40+ browser tools organized by category:
149
+
150
+ ### Session Management
151
+ | Tool | Description |
152
+ |---|---|
153
+ | `browser_create_session` | Create a new browser session with profile & policy |
154
+ | `browser_close_session` | Close session with optional feedback |
155
+ | `browser_get_session` | Get session state |
156
+
157
+ ### Observation & Navigation
158
+ | Tool | Description |
159
+ |---|---|
160
+ | `browser_observe` | Compressed page state (SUMMARY / REGION / FULL) |
161
+ | `browser_navigate` | Navigate to URL |
162
+ | `browser_scroll` | Scroll page by delta |
163
+ | `browser_back` / `browser_forward` | History navigation |
164
+
165
+ ### Interaction
166
+ | Tool | Description |
167
+ |---|---|
168
+ | `browser_click` | Click element by ID |
169
+ | `browser_type` | Type text into element |
170
+ | `browser_fill_form` | Fill multiple form fields at once |
171
+ | `browser_select` | Select dropdown option |
172
+
173
+ ### Extraction & Artifacts
174
+ | Tool | Description |
175
+ |---|---|
176
+ | `browser_extract` | Schema-based structured data extraction |
177
+ | `browser_screenshot` | Capture screenshot with export options |
178
+ | `browser_evaluate_script` | Execute JavaScript in page |
179
+
180
+ ### Diagnostics
181
+ | Tool | Description |
182
+ |---|---|
183
+ | `browser_list_console_messages` | Read console output |
184
+ | `browser_list_network_requests` | Inspect network traffic |
185
+ | `browser_get_performance` | Page performance metrics |
186
+
187
+ [Full tool reference &rarr;](docs/MCP_TOOL_CATALOG.md)
188
+
189
+ ---
190
+
191
+ ## Claude Code Integration
192
+
193
+ Install the binary:
194
+
195
+ ```bash
196
+ cargo install --path apps/slimbrowser-mcp
197
+ ```
198
+
199
+ Register with Claude Code:
200
+
201
+ ```bash
202
+ claude mcp add --scope local slimbrowser -- slimbrowser-mcp
203
+ ```
204
+
205
+ Verify:
206
+
207
+ ```bash
208
+ # Inside Claude Code, run:
209
+ /mcp
210
+ # Look for "slimbrowser" in the connected servers list
211
+ ```
212
+
213
+ Remove:
214
+
215
+ ```bash
216
+ claude mcp remove --scope local slimbrowser
217
+ ```
218
+
219
+ ---
220
+
221
+ ## Configuration
222
+
223
+ slimbrowser-mcp works out of the box. Override defaults via `.env` or environment variables:
224
+
225
+ ```bash
226
+ # Transport
227
+ MCP_TRANSPORT=stdio # stdio | http | both
228
+ MCP_RUNTIME_MODE=embedded # embedded | remote
229
+
230
+ # Browser
231
+ CHROME_HEADLESS=false # true for headless mode
232
+ CHROME_LAUNCH_ON_START=true # auto-launch Chrome
233
+
234
+ # Session capture
235
+ MCP_ENABLE_SESSION_CAPTURE=true
236
+ MCP_SESSION_CAPTURE_DIR=/tmp/slimbrowser-mcp-playbacks
237
+
238
+ # HTTP mode (optional)
239
+ MCP_HTTP_BIND=127.0.0.1:3100
240
+ MCP_HTTP_ENDPOINT=/mcp
241
+ ```
242
+
243
+ Config file discovery order:
244
+ 1. `--config <path>`
245
+ 2. `MCP_CONFIG=<path>`
246
+ 3. `./configs/mcp.toml`
247
+ 4. `./mcp.toml`
248
+ 5. `$HOME/.config/slimbrowser-mcp/mcp.toml`
249
+ 6. Built-in defaults + `.env`
250
+
251
+ ---
252
+
253
+ ## Development
254
+
255
+ ```bash
256
+ # Check everything compiles
257
+ cargo check --workspace
258
+
259
+ # Run tests
260
+ cargo test --workspace
261
+
262
+ # Lint
263
+ cargo fmt --all -- --check
264
+ cargo clippy --workspace --all-targets -- -D warnings
265
+ ```
266
+
267
+ ---
268
+
269
+ ## License
270
+
271
+ MIT
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "slimbrowser-mcp",
3
+ "version": "0.1.0",
4
+ "description": "npx bootstrap launcher for slimbrowser-mcp",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "files": [
9
+ "scripts/slimbrowser-mcp-bootstrap.sh",
10
+ "scripts/slimbrowser-mcp-npx.js"
11
+ ],
12
+ "bin": {
13
+ "slimbrowser-mcp": "scripts/slimbrowser-mcp-npx.js"
14
+ },
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "license": "MIT"
19
+ }
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5
+ INSTALL_ROOT="${SLIMBROWSER_MCP_INSTALL_ROOT:-$HOME/.slimbrowser-mcp}"
6
+ BIN_PATH="$INSTALL_ROOT/bin/slimbrowser-mcp"
7
+
8
+ if ! command -v cargo >/dev/null 2>&1; then
9
+ echo "error: cargo is required for bootstrap install (https://rustup.rs)" >&2
10
+ exit 1
11
+ fi
12
+
13
+ if [[ ! -x "$BIN_PATH" ]]; then
14
+ mkdir -p "$INSTALL_ROOT"
15
+ echo "Installing slimbrowser-mcp to $INSTALL_ROOT ..." >&2
16
+ cargo install \
17
+ --locked \
18
+ --force \
19
+ --path "$ROOT_DIR/apps/slimbrowser-mcp" \
20
+ --root "$INSTALL_ROOT" >/dev/null
21
+ fi
22
+
23
+ exec "$BIN_PATH" "$@"
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("node:child_process");
4
+ const { resolve } = require("node:path");
5
+
6
+ if (process.platform === "win32") {
7
+ console.error(
8
+ "slimbrowser-mcp bootstrap currently supports macOS/Linux via bash bootstrap. Use cargo install on Windows."
9
+ );
10
+ process.exit(1);
11
+ }
12
+
13
+ const scriptPath = resolve(__dirname, "slimbrowser-mcp-bootstrap.sh");
14
+ const child = spawn("bash", [scriptPath, ...process.argv.slice(2)], {
15
+ stdio: "inherit",
16
+ env: process.env,
17
+ });
18
+
19
+ child.on("exit", (code, signal) => {
20
+ if (signal) {
21
+ process.kill(process.pid, signal);
22
+ return;
23
+ }
24
+ process.exit(code ?? 1);
25
+ });