Skip to content

docs: rewrite "How it works" with detailed architecture and data flow#4

Merged
jazelly merged 1 commit into
mainfrom
copilot/improve-readme-explanation
Apr 5, 2026
Merged

docs: rewrite "How it works" with detailed architecture and data flow#4
jazelly merged 1 commit into
mainfrom
copilot/improve-readme-explanation

Conversation

Copilot AI commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

The existing "How it works" section was a vague 4-line paragraph that didn't explain the actual architecture or data flow. It also contained a typo (__REACT_GLOBAL_DEVTOOLS_HOOK____REACT_DEVTOOLS_GLOBAL_HOOK__).

Replaced with:

  • Architecture diagram — ASCII visual showing the three-layer communication: MCP Client ↔ Vite Dev Server (SSE/HTTP) ↔ Browser (HMR WebSocket)
  • Step-by-step walkthrough covering:
    • Babel AST pass collecting user-defined component names at transform time
    • Browser-side injection: bippy's __REACT_DEVTOOLS_GLOBAL_HOOK__, fiber root tracking, window.__VITE_REACT_MCP_TOOLS__ registry, and HMR listeners
    • MCP server SSE transport (/sse + /messages endpoints) with Zod-derived JSON Schema tool advertisements
    • Full tool call lifecycle: JSON-RPC request → schema validation → HMR custom event → browser execution against live fiber tree → HMR response → SSE stream back
    • Custom tools following the same WebSocket round-trip via dynamic import() registration

@jazelly jazelly marked this pull request as ready for review April 5, 2026 10:57
@jazelly jazelly self-requested a review April 5, 2026 11:00
@jazelly jazelly merged commit 0428906 into main Apr 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants