feat(connectd): native-binary connectors + companion sidecar lifecycle #2

Open
tim.lingo wants to merge 5 commits from feat/bin-native-connector into main
Owner

Native-binary connectors + companion sidecar lifecycle

Enables connectors backed by a bundled native binary (not just Node servers), with a long-running companion sidecar — needed for WhatsApp (Go MCP + a bridge that holds the paired session).

  • @bin/<file> command resolution (spawn a bundled native MCP binary) alongside @node/@bundled.
  • companion {command,args,env,healthUrl,cwd}: on connect, spawn-or-reuse the sidecar (health-probe, 401=up), then spawn the MCP; killed on disconnect + SIGINT/SIGTERM. cwd (created if missing) gives the WhatsApp bridge a writable session dir.

Additive (no effect on existing connectors). Typecheck clean. Part of WhatsApp connector (ship-the-moat #11).

## Native-binary connectors + companion sidecar lifecycle Enables connectors backed by a bundled **native binary** (not just Node servers), with a long-running companion sidecar — needed for WhatsApp (Go MCP + a bridge that holds the paired session). - `@bin/<file>` command resolution (spawn a bundled native MCP binary) alongside `@node`/`@bundled`. - `companion {command,args,env,healthUrl,cwd}`: on connect, spawn-or-reuse the sidecar (health-probe, 401=up), then spawn the MCP; killed on disconnect + SIGINT/SIGTERM. `cwd` (created if missing) gives the WhatsApp bridge a writable session dir. Additive (no effect on existing connectors). Typecheck clean. Part of WhatsApp connector (ship-the-moat #11).
tim.lingo added 4 commits 2026-06-27 20:16:57 +00:00
Make connectors work on a clean Mac with no Node/npm installed, and lay
the foundation for one-click Google sign-in.

Clean-install bundling:
- bundle scripts: `npm run bundle` -> self-contained dist/connectd.cjs (CJS,
  no node_modules); `bundle:servers` -> pre-bundled MCP servers (fs-server.mjs
  for "Your files", runs without npx); `bundle:all`.
- runtime resolution in the bridge: a connector config can use command "@node"
  (the bundled runtime, process.execPath) and arg "@bundled/<server>" (a server
  shipped alongside the bridge), resolved at spawn time via
  NEURON_CONNECTD_BUNDLE_DIR. So remote connectors + "Your files" work offline,
  zero deps.
- graceful ENOENT -> needs_setup ("coming soon") instead of a cryptic spawn
  crash for not-yet-bundled npx connectors on a clean machine.

Google OAuth foundation (google-oauth.ts):
- desktop-style authorization-code + PKCE flow, refresh, Keychain storage,
  gated on GOOGLE_OAUTH_CLIENT_ID (honest needs_setup until configured).
- new auth mode "google" for stdio connectors + /google/oauth/start and
  /google/callback endpoints. NOTE: pending the Neuron Google OAuth client +
  Google verification; not certified end-to-end yet.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds @bin/<file> command resolution alongside @node/@bundled: resolves to a native binary in the
bundled-servers dir, spawned directly (no Node runtime). Enables native MCP connectors like the Go
whatsapp-mcp. Typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds optional ServerConfig.companion {command,args,env,healthUrl}. On stdio connect, ensureCompanion
spawns the sidecar (e.g. the WhatsApp bridge) if healthUrl isn't already serving, polls health (15s),
then spawns the MCP server that talks to it. Killed on closeServer + SIGINT/SIGTERM (disposeCompanions)
so it never orphans. Reuses an already-running bridge (idempotent). Typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
companion.cwd (created if missing; ~/$HOME expanded) sets the sidecar's working directory so the
WhatsApp bridge writes its session store to a writable path (~/.neuron/whatsapp), never the read-only
app bundle. Typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tim.lingo added 1 commit 2026-07-17 15:31:31 +00:00
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/bin-native-connector:feat/bin-native-connector
git checkout feat/bin-native-connector
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tim.lingo/neuron-connectd#2