Files
PaperClipAI/doc/connections/VERCEL-CONNECT.md
T
DottaandPaperclip f449b05bc5 feat(apps): unify permissions and action testing (#12802)
## Thinking Path

> - Paperclip is the control plane for companies that use AI agents.
> - Apps give humans and agents controlled access to external services.
> - The existing app detail flow split permissions, tests, setup, and
activity across separate pages.
> - The split made access rules harder to understand and made reconnect
work hard to find.
> - New write actions also defaulted to Ask first, which did not match
the intended connection policy.
> - This pull request combines permission control and action testing,
removes the setup page, and moves connection activity into Audit.
> - The benefit is one clear place to configure, test, reconnect, and
review each app.

## Linked Issues or Issue Description

**What existing behavior does this improve?**

The installed app Permissions, Test, Setup, and Activity views.

**Subsystem affected**

Cross-cutting. This change updates the React UI, shared app defaults,
server permission behavior, tests, smoke scripts, and connection
documentation.

**Current behavior**

App access and action testing use separate pages. The app detail view
also links to a setup page after installation. Connection activity uses
a separate tab. New write actions default to Ask first.

**Proposed behavior**

Permissions uses the connection access language from the initial flow.
It includes searchable Read and Write sections, a three-state permission
control, and a Test dialog for each action. Reconnect appears below a
Needs attention header on Permissions and Review. Old Setup and Test
links redirect to Permissions. Old Activity links redirect to the
filtered company Audit feed. New write actions default to Allowed.

**Reason and benefit**

A person can understand and test app access without moving between
several pages. Reconnect work stays visible where the person reviews the
connection. Audit events use one consistent feed and filter model. New
connections have the intended default policy.

**Breaking changes**

The Setup, Test, and app Activity tabs are removed. Existing deep links
redirect to their replacement pages. Existing saved action permissions
do not change. Only defaults for new write actions change.

**Additional context**

This builds on the managed app connection work in #12728. A search found
no duplicate open pull request or issue.

## What Changed

- Combined action testing with Permissions.
- Added searchable Read and Write action groups.
- Added Off, Ask first, and Allowed controls with tooltips.
- Added an action Test dialog with agent selection, arguments, and
formatted results.
- Removed the installed-app Setup and Activity tabs.
- Added reconnect guidance to Permissions and Review when a connection
needs attention.
- Routed connection activity into the company Audit feed and preserved
the Apps & tools filter in streamlined Audit.
- Moved connection removal to the Connectors-page management menu.
- Made new write actions default to Allowed across connection creation
paths.
- Updated regression tests, browser suites, smoke scripts, and
connection documentation.

## Verification

- `pnpm check:token-gates`
- `pnpm exec vitest run packages/shared/src/app-definitions.test.ts
server/src/__tests__/generic-mcp-connection.test.ts
server/src/__tests__/tool-access-service.test.ts
ui/src/components/AppConnectionSidebar.test.tsx
ui/src/pages/apps/AppDetail.test.tsx
ui/src/pages/apps/AppNotConnected.test.tsx
ui/src/pages/apps/AppsConnect.test.tsx ui/src/pages/apps/Browse.test.tsx
ui/src/pages/apps/Connections.test.tsx
ui/src/pages/apps/composio-services.test.ts
ui/src/pages/audit/AuditFeed.test.tsx
ui/src/pages/tools/PasteConfigTab.test.tsx` (517 tests passed)
- `pnpm exec vitest run ui/src/pages/apps/app-detail/TestPanel.test.tsx
ui/src/pages/audit/AuditHub.test.tsx
ui/src/pages/audit/AuditFeed.test.tsx
ui/src/pages/apps/AppDetail.test.tsx ui/src/pages/apps/Browse.test.tsx`
(96 tests passed)
- Targeted Playwright verification for connection removal, rename on
Permissions, inline action testing, and Smoke Lab Audit evidence (5
flows passed)
- `pnpm -r typecheck`
- `pnpm build`
- `pnpm test:run` completed with 5,755 passing tests and 20 unrelated
macOS harness failures. The failures use `/tmp` versus `/private/tmp`,
invalid ports above 65535, and workspace fixtures outside this change.

## Risks

- Low migration risk. This change has no database migration.
- Old app-detail URLs depend on redirect compatibility.
- New connections grant write actions by default. Finalization remains
configure-authorized and audited, Ask first and Off remain available per
action, and existing connections keep their saved policy.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected - check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

OpenAI Codex, exact model ID `gpt-5`. The client does not expose the
context-window size. The model used reasoning, repository tools, code
execution, and browser verification.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-09-03 21:23:26 -05:00

9.1 KiB

Vercel Connect credential source

Audience: Paperclip operators and engineers enabling Vercel Connect for outbound remote MCP apps.

Vercel Connect is an optional credential authority inside Apps v2. Operators create, attach, authorize, and inspect connectors in Vercel. Paperclip records only the connector ID/UID and reviewed, redacted grant metadata, then requests a short-lived provider token while listing or calling tools. Provider bearers do not enter Paperclip secrets, connection config, agent config, prompts, API responses, activity rows, or audit details.

This is an opt-in exception to the normal instance-vault custody rule, not a new connection model. Profiles, policies, ask-first approvals, changed-tool quarantine, resource filters, installs, and audit continue to use Apps v2.

Preview UI paused: Paperclip currently withholds Vercel Connect from Apps Browse and redirects /apps/vercel-connect back to Apps. The persisted model, runtime resolver, and existing-connection management remain in place so saved references are not orphaned. New operator setup is intentionally unavailable until the integration is ready for another product review.

Deployment configuration

Paperclip pins @vercel/connect to 0.6.1.

Setting Meaning
PAPERCLIP_VERCEL_CONNECT_ENABLED=true Enables the backend capability for controlled testing and existing connections. It does not currently expose a customer-facing setup entry.
VERCEL_OIDC_TOKEN Workload identity injected by Vercel and preferred when present.
PAPERCLIP_VERCEL_CONNECT_ACCESS_TOKEN BYO instance bootstrap authority for deployments without Vercel workload OIDC.
PAPERCLIP_INSTANCE_ID Included in derived pseudonymous user subjects when configured.

The feature flag gates creation only. Existing Vercel-backed connections keep resolving when the flag is later disabled, provided workload OIDC or the BYO access token is still valid. Missing or invalid authority fails closed and a health check marks the connection degraded. Page views never probe Vercel.

Treat PAPERCLIP_VERCEL_CONNECT_ACCESS_TOKEN like any other deployment bootstrap secret: inject it through the host/container secret facility, rotate it outside Paperclip, and never put it in company_secrets, app config, task text, logs, or screenshots. A conventional Vercel personal access token is not automatically Connect authority just because it has a long lifetime or broad scope; validate the exact token type against getConnectorMetadata before rollout. Paperclip prefers workload OIDC whenever both authorities are present, so a stale fallback token cannot shadow a healthy workload identity.

For local development, link the checkout to the Vercel project and pull a fresh workload token:

pnpm dlx vercel@latest link
pnpm dlx vercel@latest env pull .env.local

The downloaded OIDC token is intentionally short-lived. Pull it again when it expires; do not extend or copy it into a year-long secret. On Vercel deployments, the platform injects and refreshes workload identity automatically. Provider tokens returned by Connect are also short-lived and are refreshed through the normal SDK cache path rather than persisted by Paperclip.

Operator setup (currently withheld from the product UI)

The following flow is retained as implementation and test documentation. It is not available from Apps while the preview UI is paused.

  1. Open Vercel Connect, create the provider connector, and attach it to the project/environments allowed to run Paperclip. Vercel remains the inventory and management UI.
  2. In a future reviewed build, Paperclip will expose one isolated Vercel Connect setup entry. Native PostHog, Linear, Notion, and other provider setup screens will not show Vercel as a credential option. The retained pilot definitions cover PostHog, Linear, and Notion.
  3. Choose the reviewed app, open the Vercel handoff if needed, and paste only the connector UID (for example notion/paperclip) or connector ID (scl_…).
  4. Paperclip calls getConnectorMetadata and rejects missing, unattached, or wrong-service connectors. It does not copy Vercel's forms or arbitrary vendor metadata.
  5. For a user OAuth connector, continue through Vercel authorization. The callback is one-time and bound to the company, actor, and board session. For app/API-key connectors, Paperclip verifies setup with a token request. If an installation is required, complete it in Vercel and retry; Paperclip does not use the experimental installation API.
  6. Review the discovered catalog and complete the existing Paperclip access, resource-filter, risk, and agent-install steps.

V1 requires one dedicated app-subject connector per Paperclip connection. Do not reuse an app-subject connector across Paperclip companies. Multi-installation routing and shared app-subject connectors are intentionally deferred.

Runtime and subject binding

Paperclip selects the effective connection grant before requesting a token. It derives user-subject IDs from the Paperclip instance, company, connection, grant kind, and responsible user. Organization OAuth uses a company-scoped pseudonymous user subject; personal OAuth adds the Paperclip user. App/API-key methods use Vercel's app subject. Neither browsers nor agents may supply these subject identifiers.

Token resolution uses the SDK cache plus Paperclip single-flight deduplication. Normal catalog refreshes and invocations use cached valid tokens. Setup, explicit health checks, and the one retry following an upstream 401 force a fresh request. The 401 retry first evicts the matching cache entry and never loops.

Remote MCP requests include the canonical server URL as the OAuth resource indicator (for example, https://mcp.posthog.com/mcp, without transport-only query parameters). This binds consent and returned scopes to the reviewed MCP service instead of accidentally receiving only generic identity scopes. For a custom PostHog OAuth connector, configure a public client with token auth method none and PKCE S256; Paperclip sends the canonical resource plus reviewed scopes: ["*"], allowing PostHog to select the MCP scopes for that resource.

The reviewed app definition controls the exact token scopes and header placement. Paperclip injects the bearer only after the connection grant, profile, policy, approval, resource filter, and catalog entry have been selected. Stored grant metadata is limited to subject type, optional installation/tenant IDs, token ID, expiry, and last verification time. The pseudonymous subject ID is server-only and redacted from APIs.

Recovery and removal

Stable Paperclip reason codes include:

Code Operator action
vercel_connect_unavailable Restore workload OIDC or the BYO access token.
vercel_connect_auth_failed Repair or refresh Paperclip's Vercel authority, and verify that the configured token type is accepted by Connect.
vercel_connect_connector_not_found Attach the pasted connector to the correct Vercel project/environment.
vercel_connect_authorization_required Reauthorize the responsible identity in Vercel Connect.
vercel_connect_installation_required Complete the provider installation in Vercel, then run Check again.
vercel_connect_request_failed Inspect Vercel status/audit and retry; upstream bodies remain redacted.

Revocation or missing user authorization marks the grant needs_reauthorization and blocks calls. When a responsible user is known, Paperclip creates the existing authorization interaction. Reconnect UI sends the operator to Vercel and an explicit health check; it never asks for a provider key.

Removing an app disables local access and clears token caches before best-effort external cleanup. Paperclip revokes subjects it generated for user-mode connectors. App-subject connector cleanup remains in Vercel and is called out in the removal receipt. Audit history remains available.

Validation and rollout

Before enabling another app method, run the real-provider smoke matrix:

  • create/attach the connector and validate its UID;
  • discover the MCP catalog;
  • run an allowed read;
  • set a write to ask-first, then confirm it stops for approval and runs only after approval;
  • revoke in Vercel and confirm the one retry fails closed;
  • confirm the grant becomes needs_reauthorization and the audit trail contains no bearer, claims, bootstrap authority, or upstream response body;
  • reconnect, run an explicit health check, and remove the connection.

CI uses a mocked Vercel-plus-MCP flow. Credentialed PostHog and Linear smoke is an operator/release gate, not a repository secret fixture. Do not migrate existing vault-backed connections automatically; source migration needs a later atomic revoke-and-rollback workflow.

Vercel webhook triggers, generic REST/OpenAPI execution, connector inventory synchronization, Paperclip-hosted relay services, and Vercel's experimental installation API are outside V1.

Vercel bills Connect by token requests. Link operators to Vercel's live Connect page and pricing documentation instead of copying rates into Paperclip documentation.