hooc-connector 0.2.0 → 0.2.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/README.md CHANGED
@@ -7,7 +7,7 @@ Claude Code / Claude app ──MCP over stdio──▶ hooc-connector ◀──W
7
7
  ```
8
8
 
9
9
  - **Claude starts it when it needs it.** It is not a background service; nothing runs while Claude isn't using it.
10
- - **Off by default in Hooc.** Hooc only connects after you click **Connect Claude** in its Settings and pair it once.
10
+ - **Off by default in Hooc.** Hooc only connects after you click **Connect AI assistant** in its Settings and pair it once.
11
11
  - **You approve anything that adds access.** New scripts, and changes that add `@grant`, `@match`/`@include` or `@connect` entries, open Hooc's review page. Code-only edits apply at once, but the old version goes to History (marked "Replaced by Claude") so you can roll back.
12
12
  - **Kill switch.** The toolbar popup and Settings can pause the connector for 1 hour, until tomorrow, or until you turn it back on. Pausing drops the connection at once and Hooc refuses every request until the pause ends.
13
13
 
@@ -24,18 +24,26 @@ You need Hooc in Chrome and either the Claude app or Claude Code. No Terminal fo
24
24
  claude mcp add --scope user hooc -- npx -y hooc-connector
25
25
  ```
26
26
 
27
- **2. Pair (once).** In Chrome, open Hooc → **Settings → Claude connector** and click **Connect Claude**. Hooc shows a one-time code like `K7QM-2XPA`. In a Claude chat, say:
27
+ - **Other AI apps that support MCP** (Gemini CLI, Cursor, VS Code with Copilot and others; Node.js 20 or newer): add a stdio server that runs `npx -y hooc-connector`. Most use this JSON (`~/.gemini/settings.json`, `~/.cursor/mcp.json`; Cursor also wants `"type": "stdio"`), and the download page has the steps per app:
28
+
29
+ ```json
30
+ { "mcpServers": { "hooc": { "command": "npx", "args": ["-y", "hooc-connector"] } } }
31
+ ```
32
+
33
+ Websites such as chatgpt.com can't start a program on your computer, so they can't use the connector.
34
+
35
+ **2. Pair (once).** In Chrome, open Hooc → **Settings → AI connector** and click **Connect AI assistant**. Hooc shows a one-time code like `K7QM-2XPA`. In a Claude chat, say:
28
36
 
29
37
  > Pair with Hooc using code K7QM-2XPA
30
38
 
31
- Claude calls `pair_with_hooc` with it, and Hooc switches to **Connected**. The code works once, expires after 10 minutes and allows 5 tries; **New code** makes a fresh one. Hooc's page says **Looking for Claude…** until the connector is running (Claude starts it when the app or a Claude Code session opens) and **Claude's connector is running** once it can take the code.
39
+ Claude calls `pair_with_hooc` with it, and Hooc switches to **Connected**. The code works once, expires after 10 minutes and allows 5 tries; **New code** makes a fresh one. Hooc's page says **Looking for the connector…** until it is running (your AI app starts it when it opens) and **The connector is running** once it can take the code. Any MCP app pairs the same way.
32
40
 
33
41
  ### Check that it works
34
42
 
35
43
  - **Claude Code:** run `/mcp`. `hooc` should be listed as connected. Then ask: *"List my Hooc scripts."*
36
44
  - **Claude app:** start a new chat and ask the same thing. The first time, Claude asks to allow the Hooc tools.
37
45
  - Ask: *"Make a Hooc script that adds a red border to every image on example.com."* Chrome shows **Claude wants to install a script**. Click **Install**, and Claude reports that you approved it.
38
- - In Hooc's popup, switch **Claude connector** off and choose **1 hour**. Ask Claude to list your scripts again: it says Hooc has paused the connector.
46
+ - In Hooc's popup, switch **AI connector** off and choose **1 hour**. Ask Claude to list your scripts again: it says Hooc has paused the connector.
39
47
 
