claude-browser-bridge 3.0.0 → 3.0.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/index.js +46 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -211,10 +211,48 @@ establish();
|
|
|
211
211
|
|
|
212
212
|
// --- MCP server exposed to Claude Code -------------------------------------
|
|
213
213
|
|
|
214
|
+
const HELP_TOOL = {
|
|
215
|
+
name: "browser_bridge_help",
|
|
216
|
+
description:
|
|
217
|
+
"Returns the complete usage guide for all 57 browser-bridge tools. Call this ONCE at the start of any session where you need to use browser tools, to learn the optimal workflows and avoid slow anti-patterns.",
|
|
218
|
+
inputSchema: { type: "object", properties: {} },
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const HELP_TEXT = `# Claude Browser Bridge — 57 Tools Usage Guide
|
|
222
|
+
|
|
223
|
+
## CRITICAL RULES (read before using ANY tool):
|
|
224
|
+
1. ALWAYS start with \`diagnose\` — it returns snapshot + console errors + network failures + API responses in ONE call. NEVER call snapshot, get_console, get_network separately.
|
|
225
|
+
2. Use \`batch\` for 2+ independent calls — e.g. batch([{name:"get_cookies"}, {name:"get_storage"}]).
|
|
226
|
+
3. Pin with \`select_tab\` once, then stop passing tab_id — the pin persists.
|
|
227
|
+
4. Use \`new_tab\` for research — NEVER navigate away from the app tab.
|
|
228
|
+
5. After EVERY CSS/UI code change, take a \`screenshot\` to verify. Never claim "this should work" without seeing it.
|
|
229
|
+
6. Use \`inject_css\` to test CSS fixes instantly without rebuilding, then write to file once confirmed.
|
|
230
|
+
7. After 3 failed fix attempts, search the web: new_tab({url:"https://google.com/search?q=..."}).
|
|
231
|
+
|
|
232
|
+
## Tool Categories:
|
|
233
|
+
- Core: diagnose, batch, select_tab, snapshot, eval, screenshot, full_page_screenshot, get_page_text, get_html, get_page_info
|
|
234
|
+
- Interaction: click, fill, hover, scroll, press_key, select_option, upload_file, highlight_element
|
|
235
|
+
- Navigation: navigate, new_tab, close_tab, go_back, go_forward, reload, list_tabs, wait_for
|
|
236
|
+
- Debugging: get_console, get_grouped_console, get_network, search_network_bodies, get_styles, get_cookies, get_storage, get_clipboard, watch_dom_changes, generate_selector
|
|
237
|
+
- Performance: performance_trace, heap_snapshot_summary, get_load_timeline
|
|
238
|
+
- Accessibility: get_accessibility_tree, check_contrast
|
|
239
|
+
- Emulation: emulate_device, network_throttle, set_geolocation, toggle_dark_mode
|
|
240
|
+
- Testing: visual_diff, inject_css, mock_network, record_actions, replay_actions, handle_dialog
|
|
241
|
+
- Productivity: save_form_profile, load_form_profile, save_tab_session, restore_tab_session, edit_cookie, export_pdf
|
|
242
|
+
|
|
243
|
+
## Key Workflows:
|
|
244
|
+
- Investigate a page: diagnose → read errors → fix → screenshot to verify
|
|
245
|
+
- Visual bug fix: batch([screenshot, get_styles]) → edit code → screenshot → compare → iterate
|
|
246
|
+
- Performance audit: batch([performance_trace, heap_snapshot_summary, get_load_timeline])
|
|
247
|
+
- Accessibility check: batch([get_accessibility_tree, check_contrast])
|
|
248
|
+
- Test error states: mock_network({url_pattern:"/api/x", status_code:500}) → reload → screenshot
|
|
249
|
+
- Record regression test: record_actions → reproduce bug → stop → fix → replay_actions to verify
|
|
250
|
+
`;
|
|
251
|
+
|
|
214
252
|
const BATCH_TOOL = {
|
|
215
253
|
name: "batch",
|
|
216
254
|
description:
|
|
217
|
-
"Execute multiple tool calls in a single round-trip for speed. Pass an array of {name, arguments} objects. All calls run in parallel and results are returned in the same order. Use this when you need to call 2+ tools that don't depend on each other.",
|
|
255
|
+
"Execute multiple tool calls in a single round-trip for speed. Pass an array of {name, arguments} objects. All calls run in parallel and results are returned in the same order. Use this when you need to call 2+ tools that don't depend on each other. ALWAYS prefer this over sequential calls.",
|
|
218
256
|
inputSchema: {
|
|
219
257
|
type: "object",
|
|
220
258
|
properties: {
|
|
@@ -502,7 +540,7 @@ const TOOLS = [
|
|
|
502
540
|
{
|
|
503
541
|
name: "diagnose",
|
|
504
542
|
description:
|
|
505
|
-
"
|
|
543
|
+
"⚡ CALL THIS FIRST on any page. Returns snapshot (interactive elements with refs for click/fill) + console errors with stacks + failed network requests with response bodies + recent successful API responses + CAPTCHA detection + cross-origin iframe warnings + localStorage keys — ALL in ONE call. Replaces 4-5 sequential tool calls. After this, use refs from the snapshot to click/fill elements.",
|
|
506
544
|
inputSchema: {
|
|
507
545
|
type: "object",
|
|
508
546
|
properties: {
|
|
@@ -809,7 +847,7 @@ const server = new Server(
|
|
|
809
847
|
{ capabilities: { tools: {} } }
|
|
810
848
|
);
|
|
811
849
|
|
|
812
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [BATCH_TOOL, ...TOOLS] }));
|
|
850
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [HELP_TOOL, BATCH_TOOL, ...TOOLS] }));
|
|
813
851
|
|
|
814
852
|
function formatResult(name, result) {
|
|
815
853
|
if ((name === "screenshot" || name === "full_page_screenshot") && result?.dataUrl) {
|
|
@@ -837,6 +875,11 @@ function formatResult(name, result) {
|
|
|
837
875
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
838
876
|
const { name, arguments: args } = req.params;
|
|
839
877
|
try {
|
|
878
|
+
// Help: return the full usage guide (no extension needed).
|
|
879
|
+
if (name === "browser_bridge_help") {
|
|
880
|
+
return { content: [{ type: "text", text: HELP_TEXT }] };
|
|
881
|
+
}
|
|
882
|
+
|
|
840
883
|
// Batch: run multiple calls in one round-trip through the extension.
|
|
841
884
|
if (name === "batch") {
|
|
842
885
|
const calls = args?.calls;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-browser-bridge",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Connect your live Chrome tabs to Claude Code — 57 tools for debugging, performance, accessibility, device emulation, and browser automation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|