Implement a dev-mode MCP bridge for the Tabvana Chrome extension so LLM clients (Claude Code, Gemini CLI) can query the IndexedDB tab database.

# Architecture (dev-only — skip native messaging)

A single Node.js daemon `tabvana-mcp-bridge` that:
1. Listens on `ws://127.0.0.1:7878` for the extension to connect.
2. Serves MCP over Streamable HTTP at `http://127.0.0.1:7878/mcp` for LLM clients (same port, different path).
3. Routes MCP tool calls to the extension via WebSocket and returns results.

In dev (`import.meta.env.DEV`), the extension's service worker auto-connects to the bridge on startup with exponential-backoff reconnect (1s → 30s cap).

# Read-only tool surface (v1, no mutations)

- `search_pages(query, limit?=20)` — reuse existing `pageSearchIndex` (MiniSearch)
- `get_page(url)` — single `DBPage`
- `list_tags()` — `{name, pageCount}[]`
- `get_pages_by_tag(tag, limit?=100)`
- `find_similar(url, limit?=10)` — reuse the existing similarity worker; await result
- `recent_pages(limit?=20)` — sorted via `lastActiveDesc` index
- `get_stats()` — `{pageCount, tagCount, embeddedCount}`

Trim returned objects: a `compactPage(p: DBPage)` helper drops `embedding`, `accessTimes`, the `*Desc` fields, and the URL-graph arrays (noisy in LLM context).

# Protocol bridge ↔ extension (JSON over WS)

Request:  `{"id": "req_1", "method": "search_pages", "params": {"query": "react", "limit": 20}}`
Response: `{"id": "req_1", "result": [...]}` or `{"id": "req_1", "error": {"code": "...", "message": "..."}}`

Bridge keeps a pending-request map with a 30s timeout. If no extension is connected when a tool is invoked, return a structured MCP error: "Tabvana extension not connected — load the dev build and open the main UI tab to wake the service worker."

# Files to create

1. `mcp-bridge/package.json` — deps: `@modelcontextprotocol/sdk`, `ws`, `zod`, `tsx` (dev). Add a top-level repo script `yarn mcp-bridge` → `tsx mcp-bridge/src/server.ts`.
2. `mcp-bridge/src/server.ts` — WS server + MCP server with Streamable HTTP transport on `/mcp`, tool registrations with Zod schemas.
3. `mcp-bridge/src/extensionBridge.ts` — manages the active WS connection; exposes `call(method, params): Promise<unknown>`; one connection at a time; reconnection-tolerant.
4. `mcp-bridge/src/types.ts` — `CompactPage`, request/response shapes.
5. `mcp-bridge/README.md` — setup and config (see below).
6. `src/background/mcpDevClient.ts` — extension-side WS client; only imported when `import.meta.env.DEV`; backoff reconnect; method dispatch table mapping to existing functions in `db/pages.ts`, `services/pageSearchIndex.ts`, the similarity worker, etc.
7. Wire `mcpDevClient.start()` from `src/background/index.ts`, gated on `import.meta.env.DEV`.

# README must cover

- One-command launch (`yarn mcp-bridge` from repo root) and the listening log line.
- Loading the dev extension build; note that the main UI tab must be opened once to wake the SW.
- Confirming the WS connected ("Extension connected" log line on the bridge).
- Configuring Claude Code: exact `claude mcp add` command (verify current syntax for streamable-http transport).
- Configuring Gemini CLI: `~/.gemini/settings.json` snippet using the URL form.
- Tool reference: each tool, its params, sample output.
- Troubleshooting: extension not connected → reload; port in use → `PORT` env var.

# Constraints

- Strictly read-only — no `addTag` / `removeTag` / `deletePage` exposed.
- Tool handlers must NOT enqueue `generateEmbedding` or `fetchMissingTitle` ops. `find_similar` returns an error for un-embedded URLs; it does not trigger embedding.
- Reuse existing query helpers — do not open new transactions that contend with `dbSync` writes.
- `yarn build` and `yarn lint` must pass.
- No new deps in the main extension beyond the small dev WS client.

# Verification (include in your summary)

- The exact `claude mcp add` command that worked end-to-end.
- One sample tool call and trimmed output.
- Confirmation that `yarn build` and `yarn lint` are clean.

# Do NOT

- Set up native messaging hosts, manifests, or installers.
- Add cloud sync or any external DB.
- Expose mutations or trigger background enqueues.
- Add tests (dev-only, v1).
