Skip to content

feat(den): one-click Gmail, Drive, and Calendar with an OpenWork-provided Google client - #4342

Closed
reachjalil wants to merge 4 commits into
feature/connector-catalog-popular-firstfrom
feature/one-click-google-workspace-connector
Closed

reachjalil wants to merge 4 commits into
feature/connector-catalog-popular-firstfrom
feature/one-click-google-workspace-connector

Conversation

@reachjalil

@reachjalil reachjalil commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

Review readiness — 2026-09-04: Incomplete. This PR is open for review. Required current-head journey evidence and upstream review have not yet been verified in this cleanup. This depends on a parent PR; upstream checks and Warden must run after it targets dev. Historical checks below retain their original scope and do not establish current merge readiness.

Stacked on #4305 (Connectors UI). This is the connector tech layer: the OpenWork-provided Google OAuth client and the one-click Connect it unlocks in the catalog. Merge #4305 first, then retarget this PR to dev. Head 37b65c0bd is rebased onto #4305 @ 097bf685b (itself on dev @ 59cb5a3be).

Remaining implementation in this PR: the new connector detail page (from #4305) still labels an unconfigured Gmail/Drive/Calendar as guided Set up; with a published org-wide Google client it should offer Connect like the catalog rows do (connectorDetailEffort / connectorDetailPrimaryAction in connector-detail.ts).

Stacked on #4305 (feature/connector-catalog-popular-first); review and merge bottom-up. This PR contains only its own commit.

Problem

Even with the popular-first catalog, Gmail, Google Drive, and Google Calendar were never one click: every organization had to register its own Google OAuth app first. The catalog's + opened the client dialog, getOrgOAuthClient had no default to fall back to, and members saw nothing on Your Connections until an admin had pasted a client.

Change

Den API

  • New optional pair DEN_CONNECTOR_GOOGLE_WORKSPACE_CLIENT_ID / DEN_CONNECTOR_GOOGLE_WORKSPACE_CLIENT_SECRET (env.connectorOAuthClients). Setting one without the other fails startup. These are distinct from GOOGLE_CLIENT_ID, which configures Den sign-in.
  • resolveOAuthClient(orgId, providerId) in oauth-credentials.ts: the org's own saved client when it exists, otherwise the OpenWork-provided default — for the literal native provider key only (google-workspace). Connector rows and external MCP connections keep reading getOrgOAuthClient; writes are unchanged, so an org override is always a real row.
  • Read sites moved to the resolver: connect start, the callback exchange, token refresh (getValidAccessToken), the org-wide usable entry in listNativeProviderUsableEntries, and both credential-id resolvers. Net effect: with the variables set, the connector appears on every member's Your Connections with Connect your account, no admin setup.
  • GET /v1/oauth-providers/:providerId/client adds source: "org" | "openwork" | null.
  • OAuthClientCredentials (Pick<OrgOAuthClientRow, "clientId" | "clientSecret" | "extra">) replaces the full row type on the OAuth helpers — a type-only widening.

Den web

  • Popular rows show a Connect button when a published per-person connection exists that the caller has not signed in to yet (the org-wide Google entry with the provided client, or any other per-member OAuth connection). The options menu stays; Uninstall is still hidden for the org-wide Google entry.
  • + on Gmail / Drive / Calendar, and ?quickAdd=google-workspace, start the Google sign-in directly when an org-wide client exists (own or provided) and only open first-time setup when none does (popularAddAction).
  • The Google dialog names the OpenWork-provided client, disables Save (permission changes need the org's own client), and offers Use your own client as the override.

Docs

  • shared-mcp-connections.mdx: the two variables, the native-provider redirect URL to register (<DEN_API_PUBLIC_URL>/v1/oauth-providers/google-workspace/connect/callback), and the override path.

Out of scope (follow-ups)

  • Slack / GitHub presets (requiresOAuthClient): their client is loaded by the MCP-SDK persistence layer (enterprise-mcp-oauth-persistence.ts), which reads the table directly and checks the registered redirect URI; a provided-client fallback there is a separate change.
  • Microsoft 365: Den requires the organization's Entra tenant id by design (normalizeEntraTenantId rejects common/organizations), so a provided multitenant client still needs one admin input; needs its own design.

Verification

Head d7a1bbf20 (base a1cf769e7 = #4305 rebased onto dev dad6a79e3).

Passed

  • den-api: bun test --conditions development test/connector-oauth-client-env.test.ts test/openwork-provided-oauth-client.test.ts test/native-provider-scopes.test.ts — 14 passed (env pairing incl. startup refusal; resolver precedence with a mocked db; no fallback for connector rows, other providers, or prototype names). pnpm test (CI lane) — 21 passed.
  • den-web: bun test tests/connector-catalog.test.ts tests/connector-catalog-render.test.tsx — 17 passed (decision table, Connect-button render with/without sign-in, busy state). pnpm test — 165 passed. tsc --noEmit clean.
  • den-api tsc --noEmit: only the three pre-existing @openwork/mcp-apps/* artifact errors, identical on the parent branch.
  • pnpm evals:pr specs/spec-impact.test.ts specs/connector-chat-deep-link.test.ts — 7 passed.

Incomplete — remaining verification

  • The runtime-observable journey (Den configured with the variables → admin clicks Connect on Gmail → Google authorization → member sees the connector) has no testkit E2E run yet. Daytona credentials were not available; the local Den lane was not run because the only MySQL/Redis listeners on this machine are SSH tunnels to an unknown remote. A Den-driving spec should extend connectors-quick-add.e2e.test.ts with a world that sets DEN_CONNECTOR_GOOGLE_WORKSPACE_* against the fake OAuth server pattern used in native-provider-connections.test.ts.

Skipped

@vercel

vercel Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 4, 2026 6:55pm UTC
openwork-den Ready Ready Preview Sep 4, 2026 6:55pm UTC
openwork-diagnostics Ready Ready Preview Sep 4, 2026 6:55pm UTC
openwork-landing Ready Ready Preview, v0 Sep 4, 2026 6:55pm UTC

@reachjalil
reachjalil force-pushed the feature/connector-catalog-popular-first branch from a1cf769 to 7caf2ce Compare September 3, 2026 22:12
@reachjalil
reachjalil force-pushed the feature/one-click-google-workspace-connector branch from d7a1bbf to 840bd3a Compare September 3, 2026 22:12
@reachjalil
reachjalil force-pushed the feature/connector-catalog-popular-first branch from 7caf2ce to f829f34 Compare September 4, 2026 18:49
@reachjalil
reachjalil force-pushed the feature/one-click-google-workspace-connector branch from 840bd3a to c282e32 Compare September 4, 2026 18:49
… chat handoff

The Connectors page now opens on the connectors people actually reach for
instead of a wall of MCP tiles above the org's connection list.

Den web
- Popular section (Gmail, GitHub, Google Drive, Google Calendar, Notion, Slack)
  as two-column rows with icon, name, description, and a plus. "See Outlook
  Email, Granola, and more" expands to Microsoft 365 plus every remaining
  curated preset. The smart search-or-paste bar keeps filtering both sections.
- A Configured strip links to the new /dashboard/mcp-connections/configured
  page, which now owns the connection rows (connect, tools, edit, remove) and
  can focus one row via ?connectionId=.
- Configured rows in the catalog get an options menu: Chat, Manage, Uninstall.
  Chat opens an openwork://chat deep link carrying the connector name and an
  "Explain ..." starter prompt; the row menu on the configured page gets the
  same Chat action.
- Plus on a one-click OAuth preset adds it for everyone (per-member accounts)
  and opens the authorization tab in the same gesture. Instant presets add on
  the spot; API-key and pre-registered-OAuth presets keep the guided form.

Den API
- Add the GitHub remote MCP preset (pre-registered OAuth app, like Slack).

Desktop app
- Parse openwork://chat?connector=…&prompt=… and land on the active
  workspace's new-task state with the composer seeded; nothing is sent until
  the person presses send.
- New [connector …] composer token renders as a chip ahead of the prompt and
  expands to a connector steering sentence on send, mirroring skill tokens.
- Chat links are taken from the shared deep-link queue without disturbing
  connect or den-auth links.

Tests
- Bun: catalog data, render, page contracts (den-web); deep-link parsing and
  connector token (app); preset schema (den-api).
- Testkit: connector-chat-deep-link.test.ts (PR lane); connectors-quick-add
  and telegram-removed E2E specs updated to the catalog and configured page.
…h the flat header

Connectors rows used to be the whole story: a name, a blurb, and a "+" or an
options menu. Opening one now lands on /dashboard/mcp-connections/<id>, a
page that explains the connector before anyone commits to it and manages it
afterwards.

- The detail route accepts a configured connection id or a catalog id
  (gmail, notion, microsoft-365). Configured entries resolve to their
  connection; Gmail, Drive, and Calendar keep their own identity while the
  Google Workspace connection keeps Google's.
- The page composes what already exists: the feature-complete connection row
  (connect, disconnect, edit, review OAuth, remove), the live tool catalog,
  and a new Information table (provider, type, server, sign-in mode, access,
  added by, plugin ownership, docs). Unconfigured connectors get the same
  header with Add / Connect / Set up, driven by the preset's effort, plus a
  plain explanation of what that step does.
- Copy link and Chat (the desktop deep link) sit where ChatGPT puts "Copy
  link" and "Try now"; the catalog "+" and options menu are unchanged.
- Catalog rows, the configured strip, and Manage all open the detail page.
- The Connectors and Configured pages drop the gradient hero for
  DenPageHeader, matching OpenWork Models and Workflow detail, with the
  page's primary action in the header.

Tests: connector-detail resolution/facts/copy, catalog render links, and a
screen source contract; den-web typecheck and the 182-test allowlist pass.
evals/specs now only holds specs that cross a product boundary (#4398,
#4402). The den-web link → desktop parser → composer chip round trip is a
unit contract, so it moves beside chat-link-parse.test.ts as a bun test and
the boundary ratchet is clean again.
…ided Google client

Every organization had to register its own Google OAuth app before anyone
could connect Gmail, Drive, or Calendar: the catalog's "+" opened a client
dialog, and getOrgOAuthClient had no default to fall back to.

Den API can now carry an OpenWork-provided Google Workspace client
(DEN_CONNECTOR_GOOGLE_WORKSPACE_CLIENT_ID / _CLIENT_SECRET, validated as a
pair). resolveOAuthClient returns the org's own saved client when it exists
and the provided default otherwise, for the literal native provider key
only; connector rows and external MCP connections are untouched. Connect
start, the callback exchange, token refresh, the org-wide usable entry, and
both credential-id resolvers read through it, so the connector appears on
Your Connections for every member without admin setup. GET
/v1/oauth-providers/:providerId/client reports the client's source.

Den web: the popular rows show Connect for a published per-person
connection the caller has not signed in to yet; "+" and
?quickAdd=google-workspace start the Google sign-in directly when an
org-wide client exists and only open first-time setup when none does. The
Google dialog names the OpenWork-provided client and keeps "Use your own
client" as the override.

Tests: den-api env pairing and resolver precedence (mocked db), den-web
decision and render coverage, docs for the two variables and the redirect
URL to register.
@benjaminshafii

Copy link
Copy Markdown
Member

@OmarMcAdam Please review the shared Google OAuth client configuration, secret pairing, scopes, and rollout. The PR is draft and the end-to-end sign-in journey remains incomplete; depends on #4305.

Holding for your review under the current merge instructions.

@reachjalil
reachjalil marked this pull request as ready for review September 5, 2026 00:19
@reachjalil
reachjalil force-pushed the feature/connector-catalog-popular-first branch from 4b80d5b to 7e846ca Compare September 6, 2026 23:02
@reachjalil
reachjalil force-pushed the feature/connector-catalog-popular-first branch 4 times, most recently from 7a7563c to 2c19ea5 Compare September 9, 2026 20:05
@reachjalil reachjalil closed this Sep 9, 2026

This branch was successfully deployed

4 active deployments
Preview – openwork-landing — 37b65c0b Deployed Sep 4, 2026 by vercel[bot]
Preview – openwork-app — 37b65c0b Deployed Sep 4, 2026 by vercel[bot]
Preview – openwork-den — 37b65c0b Deployed Sep 4, 2026 by vercel[bot]
Preview – openwork-diagnostics — 37b65c0b Deployed Sep 4, 2026 by vercel[bot]
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