40
48
  If the first request after starting Claude takes up to 30 seconds, that is Hooc's worker waking up to reconnect.
41
49
 
@@ -47,13 +55,13 @@ npm run build && npm run build:connector
47
55
  node connector/dist/index.js setup # prints the exact commands for this computer
48
56
  ```
49
57
 
50
- Then reload Hooc in `chrome://extensions`. `setup` prints a `claude mcp add` line and a `claude_desktop_config.json` entry that point at `connector/dist/index.js` (the Claude app needs the full path to `node`; `sh connector/add-to-claude-desktop.sh` adds it while Claude is quit). You can pair with **Connect Claude** as above, or the old way: run `node connector/dist/index.js pair` and type the code it prints into Hooc → Settings → Claude connector → **Advanced** → **Pairing code**.
58
+ Then reload Hooc in `chrome://extensions`. `setup` prints a `claude mcp add` line and a `claude_desktop_config.json` entry that point at `connector/dist/index.js` (the Claude app needs the full path to `node`; `sh connector/add-to-claude-desktop.sh` adds it while Claude is quit). You can pair with **Connect AI assistant** as above, or the old way: run `node connector/dist/index.js pair` and type the code it prints into Hooc → Settings → AI connector → **Advanced** → **Pairing code**.
51
59
 
52
60
  ## What Claude can do
53
61
 
54
62
  | Tool | What it does |
55
63
  | --- | --- |
56
- | `pair_with_hooc` | Pair with Hooc using the one-time code the user reads from Hooc's Connect Claude |
64
+ | `pair_with_hooc` | Pair with Hooc using the one-time code the user reads from Hooc's Connect AI assistant |
57
65
  | `list_scripts` | Scripts with id, version, on/off, sites, grants, `@connect` hosts |
58
66
  | `get_script` | Full source, parsed header, Hooc settings and tags |
59
67
  | `get_logs` | Captured console output and errors (per script, level filter, newest N) |
@@ -72,7 +80,7 @@ Claude can't delete scripts for good, restore from the Trash, export backups, ch
72
80
 
