Hubcap Bridge: Persistent Two-Way Messaging Between CLI and Browser JavaScript via CDP

✍️ OpenClawRadar📅 Published: April 7, 2026🔗 Source
Hubcap Bridge: Persistent Two-Way Messaging Between CLI and Browser JavaScript via CDP
Ad

What Hubcap Bridge Does

Hubcap Bridge establishes a persistent two-way message channel between a local process and JavaScript running in a browser page using the Chrome DevTools Protocol. This addresses the gap where web apps lack public APIs or developers don't have access to them, but the apps have rich client-side JavaScript APIs powering their UI.

Key Features and Usage

The bridge command syntax is:

hubcap bridge --target "$TAB" ' for await (const msg of messages) { const result = await window.appAPI.query(msg.sql); send({rows: result}); } '

Communication happens via stdin/stdout carrying LDJSON format. Heartbeats detect disconnection, and multiple bridges can run in the same tab.

Practical Applications

This enables building Claude Code skills that include a local server kept in sync with a web page through its internal APIs. The server uses bridge to push and pull data through the page's JavaScript layer, with Claude communicating to the server. This approach avoids HTML scraping and doesn't require waiting for someone to build an MCP server.

Because CDP-injected code runs in the page's own context, there are no CORS, CSP, or mixed content issues to work around. The author notes: "If you can call it from the browser console, you can pipe it through bridge."

Ad

Additional Release Notes

Also in this release: eval now supports top-level await.

Important Consideration

The source includes this note: "(Make sure you're staying within the terms of service of whatever you're integrating with.)"

Resources

  • Blog post: https://tomyandell.dev/blog/hubcap-bridge
  • Hubcap plugin: https://github.com/tomyan/claude-skill-hubcap
  • Docs: https://hubcap.tomyandell.dev
  • Source: https://github.com/tomyan/hubcap

📖 Read the full source: r/ClaudeAI

Ad

👀 See Also

A System for Claude Code to Learn Your Project Over Time
Tools

A System for Claude Code to Learn Your Project Over Time

A developer created a simple setup to help Claude Code retain context between sessions by adding a CLAUDE.md file, a docs folder with project conventions, and three prompts for bootstrapping, refining, and capturing patterns.

OpenClawRadar
User-built PTC for Claude Code shows 40-65% token savings on analysis tasks, not code writing
Tools

User-built PTC for Claude Code shows 40-65% token savings on analysis tasks, not code writing

A developer built a local PTC implementation called Thalamus for Claude Code and analyzed 79 real sessions, finding 40-65% token savings on analysis tasks but near-zero savings on code-writing tasks. The agent used execute() primarily for general Python computation rather than batching tool calls.

OpenClawRadar
Pneuma: An AI-Generated Desktop Environment Where Software Materializes from Descriptions
Tools

Pneuma: An AI-Generated Desktop Environment Where Software Materializes from Descriptions

Pneuma is a desktop computing environment where you describe what you want—a CPU monitor, game, notes app, or data visualizer—and a working program materializes in seconds. The system generates self-contained Rust modules, compiles them to WebAssembly, and executes them in sandboxed Wasmtime instances with GPU rendering via wgpu.

OpenClawRadar
4-layer self-audit system for OpenClaw behavioral evolution
Tools

4-layer self-audit system for OpenClaw behavioral evolution

A developer built a 4-layer audit system where Gemini reviews Claude's blind spots weekly, catching patterns Claude missed in self-review. The system includes post-fix verification, pattern mining, external mirroring, and expectation vs reality checks.

OpenClawRadar