Skip to content

Guided connector setup, setup status, and setup from the AI client - #834

Merged
keysersoft merged 10 commits into
mainfrom
keysersoft/connector-guided-setup
Oct 3, 2026
Merged

keysersoft merged 10 commits into
mainfrom
keysersoft/connector-guided-setup

Conversation

@keysersoft

Copy link
Copy Markdown
Contributor

Builds on #831 and #832 (both merged into this branch). Merge those first; this diff shrinks to its own two commits afterwards.

Why

Of the 428 sign-ups that came through the Claude directory in 48 hours, 146 connected Claude to a workspace with no connectors, and 213 connectors in the cloud were installed but could never work (178 missing a value, 35 never authorized). Their tools were still listed, so the model called them and got errors the user could not fix from the chat.

Setup status (dfa84f2)

  • Every connector gets a status: ready, needs_input (a {{VAR}} still empty) or needs_authorization (browser OAuth without a token).
  • Connectors that are not ready are no longer listed on MCP, on the shared endpoint and on /mcp/<serverId>. The shared anythingmcp_list_connectors reports them under needsSetup with a link to finish.
  • Audited against production (read-only): 824 ready, 178 needs_input, 35 needs_authorization, and none of the hidden ones had a successful call recently.
  • Connector list and detail show the status and what is missing.

Guided setup (dfa84f2)

  • /connectors/setup/<slug> replaces the store's install dialog: fields grouped (address, credentials, settings, advanced collapsed), with help, examples and patterns from a new optional envVarMeta in the adapter JSON (curated for 14 adapters, derived for the rest).
  • Credentials are checked against the API before anything is saved (POST /api/adapters/:slug/verify, no DB writes, 20/min per key).
  • OAuth connectors: "Save and sign in to X", then back to a done screen with a sample of real data.
  • /welcome now starts with "What should your AI client work with?".

Setup from the AI client (df4d764)

  • The shared /mcp keeps its eight tools (no directory re-review). For ADMIN and EDITOR members a virtual "AnythingMCP Setup" connector appears in anythingmcp_list_connectors, with setup_find_connectors, setup_install_connector, setup_get_status, run through the existing search/describe/run tools.
  • Install is catalog-only, takes only non-secret settings, 10 installs per user per hour, respects the plan limit, attaches to the servers the client was granted.
  • Secrets and OAuth sign-ins never go through the chat: the tools return a one-time link /s/<token> (30 min, single use, only for the user it was made for, SHA-256 stored) that opens the guided setup.
  • Cloud: after Approve into a workspace with no connectors, a page explains how to add an app (in the chat or in a new tab) before handing back to the client. The login cookie is renewed to 15 min for that detour (OAuth session lasts 30).

Migrations

  • 20261003110000_connector_setup_links (new table only).

Tests

  • Backend: 6477 passed.
  • Frontend e2e: 98 passed (new: guided setup, setup links).

- REST engine: a 429 (or a 503 with Retry-After) gets at most one more
  attempt, after the API's Retry-After when it is 3 s or less, after ~1 s
  when there is none, and none when it asks for longer. Retrying 429s three
  times multiplied load on APIs that were already limiting us.
- Errors for a missing variable or a never-authorized OAuth connector link
  to the connector's page; a host that does not resolve is reported as
  'Host not found' instead of 'SSRF guard: cannot resolve'.
- Error hints for Telegram (wrong bot token, unreachable chat) and Lexware
  (overdue cannot be combined with other statuses); Lexware list_vouchers
  marks voucherType and voucherStatus required; api-football healthPath
  typo fixed.