73
81
  ```bash
74
82
  npx -y hooc-connector # MCP server on stdio (what Claude runs); or node connector/dist/index.js
75
- npx -y hooc-connector pair # one-time code to type into Hooc (developers; users use Connect Claude)
83
+ npx -y hooc-connector pair # one-time code to type into Hooc (developers; users use Connect AI assistant)
76
84
  npx -y hooc-connector unpair # forget the paired Hooc (it has to pair again)
77
85
  npx -y hooc-connector status # address, config folder, paired or not
78
86
  npx -y hooc-connector setup # setup steps for this computer
@@ -85,7 +93,7 @@ Environment variables, or `~/.hooc-connector/config.json` (for example `{ "port"
85
93
  | Variable | Default | Meaning |
86
94
  | --- | --- | --- |
87
95
  | `HOOC_CONNECTOR_HOST` | `127.0.0.1` | Address the WebSocket server listens on |
88
- | `HOOC_CONNECTOR_PORT` | `17345` | Port. Change Hooc's server address to match (Settings → Claude connector → Advanced). In the Claude app it's the extension's **Port** setting |
96
+ | `HOOC_CONNECTOR_PORT` | `17345` | Port. Change Hooc's server address to match (Settings → AI connector → Advanced). In the Claude app it's the extension's **Port** setting |
89
97
  | `HOOC_CONNECTOR_HOME` | `~/.hooc-connector` | Folder for `config.json` and `state.json` |
90
98
 
91
99
  `state.json` holds the pairing token. It is created readable by you only (mode 600).
@@ -96,7 +104,7 @@ Environment variables, or `~/.hooc-connector/config.json` (for example `{ "port"
96
104
  - New scripts, and changes that add permissions, open Hooc's review page. If Claude changed a script's code directly and then wants to run it on your open tab, Hooc shows the code and the tab first and runs it only after you click **Run once** (it remembers that until Chrome restarts, for that exact code).
97
105
  - Web pages can't connect. Browsers always send a page's `Origin`, and the connector only accepts `chrome-extension://` origins (after pairing, only that one Hooc). A second connector (see below) sends no Origin and must have the token.
98
106
  - Every socket must authenticate within 5 seconds: Hooc with its token, Hooc waiting to pair, a pair-command code, or a code passed on by a second connector.
99
- - **Connect Claude pairing:** Hooc makes the code, shows it only on its own Settings page and keeps it in `chrome.storage.session` (gone when Chrome closes, never in backups). It never sends the code anywhere. The connector forwards whatever code Claude was given to the Hooc that is waiting, and Hooc says yes or no. Only after a yes does the connector make a token, and it sends it on that same socket, so the token belongs to the extension that showed the code. Hooc ignores a "paired" message it didn't say yes to. Guessing is hopeless: about 39 bits, 5 tries per code (then the code is thrown away), 10 minutes, and the connector accepts at most one try a second and 10 per 10 minutes. Another program on this computer could try codes through the connector too, but it can't see the code and gets the same limits.
107
+ - **Pairing through chat (Connect AI assistant):** Hooc makes the code, shows it only on its own Settings page and keeps it in `chrome.storage.session` (gone when Chrome closes, never in backups). It never sends the code anywhere. The connector forwards whatever code Claude was given to the Hooc that is waiting, and Hooc says yes or no. Only after a yes does the connector make a token, and it sends it on that same socket, so the token belongs to the extension that showed the code. Hooc ignores a "paired" message it didn't say yes to. Guessing is hopeless: about 39 bits, 5 tries per code (then the code is thrown away), 10 minutes, and the connector accepts at most one try a second and 10 per 10 minutes. Another program on this computer could try codes through the connector too, but it can't see the code and gets the same limits.
100
108
  - Pair-command codes (developers): single-use, expire after 10 minutes and stop working after 5 wrong tries.
101
109
  - Hooc checks every request against a fixed list of methods and validates the parameters before acting. The token lives in `chrome.storage.local` under its own key, so it never ends up in a Hooc backup.
102
110
  - Limit: a program running as you that grabs port 17345 before the connector starts could pose as the connector to Hooc (it would still need Hooc's review page for new scripts and added permissions). That's true of any local helper; programs running as you can already read your files.
@@ -107,9 +115,9 @@ Each app starts its own connector. The first one takes the port; the second noti
107
115
 
108
116
  ## Troubleshooting
109
117
 
110
- - **"Hooc isn't connected"**: Chrome is closed, the connector is off in Hooc, or Hooc is still waking up. Open Hooc → Settings → Claude connector and click **Connect now**.
111
- - **"isn't paired"**: click **Connect Claude** in Hooc and tell Claude the code.
112
- - **"Hooc isn't waiting for a pairing code"**: Hooc's Connect Claude page isn't showing a code, or Chrome is closed. Click **Connect Claude** (or **New code**) and try again.
118
+ - **"Hooc isn't connected"**: Chrome is closed, the connector is off in Hooc, or Hooc is still waking up. Open Hooc → Settings → AI connector and click **Connect now**.
119
+ - **"isn't paired"**: click **Connect AI assistant** in Hooc and tell Claude the code.
120
+ - **"Hooc isn't waiting for a pairing code"**: Hooc's Connect AI assistant section isn't showing a code, or Chrome is closed. Click **Connect AI assistant** (or **New code**) and try again.
113
121
  - **Hooc stays on "Looking for Claude…"**: the connector isn't running. Open the Claude app (or start Claude Code) and check the connector is installed (Claude app: Settings → Extensions; Claude Code: `/mcp`). If you changed the port, set the same port under **Advanced** in Hooc.
114
122
  - **Pairing says "Unknown token" later**: you ran `unpair`, reinstalled the connector, or paired another Chrome profile. Unpair in Hooc and connect again.
115
123
  - **Port in use by something else**: set `HOOC_CONNECTOR_PORT` (or `config.json`) and change Hooc's server address to match.
@@ -26611,10 +26611,10 @@ var ConnectorError = class extends Error {
26611
26611
  }
26612
26612
  };
26613
26613
  function notConnected() {
26614
- return new ConnectorError("Hooc isn't connected. Open Chrome, then check that the Claude connector is turned on in Hooc (Settings → Claude connector) and paired. If it says \"Not connected\", click \"Connect now\" there.", "not_connected");
26614
+ return new ConnectorError("Hooc isn't connected. Open Chrome, then check that the AI connector is turned on in Hooc (Settings → AI connector) and paired. If it says \"Not connected\", click \"Connect now\" there.", "not_connected");
26615
26615
  }
26616
26616
  function notPaired() {
26617
- return new ConnectorError("The connector isn't paired with Hooc yet. Ask the user to open Chrome, go to Hooc → Settings → Claude connector and click \"Connect Claude\". Hooc then shows a one-time code; when the user tells you the code, call pair_with_hooc with it.", "not_paired");
26617
+ return new ConnectorError("The connector isn't paired with Hooc yet. Ask the user to open Chrome, go to Hooc → Settings → AI connector and click \"Connect AI assistant\". Hooc then shows a one-time code; when the user tells you the code, call pair_with_hooc with it.", "not_paired");
26618
26618
  }
26619
26619
  /** "14:30", or "Thu 14:30" when it isn't today, or "until it is turned back on". */
26620
26620
  function pausedLabel(until, now = Date.now()) {
@@ -26627,7 +26627,7 @@ function pausedLabel(until, now = Date.now()) {
26627
26627
  return `until ${new Date(now).toDateString() === d.toDateString() ? time : `${d.toLocaleDateString("en-GB", { weekday: "short" })} ${time}`}`;
26628
26628
  }
26629
26629
  function paused(until) {
26630
- return new ConnectorError(`Hooc has paused the Claude connector ${pausedLabel(until)} (the kill switch in Hooc's popup or Settings). Don't retry now; ask the user to resume it in Hooc if they want you to continue.`, "paused");
26630
+ return new ConnectorError(`Hooc has paused the AI connector ${pausedLabel(until)} (the kill switch in Hooc's popup or Settings). Don't retry now; ask the user to resume it in Hooc if they want you to continue.`, "paused");
26631
26631
  }
26632
26632
  // src/pair-code.ts
26633
26633
  /** No 0/O, 1/I/L: easy to read off a screen and say or type. */
@@ -30492,7 +30492,7 @@ function parseFrame(raw) {
30492
30492
  }
30493
30493
  // src/version.ts
30494
30494
  var SERVER_NAME = "hooc-connector";
30495
- var VERSION = "0.2.0";
30495
+ var VERSION = "0.2.1";
30496
30496
  // src/relay.ts
30497
30497
  var RelayClient = class {
30498
30498
  url;
@@ -30632,7 +30632,7 @@ var AUTH_TIMEOUT_MS = 5e3;
30632
30632
  var VERDICT_TIMEOUT_MS = 1e4;
30633
30633
  /** How long a code passed on by a second connector waits for Hooc's pairing socket. */
30634
30634
  var RELAYED_PAIR_WAIT_MS = 15e3;
30635
- var NO_HOOC_WAITING = "Hooc isn't waiting for a pairing code. Ask the user to open Chrome, go to Hooc → Settings → Claude connector, click \"Connect Claude\" and tell you the code it shows. If Hooc already shows a code and says it is looking for Claude, wait a few seconds and try again.";
30635
+ var NO_HOOC_WAITING = "Hooc isn't waiting for a pairing code. Ask the user to open Chrome, go to Hooc → Settings → AI connector, click \"Connect AI assistant\" and tell you the code it shows. If Hooc already shows a code and says it is looking for the connector, wait a few seconds and try again.";
30636
30636
  var ExtensionHub = class {
30637
30637
  cfg;
30638
30638
  log;
@@ -30924,7 +30924,7 @@ var ExtensionHub = class {
30924
30924
  }
30925
30925
  if (this.waiting !== w || w.ws.readyState !== w.ws.OPEN) return {
30926
30926
  ok: false,
30927
- message: "Hooc stopped waiting for the code. Ask the user to click \"Connect Claude\" again."
30927
+ message: "Hooc stopped waiting for the code. Ask the user to click \"Connect AI assistant\" again."
30928
30928
  };
30929
30929
  const token = newToken();
30930
30930
  updateState(this.cfg, (s) => ({
@@ -30942,7 +30942,7 @@ var ExtensionHub = class {
30942
30942
  server: `${SERVER_NAME} ${VERSION}`,
30943
30943
  protocol: 1
30944
30944
  }));
30945
- this.log(`paired with ${w.client} (${w.origin}) through Claude`);
30945
+ this.log(`paired with ${w.client} (${w.origin}) through chat`);
30946
30946
  this.attachExtension(w.ws, token, w.client, false);
30947
30947
  this.onPaired?.();
30948
30948
  return {
@@ -31222,7 +31222,7 @@ function registerTools(server, link) {
31222
31222
  }
31223
31223
  server.registerTool("pair_with_hooc", {
31224
31224
  title: "Pair with Hooc",
31225
- description: "Connect this connector to Hooc, once. The user clicks \"Connect Claude\" in Hooc (Settings → Claude connector) and Hooc shows a one-time code like K7QM-2XPA. Call this with the code the user tells you in this conversation; never guess or make one up. Hooc checks the code: it works once, expires after 10 minutes and allows 5 tries. If it says Hooc isn't waiting, ask the user to click \"Connect Claude\" and read you the code.",
31225
+ description: "Connect this connector to Hooc, once. The user clicks \"Connect AI assistant\" in Hooc (Settings → AI connector) and Hooc shows a one-time code like K7QM-2XPA. Call this with the code the user tells you in this conversation; never guess or make one up. Hooc checks the code: it works once, expires after 10 minutes and allows 5 tries. If it says Hooc isn't waiting, ask the user to click \"Connect AI assistant\" and read you the code.",
31226
31226
  inputSchema: { code: string().min(4).max(40).describe("The pairing code Hooc shows, exactly as the user gave it (dashes and case don't matter)") },
31227
31227
  annotations: {
31228
31228
  destructiveHint: false,
@@ -31347,7 +31347,7 @@ function registerTools(server, link) {
31347
31347
  });
31348
31348
  server.registerTool("update_script", {
31349
31349
  title: "Change a Hooc script",
31350
- description: "Replace an installed script's source. Code-only changes apply at once (the old version is saved to Hooc's history, marked as changed by Claude, so the user can roll back). If the new header adds @grant, @match/@include or @connect entries, Hooc opens its review page and waits for the user, like create_script. Bump @version when you change a script.",
31350
+ description: "Replace an installed script's source. Code-only changes apply at once (the old version is saved to Hooc's history, marked as changed by AI, so the user can roll back). If the new header adds @grant, @match/@include or @connect entries, Hooc opens its review page and waits for the user, like create_script. Bump @version when you change a script.",
31351
31351
  inputSchema: {
31352
31352
  id: scriptId,
31353
31353
  code: fullCode
@@ -31557,7 +31557,7 @@ function warnIfExposed(cfg) {
31557
31557
  if (!isLoopback(cfg.host)) log(`WARNING: listening on ${cfg.host}, not just this computer. Traffic is plain ws:// (no TLS yet); only do this on a network you trust.`);
31558
31558
  }
31559
31559
  var INSTRUCTIONS = `Hooc is the user's own userscript manager for Chrome. These tools read and change the scripts installed in it.
31560
- - Not paired yet? Ask the user to click "Connect Claude" in Hooc (Settings → Claude connector) and tell you the code it shows, then call pair_with_hooc.
31560
+ - Not paired yet? Ask the user to click "Connect AI assistant" in Hooc (Settings → AI connector) and tell you the code it shows, then call pair_with_hooc.
31561
31561
  - Use list_scripts first to find script ids.
31562
31562
  - Write complete userscripts with a // ==UserScript== header (@name, @version, @match, @grant, …); follow the hooc-script skill when it is available.
31563
31563
  - create_script always asks the user on Hooc's review page; update_script asks only when the header adds permissions. When a call returns "pending", tell the user to look at Chrome, then use check_approval.
@@ -31592,7 +31592,7 @@ async function pair() {
31592
31592
  const url = serverUrl(cfg);
31593
31593
  const minutes = Math.round(CODE_TTL_MS / 6e4);
31594
31594
  console.log(`\nPairing code: ${code}\n`);
31595
- console.log(`In Chrome: Hooc → Settings → Claude connector. Turn it on, check the server URL is ${url}, enter the code and click Pair.`);
31595
+ console.log(`In Chrome: Hooc → Settings → AI connector. Turn it on, check the server URL is ${url}, enter the code and click Pair.`);
31596
31596
  console.log(`The code works once and expires in ${minutes} minutes.\n`);
31597
31597
  const hub = new ExtensionHub(cfg, () => void 0);
31598
31598
  if (await hub.start() === "busy") {
@@ -31646,8 +31646,9 @@ function setup() {
31646
31646
  1. Add the connector to Claude (once):
31647
31647
  Claude app: download hooc-connector.mcpb from ${DOWNLOAD_URL}, open it, click Install.
31648
31648
  Claude Code: claude mcp add --scope user hooc -- npx -y hooc-connector
31649
+ Other MCP apps (Gemini CLI, Cursor, VS Code…): ${DOWNLOAD_URL}#other-apps
31649
31650
 
31650
- 2. Pair: in Chrome open Hooc → Settings → Claude connector, click "Connect Claude",
31651
+ 2. Pair: in Chrome open Hooc → Settings → AI connector, click "Connect AI assistant",
31651
31652
  and tell Claude the code it shows ("Pair with Hooc using code ABCD-2345").
31652
31653
 
31653
31654
  For developers running this copy (${entry}):
@@ -31658,15 +31659,15 @@ ${JSON.stringify({ mcpServers: { hooc: {
31658
31659
  args: [entry]
31659
31660
  } } }, null, 2).replace(/^/gm, " ")}
31660
31661
  Pair with a code from the terminal instead: "${node}" "${entry}" pair
31661
- (Hooc → Settings → Claude connector → Advanced). Server address: ${serverUrl(cfg)}
31662
+ (Hooc → Settings → AI connector → Advanced). Server address: ${serverUrl(cfg)}
31662
31663
  `);
31663
31664
  }
31664
31665
  function help() {
31665
- console.log(`${SERVER_NAME} ${VERSION}: lets Claude manage scripts in Hooc.
31666
+ console.log(`${SERVER_NAME} ${VERSION}: lets Claude (or another MCP app) manage scripts in Hooc.
31666
31667
 
31667
31668
  Usage:
31668
31669
  ${command} run the MCP server on stdio (Claude starts this)
31669
- ${command} pair print a one-time code to type into Hooc (or: click Connect Claude in Hooc and tell Claude its code)
31670
+ ${command} pair print a one-time code to type into Hooc (or: click Connect AI assistant in Hooc and tell Claude its code)
31670
31671
  ${command} unpair forget the paired Hooc
31671
31672
  ${command} status show settings and pairing
31672
31673
  ${command} setup print the exact setup steps for Claude Code and the Claude app
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hooc-connector",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Lets Claude (the Claude app or Claude Code) manage the userscripts in Hooc, a userscript manager for Chrome. A local MCP server.",
5
5
  "license": "MIT",
6
6
  "keywords": [