Skip to content

feat: add connectors and local connection vault for providers and MCP - #188

Merged
sanchitrk merged 3 commits into
canaryfrom
feat-connectors-auth
Dec 1, 2026
Merged

sanchitrk merged 3 commits into
canaryfrom
feat-connectors-auth

Conversation

@sanchitrk

@sanchitrk sanchitrk commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Adds v1 of Connectors & Connections across the schema, plugin contract, harness, host RPC server, CLI, and desktop app. Static Connector definitions from https://catalog.codework.sh/v1/connectors.json (with a bundled offline fallback) are instantiated into workspace-scoped Connections whose credentials live only on the host in a dedicated 0600 SQLite vault (<home>/connections.db), never in codework.db, settings files, or Relay.

Schemas & Plugin Contract (packages/schema, packages/plugin)

  • Added @codeworksh/schema/connector with bare UUIDv7 ConnectionID, ConnectorSpec (kinds: ["provider" | "mcp" | "integration"]), ConnectionSummary, ConnectionConfig, OAuth/device-code wire types, hostMatches, tagged errors, and the bundled 6-entry v1 catalog (com.anthropic, com.openai, com.openai.codex, com.github.copilot, ai.openrouter, app.linear).
  • Added @codeworksh/plugin/connector (Broker contract) and extended HTTP MCP server auth in @codeworksh/plugin with { connection }.
  • Added 12 Host RPCs (connectors.catalog, connections.*, connections.oauth.*) to @codeworksh/schema/host.

Host Vault, Catalog Cache, OAuth & CLI (packages/codework)

  • Added <home>/connections.db (0600, WAL, connection / credential / meta tables) with one-time non-destructive import of legacy <home>/aikit/auth.json logins.
  • Added If-None-Match ETag disk caching at <home>/cache/connectors.json with offline fallback.
  • Implemented OAuth 2.1 + PKCE + RFC 9728/8414 discovery + RFC 7591 DCR + built-in openai-codex and github-copilot handlers (reusing @codeworksh/aikit/oauth/* without changing packages/aikit), with single-flight refresh locking and allowedHosts validation.
  • Supported all three auth modes (oauth defaulting to personal, apikey defaulting to shared, and read-only machine-global host env projection) with stored-over-env precedence (explicit -> default -> env -> single-match).
  • Added codework connect discover|categories|create|login|list|status|disconnect|remove (both in-process and --server), preserving bare codework connect for machine workspace linking and keeping legacy codework auth / codework mcp login working.

Harness Wiring (packages/harness)

  • Wired Connector.Broker into LLM.openWith, ModelCatalog.Credentials, Mcp.layer, and State so providers resolve credentials through the broker and enabled mcp Connections auto-register into sessions (with explicit mcp.json entries taking precedence).

Desktop App (apps/contract, apps/server, apps/web)

  • Added 12 desktop RPCs (connectors.catalog, connections.*, streaming connections.oauth.run with client-side loopback callback listener, connections.oauth.finish, deviceStart, devicePoll), all supporting machineId routing for local and paired hosts.
  • Added Settings -> Connectors with three pages (Providers, MCP Connectors, Integrations), inline connect/reconnect/device-code disclosures, provider brand marks, a Category Drill-In directory for MCP Connectors and Integrations, Personal Workspace-aware copy, and a shared machine picker (<MachinePicker>).

Docs (docs/internals)

  • Updated 00_glossary.md, 03_models.md, 08_plugins.md, and 09_server.md to document Connectors, Connections, connections.db, auto-registered MCP connections, and the client-loopback / host-exchange OAuth split.

Testing

  • vp run verify (vp check, builds, package typechecks, knip files/deps/exports): passed (0 issues).
  • App checks & typechecks (@codeworksh/contract, @codeworksh/server, @codeworksh/web): passed.
  • E2E suites:
    • packages/codework/test/connector.test.ts (4/4 passed, with artifacts in packages/codework/test/__artifacts__/connector.*.json).
    • packages/codework/test/server.test.ts (42/42 passed).
    • packages/harness/test/mcp.oauth.test.ts & packages/harness/test/model.catalog.test.ts (3/3 passed).
  • Live end-to-end checks against a throwaway dev home (.scratch/home), local Relay, dev RPC server, and Electron (CodeWork Local):
    • Verified live https://catalog.codework.sh/v1/connectors.json fetch (200) and ETag cache creation.
    • Verified stored API key (com.openai/default in connections.db with no OPENAI_API_KEY in the server env) with a real openai/gpt-4o-mini turn via --server and live streaming into Electron.
    • Verified in-process read-only host env projection (com.openai/env) with a real openai/gpt-4o-mini turn on an empty temp home.
    • Verified live Linear MCP OAuth (app.linear/default, personal) through the Electron UI and a real session querying the 5 latest Linear issues with zero manual mcp.json setup.
    • Verified Settings -> Providers / MCP Connectors / Integrations (overview, inline connect for OAuth & API Key, and category drill-in) and the machine picker popover in Electron across both Light and Dark themes.
    • Skipped: interactive live browser/device OAuth login against real openai-codex and github-copilot accounts (covered against local mock OAuth servers in connector.test.ts).

Built with Gemini (Antigravity).

@sanchitrk
sanchitrk merged commit e6d0f92 into canary Dec 1, 2026
3 checks passed
@sanchitrk
sanchitrk deleted the feat-connectors-auth branch December 1, 2026 11:50
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.

1 participant