- Onboarding drip: reminders depend on the workspace having no connector
  (a teammate's counts), not on the Skip flag of /welcome. A user who
  connected Claude/ChatGPT to an empty workspace gets the first nudge 2 h
  later, naming the client. New server-only event ai_client_connected.
…started

- Pending authorizations move from an in-memory map to
  connector_oauth_attempts (state hashed, verifier and client credentials
  encrypted, 15 min, single use), so a restart or blue/green deploy between
  consent and callback no longer loses them.
- The provider callback no longer exchanges the code: it checks the state
  and forwards code + state to /connectors/oauth/complete, which posts them
  to POST /api/mcp-oauth/complete. The code is exchanged only for the user
  who started the flow; anyone else gets 403 and the attempt is spent.
  Before, a consent link started on one person's connector could be
  completed by someone else, handing over that person's tokens.
- Provider errors (access_denied, invalid_scope, invalid_client) are
  explained on the complete page, with a way back to the connector.
- authorize accepts an internal returnTo; GET /api/connectors/oauth/redirect-uri
  returns the redirect URI from SERVER_URL, used by the connector form
  instead of guessing it from the browser's location.
- Setup status per connector (ready / needs_input / needs_authorization),
  computed from its variables and OAuth tokens. Connectors that are not
  ready are not listed on MCP (tools/list, per-server endpoints, shared
  /mcp); the shared endpoint names them under needsSetup with the link to
  finish them, and a call by name gets that link instead of a placeholder
  error. Checked against production: 213 of 1037 connectors are not ready,
  none of them had a successful call in 14 days.
- Catalog: optional envVarMeta (label, kind, secret, help, example,
  pattern, link, advanced) with derived defaults for every adapter, curated
  for the 14 most installed; setupKind (none / credentials / oauth_browser);
  validator rule.
- POST /api/adapters/:slug/verify tries the credentials against the
  adapter's probe on an in-memory connector before anything is saved.
- /connectors/setup/<slug>: grouped fields with where to find them, check
  then install, 'Save and sign in' chaining the OAuth authorization with a
  return to the setup page, finish an existing connector, drafts instead of
  'Skip for now'. The store installs through it; /welcome asks what to
  connect first. Setup funnel product events.
The shared /mcp keeps its eight tools. A virtual "AnythingMCP Setup"
connector appears in anythingmcp_list_connectors for ADMIN and EDITOR
members, with three tools reached through search/describe/run:
setup_find_connectors, setup_install_connector and setup_get_status.

- Install is catalog-only, accepts only non-secret settings, is limited
  to 10 installs per user per hour and respects the plan's connector
  limit. New connectors are attached to the servers the client was
  granted.
- Secrets and OAuth sign-ins never pass through the chat: the tools
  return a one-time link (/s/<token>, 30 minutes, single use, only for
  the user it was made for) that opens the guided setup.
- Cloud: after approving an AI client into a workspace with no
  connectors, a page explains how to add an app (in the chat or in a new
  tab) before handing back to the client.
… in the chat instructions, setup event kinds
…guided-setup

# Conflicts:
#	packages/backend/src/adapters/adapters.service.spec.ts
#	packages/backend/src/adapters/adapters.service.ts
Comment thread packages/backend/src/adapters/adapters.service.ts Fixed
Comment thread packages/backend/src/connectors/mcp-oauth-callback.controller.ts Fixed
Comment thread packages/backend/src/connectors/mcp-oauth-callback.controller.ts Fixed
Comment thread packages/backend/src/adapters/adapters.service.ts Fixed
…guided-setup

# Conflicts:
#	packages/backend/src/adapters/de/lexware-office.json
#	packages/backend/src/audit/product-event.service.ts
…guided-setup

# Conflicts:
#	packages/backend/prisma/schema.prisma
#	packages/backend/src/connectors/mcp-oauth-callback.controller.spec.ts
#	packages/backend/src/connectors/mcp-oauth-callback.controller.ts
#	packages/frontend/src/app/connectors/store/page.tsx
@keysersoft
keysersoft enabled auto-merge (squash) October 3, 2026 12:32
@keysersoft
keysersoft merged commit 4c0385e into main Oct 3, 2026
13 checks passed
@keysersoft
keysersoft deleted the keysersoft/connector-guided-setup branch October 3, 2026 12:35
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants