Files
PaperClipAI/doc/public-mcp.md
T
DottaandPaperclip 22a3ea3414 Invite assistants from Connections with scoped browser and device consent (#14933)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Public MCP lets people use their organization from an external
assistant.
> - Operators need a visible control for this experimental access.
> - Hosted users should select an organization once and then approve its
permissions.
> - This pull request adds the setting, invitation-first setup, and
browser or device consent.
> - Connections provides a copyable invitation with public instructions
that grant no access.
> - Users reach browser consent from their assistant and return to
inspect or revoke access.

## Linked Issues or Issue Description

Builds on merged foundation #14846. This PR now targets master. Related
settings convention: #13905.

**Current behavior**

The preview uses an environment variable to enable MCP. Hosted consent
repeats organization selection. Assistant access has no entry in
Connections, so users must already know the endpoint and how to reach
consent.

**Proposed behavior**

An administrator enables Settings → Experimental → Assistant connections
(MCP). A hosted connection shows the selected organization and its icon,
then asks for permissions. Requested write access starts checked when
the user’s role permits it; the user can opt out before connecting.
Direct instance connections show an organization picker with the first
available organization selected. The selection stays fixed across
refetches and still requires an explicit Connect action. Connections
includes Assistant Connection (MCP). Its setup page explains the
canonical endpoint, client configuration, browser authentication, and
connected access. It connects as the current person and does not select
or impersonate an agent.

**Reason and benefit**

Operators manage access with the other experiments. Users select one
organization, and both the UI and server enforce that choice.

**Breaking changes**

The old enable variable has no effect. Preview operators must enable the
setting once. Apply the additive consent-request migration before
deploying the tenant, then deploy the compatible Cloud broker. Existing
direct requests and grants keep their behavior.

## What Changed

- Simplify OAuth and device consent: show the Paperclip logo beside
“Connect {client} to Paperclip”, fall back to “your assistant”, and show
the identifying origin plus its favicon below, with the callback URL
also visible when different. Remove the hosted-organization creation
action. Default to the first available organization without silently
changing it on refetch; preserve company restrictions and write
opt-outs. Keep the button row contained on narrow screens.
- Make Copy invitation the primary action, using the shared animated
AgentSetupPrompt and a collapsed manual setup section with icon-labeled
line tabs. Remove redundant link actions, copy-status text, the extra
first-prompt well and revocation explanation from the setup page. Serve
shared version-aware HTML and Markdown instructions without private
organization data.
- Support guarded Client ID Metadata Documents alongside dynamic
registration, and include authorization response issuer identification.
- Add RFC 8628 device authorization with separately hashed codes,
expiry, shared request quotas, persistent polling backoff and atomic
redemption. Reuse human consent, role checks, scoped grants, audit and
revocation.
- Add CLI device login and a local stdio bridge. Store credentials
separately with private permissions and serialize rotating refreshes.
- Add device consent stories and five cold-start paid Product E2E cases
with independent grant, configuration and durable-work assertions.

- Add `enablePublicMcp` to the settings validator, normalizer, feature
catalog, and toggle UI. Check it live for OAuth, tools, subscriptions,
and event delivery. Keep connection management and revocation available
while disabled.
- Default the MCP origin to the existing auth public URL, with strict
validation and an explicit override.
- Persist the optional OAuth `company_id` restriction. Describe only
that company and reject approval for any other company, even if the
person belongs to both. Keep active-membership and role checks.
- Show the Paperclip icon and a large organization icon during consent.
Return the saved company logo through the company-scoped request
response and reuse the standard fallback icon. Use the requested concise
permission labels: “Read all of your Paperclip data” and “Allow write
access and creating tasks as me”. Use concise permission copy, retain a
compact client and callback-origin disclosure, and remove the footer
link.
- Default requested write access on for eligible roles. Preserve opt-out
across organization changes and refetch, reset defaults for a new
request, and submit read-only access when the request or role does not
allow writes. Align the shared checkbox with its label.
- Use organization wording in consent, management, settings, and
walkthroughs. Keep the organization fixed for hosted requests and retain
direct-instance choice.
- Add an Assistant Connection (MCP) card to the Connectors catalog, a
setup page in the app shell, and a return link from Experimental
settings. Include Codex, Claude Code, OpenCode, and generic remote MCP
instructions.
- Read the live gate and canonical server URL through authenticated
setup metadata. Show only the current person’s grants for the selected
organization, refresh after consent, and support revocation. Surface
catalog status failures with an explicit retry action; do not present
them as an empty connection list. Opening setup grants no authority.
- Start the eight guided chapters in Connections. Keep presenter notes
and chapter controls around real product pages in the app shell. Explain
the terminal, consent, delegation, retrieval, and revocation handoffs.
Mark conversation examples as illustrative. Cover first use, client
setup, connected, loading, and error states. Keep the existing consent
and management stories.
- Keep the paid-eval setup and browser helper aligned with the setting
and consent button.

## Verification

- Warm-standby integration fix `ec64ea05e`: public MCP ingress now
follows the Cloud claim guard; MCP and discovery paths return 503
instead of SPA HTML while unclaimed. Event polling checks the in-memory
claim before reading the persisted experimental setting. All 97 focused
OAuth/Cloud tests and server typecheck pass, including new request and
timer regressions for idle-before-claim and resume-after-claim behavior.
Fresh review is 5/5 with no unresolved threads, and all security scans
pass on this final head. All browser shards, typecheck, build, canary
installation and other test groups passed on the first attempt. The
unchanged Cursor sandbox default-command test timed out at 10 seconds;
the exact test passed locally without edits in 587 ms. The single
failed-job retry passed, with the original failure retained in workflow
37500711895. All 54 final-head checks pass on
`ec64ea05e9a03e2179d4e2f84c2de03761f7ce26` (two optional Storybook jobs
are intentionally skipped).

- Final master integration `8457828fc`: merged foundation #14846 and
current master, preserving the invitation changes and all 33 files from
the two newer upstream changes. No migration renumbering was required.
All 95 focused OAuth/Cloud integration tests, full recursive typecheck
and token gates pass. All CI gates passed on that integration head;
review identified the warm-standby issue fixed above.

- Security-review fix `8c1d0b696`: commit shared global/per-source
admission before outbound CIMD work, preserve failed-attempt receipts,
and validate resource/scope before fetching. Added migration
`0305_chubby_vin_gonzales.sql` and six concurrent/adversarial regression
cases. All 69 OAuth/metadata tests, 26 migration checks, full recursive
typecheck and production build pass. The security scanner passed that
commit. Follow-up `87f9658e7` limits only actual cache-miss fetches; 18
authorization requests sharing one proxy across two service instances
use just two fetches. All 70 OAuth/metadata tests and server typecheck
pass after that refinement. Final follow-up `8ebeae84c` reports
admission-storage failures as retryable HTTP 503 instead of invalid
client metadata. Its regression proves no outbound request before
admission and successful retry after storage recovers. All 71
OAuth/metadata tests and server typecheck pass. Final-head security
scanning passes; Greptile is 5/5 with no unresolved findings. CI passed
all browser shards, typecheck, build, token gates and canary
installation. One unchanged adapter-utils bridge test raced a
response-file write (expected a JSON error, received the safe
file-changed error). The exact test passed locally without edits. The
single failed-job retry passed; the original failure is retained in
workflow 37490609192. All 54 checks now pass on final head
`8ebeae84ca77c0cf7ac12c2006f0f8743fe50e0b`, with security scan and fresh
Greptile 5/5 and no unresolved threads. Foundation #14846 subsequently
merged as `e34abee670069cca84afb2efb86041bce7dccbec`; the final
integration above now targets master.

- Integration with current master: preserved the new Connections source
filters and pagination, kept all eval suites, and regenerated the
consent/device snapshots as migrations 0303/0304. All four MCP migration
SQL hashes are unchanged from the staging versions. Full recursive
typecheck and production build, 132 focused UI tests (including catalog
filtering), 89 server authorization/settings tests, 26 migration tests,
120 eval calibration tests and token gates pass. Review follow-up
`4820ce74c` also keeps active assistant grants in Installed, with
pending/error recovery and revocation/company-isolation coverage. All 76
setup/catalog tests, UI typecheck and token gates pass after that fix.
The unchanged signoff browser test timed out waiting for a heartbeat in
CI at `4820ce74c`; the exact test passed locally without code changes,
and the preceding CI head passed that shard. That same unchanged test
failed at the reviewer stage in the next CI run. All five signoff tests
passed three times locally (15/15), without test changes. All eight
browser shards pass at final head `8ebeae84c`; no browser-test edits or
failed-browser-job retries were needed.

- Setup-page refinement at `9ab009178`: all 17 focused setup/consent
tests pass, along with UI typecheck, production build, Storybook build
and token gates. Browser exercised the shared prompt preview and client
tab switching, and the updated InvitationCopied Storybook interaction
checks its clipboard fixture. All final-head CI checks pass at
`9ab009178`, with no unresolved review findings. Deployed successfully
to Butter in
https://github.com/paperclipai/paperclip-cloud/actions/runs/37475189524.
Verified the actual page, tab switching and line styling, removed
actions/copy, and successful native copy/paste of the complete Butter
invitation into a local-only test field. The existing Claude grant was
left intact.
- Consent follow-up at `dc8e9fd11`: all 10 consent tests and token gates
pass. UI typecheck and production build passed again at `4e4d5e4d9`;
Storybook build and eval-helper typecheck passed for `28101cf91`.
Follow-ups let the primary button wrap on narrow screens, preserve a
distinct callback URL, and use only bundled icons to avoid pre-consent
requests to client-selected sites. Browser-verified the real consent
component in desktop and 320px mobile stories, including default
selection, write access and preserved opt-out. Updated E2E
heading/default-selection helpers. All CI checks passed at `dc8e9fd11`,
with review 5/5 and no unresolved threads. The Butter preview
publication needed a retry because npm initially accepted the DB package
before making it visible; the retry succeeded and `dc8e9fd11` deployed.
Verified a fresh, unapproved native Codex CIMD request on Butter:
default organization/write selection, known-client heading and icon,
distinct callback origin, and removed creation action. No grant was
approved for this UI check. Prior paid runs below retain their exact
source provenance; this UI-only follow-up did not rerun paid
qualification.
- Source-pinned paid matrix at
`2992ef2710f47230e7f484c709c6ba02524f884c`: **15/15 passed**, five cases
each on GPT-5.4 Mini, Claude Haiku and Sonnet. Campaign
`local-2026-10-06T02-41-14-462Z`. Covers cold start, existing config,
unavailable host, denied consent and reconnect/later retrieval, with
independent configuration/grant/task/run/document assertions. Original
failures, transcripts, source fingerprints and billing remain retained.
- Final instruction follow-up `cda8178af`: **3/3 cold starts passed** on
Mini, Haiku and Sonnet. Campaign `local-2026-10-06T02-58-30-041Z`.
Latest `0637b9f1c` shares that same guidance across HTML, Markdown and
manual UI after review; generated Markdown is verified byte-identical to
the paid-evaluated version. Shared build, server/UI typechecks, token
gates and 63 auth/metadata tests passed again. Every CI gate passed at
prior HEAD `0637b9f1c`, with review 5/5 and no unresolved threads.
- Other focused checks: 11 CLI credential/refresh-lock tests, 120 eval
calibration tests, server/UI/eval typechecks, token gates and Storybook
build passed. Full recursive typecheck and production build passed
during implementation; CI also passed them at `2992ef271`.
- Local full-suite limitations: a large-file Git streaming test times
out on this Mac, and broader CLI/route runs hit DB hook timeouts. Fresh
MCP reruns passed, and the corresponding CI groups passed. No claim that
the local full suite is green.
- Actual clients: Codex 0.153.4 and Claude Code 2.1.245 reach CIMD
consent; device CLI reaches verification/consent. New grants await human
approval. Existing local OpenCode retrieved a saved result in a fresh
conversation through its previously approved grant.
- Fresh OpenCode 1.18.17 on Butter: started with no MCP config, received
the exact copied invitation, read public setup, configured its server
and started PKCE consent. Its shell command timed out; background retry
reached the client's own callback deadline while approval remained
pending. Latest instructions cover that handoff. **No completed Butter
read/delegation/result retrieval is claimed.**
- Cloud companion
https://github.com/paperclipai/paperclip-cloud/pull/672 passes
checks/review and deployed. Anonymous setup and device-protocol routing
verified. Core `2992ef271` deployed successfully and the actual Claude
web flow now reaches consent. Its extra JWT-bearer metadata is filtered
to implemented grants; unsupported token grants remain rejected. Final
`0637b9f1c` deployed successfully to Butter in
https://github.com/paperclipai/paperclip-cloud/actions/runs/37409195300;
live HTML and Markdown both contain the final guidance. The superseded
instruction-only build was canceled before deployment. This is a
core-only staging preview; private Cloud plugins are omitted. ChatGPT
web is signed out, so browser connector use is unverified.
- Screenshot gallery begins at Butter's dashboard and distinguishes real
setup/pending consent from local reuse and fixtures. It records the
timeout finding. New persistent access needs human confirmation before
the remaining actual-client acceptance work.
- Manual path: Connectors → Assistant Connection (MCP) → Copy invitation
→ paste into assistant → configure and start authorization → sign in and
approve → verify `paperclip_connection` → delegate → retrieve the saved
report later.
- Plan and instructions: `doc/plans/2026-10-05-assistant-invitations.md`
and `doc/public-mcp.md`.

## Risks

- Apply additive, replay-safe migration `0304_curvy_shadow_king.sql`
before using device authorization. The public setup link carries no
credential. Device codes and tokens stay private; neither sharing
instructions nor installing a plugin authorizes access.
- Apply additive migration `0305_chubby_vin_gonzales.sql` before
deploying the shared metadata admission gate. It retains at most 60
short-lived, hashed-source receipts per instance and rejects excess
attempts with 429.
- CIMD metadata fetching is a new external-input boundary. It requires
HTTPS, exact client ID and redirect validation, bounded responses and
guarded DNS/network access. Client names remain self-reported.
- Device support is per-instance. The central Cloud broker retains its
existing grant support. Host installation and tool reload capabilities
vary by client; instructions describe manual settings and restart
requirements.

- Consent names the registered client in its heading and displays its
identifying origin below. Known-origin icons are bundled; all other
origins show a neutral site icon without contacting client-selected
sites. Client names are self-reported; the callback origin is the
recipient check. The Cloud chooser also displays the original client and
receiving origin before tenant handoff.

- A user who accepts the preselected write permission can create tasks
and comments. Task creation and comments can start or wake agents and
use execution budget; the consent label uses the concise wording
explicitly requested by the maintainer. Scope requests, role checks, and
the final Connect action still apply.
- Migration `0303_supreme_garia.sql` adds one nullable UUID column with
`IF NOT EXISTS`. Requests without a company restriction keep the
direct-instance picker. The binding stays recorded if its company is
deleted; consent then fails closed.
- Deploy tenant support before the Cloud broker sends `company_id`.
Unknown or inaccessible organizations must never fall back to a
different company.
- The setting defaults off. Disabling access does not cancel work
already delegated. Existing tokens and unexpired subscriptions can
resume when enabled again; revocation remains separate.
- The catalog entry is visible for discovery while the feature is off.
Setup instructions, OAuth, and tool execution remain gated. No access is
granted by viewing the entry.
- Assistant sign-in starts in the external client so it owns PKCE and
callback state. Client command syntax can change and links to official
setup documentation are included.
- An authenticated instance and valid public URL are required. Hosting,
paid execution, and store publication remain separate rollout steps.

## Model Used

OpenAI GPT-6 in Codex, with tool use and code execution. The exact
serving model version and context window are not exposed in this
session.

## 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 (focused checks pass;
unrelated local full-suite timeouts are explicitly recorded above)
- [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-10-06 12:35:16 -05:00

26 KiB
Raw Blame History

Public Paperclip MCP connection

The first-release implementation connects an external assistant as a person to one explicitly selected company. It exposes first-party task operations and keeps normal Paperclip authorization, scheduling, attribution, budgets and approvals. The existing named agent gateways and native runner checks remain separate. The accepted roadmap is in the implementation plan.

Enable an instance

Apply database migrations with the normal instance upgrade workflow. In Paperclip, open Settings → Experimental → Assistant connections (MCP) and turn it on. Instance administrators can change this setting. It is off by default and takes effect immediately without restarting the server.

Use the instance's configured authentication public URL, or explicitly set:

PAPERCLIP_PUBLIC_URL=https://YOUR-PAPERCLIP-HOST

The retired PAPERCLIP_PUBLIC_MCP_ENABLED variable has no effect. The persisted enablePublicMcp setting controls discovery, sign-in, tools and event delivery. Turning it off blocks new calls and deliveries; already delegated work continues. Connection management and revocation remain available. Turning it back on allows unexpired connections and subscriptions to resume.

The URL must be an origin without a path, credentials, query or fragment. HTTP is allowed only for localhost/loopback development. The feature is disabled by default. Use authenticated deployment with real user accounts and company memberships; local implicit board authority and agent/board API keys cannot approve user OAuth connections. Configure TRUST_PROXY correctly at your edge.

The endpoint is POST /mcp/paperclip, using stateless Streamable HTTP with JSON responses. GET/SSE sessions are unnecessary. Each invocation verifies its bearer token again; normal API endpoints do not accept these OAuth tokens. Public installation requires a reachable HTTPS deployment. Private self-hosted instances require a directly reachable endpoint; no managed relay is included.

Unclaimed Cloud warm-standby instances return 503 workspace_unclaimed for MCP setup, discovery and protocol requests without reading the database. The event poller also stays idle until the instance is claimed. After claim, both resume without a restart and remain subject to the experimental setting and normal authorization.

Start from Connections

Inside your organization, open Connectors → Assistant Connection (MCP) → Set up. This connects an outside assistant to Paperclip using your human account; no agent is selected or impersonated. The entry is discoverable while disabled, but its setup instructions require the experimental setting. Follow Open Experimental settings, enable Assistant connections (MCP), then return to setup.

Click Copy invitation to copy the message and preview it in the shared animated setup prompt, then paste it into your assistant. Client-specific instructions are under Set up manually, in the icon-labeled tab bar. The invitation’s public setup link contains an optional organization ID, never a credential. It does not reveal the organization before sign-in or grant access. Approval happens when the assistant starts its connection. The setup page is server-rendered at /mcp/setup; /mcp/setup.md and Accept: text/markdown provide the same version-aware instructions for assistants without browser access.

Set up manually contains commands for Codex, Claude Code, OpenCode, browser connectors and headless clients. Browser clients may require adding a connector in their settings; reading an invitation cannot install one. A running client may need a restart or a fresh conversation to load its tools. Verify the organization with paperclip_connection before doing work. Keep existing client configuration, and use a distinct server name when another Paperclip instance is already present.

For OpenCode, merge the displayed mcp.paperclip entry into your project’s opencode.json, run opencode mcp auth paperclip there, approve the organization, then start opencode web. Restart an already-running OpenCode after authentication. An assistant invoking authorization through a shell tool must keep the command alive in a persistent terminal or background process and share its approval URL immediately. OpenCode's callback deadline still applies: a URL from a timed-out command cannot complete sign-in. Start a fresh request, or have the user run the command in their own terminal if the host cannot preserve it across turns.

Never add upstream model keys to the MCP URL or config; the assistant’s model connection is configured separately.

Consent names the client when available and shows its identifying URL with a site icon. The first available organization is selected initially; requested write access starts checked when the selected role permits it. Changing organization or refetching does not undo a write-access opt-out. Nothing is authorized until Connect organization is clicked. Organization creation stays outside consent.

Return to the same Connections entry to see your connected assistants, their read/write access, and revoke access. The list refreshes after consent and only shows your grants for the selected organization. The legacy /assistant-connections URL remains available for account-wide management.

GET /api/mcp/setup returns the live experimental gate, canonical endpoint, invitation URL and copyable invitation to authenticated browser/Cloud users, including while disabled. It cannot grant access, accepts no destination URL, never reflects forwarded hosts, and is not available to agent keys, MCP bearer tokens, or implicit local authority.

Connect an assistant directly

After the instance is enabled and reachable, an existing team member can connect without a store listing. For Codex CLI:

codex mcp add paperclip --url https://YOUR-PAPERCLIP-HOST/mcp/paperclip
codex mcp login paperclip --scopes paperclip:read,paperclip:write,offline_access

For Claude Code:

claude mcp add --transport http paperclip https://YOUR-PAPERCLIP-HOST/mcp/paperclip

Open Claude Code's /mcp menu and authenticate the Paperclip server. Both flows open browser sign-in and consent: review the selected organization (or choose one for a direct instance connection) and review the write-access checkbox. It starts checked when the assistant requests writes and your organization role allows them; uncheck it for read-only access. Read-only consent cannot delegate work.

Ask the assistant to identify the connected organization and list its agents, then ask it to delegate a small task to an available agent. The returned task link is the durable reference. In a later conversation, ask for that task's progress and report. Configure the agent's provider credentials, execution environment and budget in Paperclip before expecting it to run; the assistant connection does not supply them. Revocation is available at /assistant-connections.

The optional workflow packages teach team review, delegation and result retrieval. Build them for the same endpoint before installing locally. Public ChatGPT/Codex and Claude directory installation requires the separate deployment and submission work below.

Headless device login and stdio bridge

With a CLI build that includes this feature:

paperclipai mcp login --device --url https://YOUR-PAPERCLIP-HOST/mcp/paperclip
paperclipai mcp proxy --url https://YOUR-PAPERCLIP-HOST/mcp/paperclip

Add --company <organization UUID> to login to restrict the consent choice. Login prints a human verification URL and code. Open that URL, sign in, compare the code, and approve or decline. The private device code and issued tokens stay inside the CLI. Configure the second command as a local stdio MCP server in a host without native device support. Do not copy tokens into chat or MCP configuration.

The CLI stores credentials separately under $PAPERCLIP_HOME/mcp (default ~/.paperclip/mcp), with a private directory and files, atomic replacement and a cross-process refresh mutex. It forwards only to the exact bound resource and rejects redirects. A failed write is never retried automatically because it may already have completed. Revoke access from Connections when finished.

The device endpoint is /mcp/oauth/device_authorization, browser verification is /mcp-device, and the token endpoint accepts the RFC 8628 device grant. Pending requests have separately hashed codes, ten-minute expiry, five-second initial polling, persistent backoff and atomic redemption. Shared database quotas bound new requests. Consent uses the same company, role, scope, grant, audit and revocation checks as browser OAuth. This is human authorization, not client credentials or agent impersonation. Both flows require the experimental setting.

Tenant Cloud gateways forward setup and device protocol requests without browser cookies. Browser approval remains authenticated. The central directory broker does not advertise device or CIMD support until separately implemented.

  • Protected-resource discovery: /.well-known/oauth-protected-resource/mcp/paperclip.
  • Authorization-server discovery: /.well-known/oauth-authorization-server.
  • Public-client registration: /mcp/oauth/register.
  • Authorization, token and revocation endpoints: /mcp/oauth/authorize, /mcp/oauth/token, /mcp/oauth/revoke.
  • Browser consent: /mcp-connect/:requestId.
  • User connection management: /assistant-connections.

Consent identifies the registered client and its identifying origin. Client names are self-reported; verify the receiving domain before approving an unexpected request. The hosted organization chooser also identifies the original client and callback origin before its tenant handoff.

An uncached remote client-metadata lookup consumes a database-backed admission receipt before fetching: at most 60 attempts per instance and six per source per rolling minute, shared by browser and device authorization across server replicas. Receipts store only a source hash and expiry, and failed lookups or mismatched redirects still consume the quota. Invalid resources and scopes are rejected without fetching. The network request runs after the admission transaction commits, so slow clients cannot hold its database lock. Reusing already-validated metadata within its cache lifetime consumes no fetch capacity, so clients shared by users behind one proxy do not charge the same lookup on every connection.

Client ID Metadata Documents (CIMD) and dynamic registration both support public clients. CIMD uses an HTTPS client ID URL with an exact matching client_id, required registered redirects, a 32 KiB response limit, a bounded cache, and guarded DNS/HTTP fetching that rejects private networks and redirects. Supplied names are not proof of a brand identity. Client documents can list capabilities used with other servers; Paperclip retains only its implemented grants. Extra capabilities such as Claude web’s JWT-bearer grant do not enable that grant here. Verified native loopback callbacks may vary only their port; the exact authorized callback remains bound to code redemption. Authorization responses include iss. Resource metadata advertises resource scopes; refresh capability is advertised in authorization-server metadata.

Dynamic registration uses public clients, exact registered HTTPS redirect URIs (or HTTP loopback), authorization code flow, S256 PKCE and exact resource binding to the endpoint. Authorization requests expire in ten minutes; codes expire one minute after consent and are single-use. Access tokens expire in fifteen minutes. offline_access issues a thirty-day rotating refresh token; replaying a consumed refresh token revokes its entire grant. Tokens and codes are hashed at rest. paperclip:read is required; paperclip:write adds only task creation and comments. Scope expansion requires a new consent flow.

Each grant records the person, client, company, resource and scopes. Membership and company availability are rechecked at execution. Instance admin status does not elevate a grant beyond that company's role. Consent/revocation require an authenticated browser and the configured origin. Client registration does not fetch redirect URLs or accept arbitrary tool destinations. Rate limiting at the public edge is required in addition to the bounded per-process auth limiter. Registration also has a database-enforced limit of 60 new clients per minute and 10,000 unconsented clients shared across replicas. Expired authorization requests and never-consented clients older than one hour are collected during registration. Clients with grants are retained, preserving their connections and audit/mutation history.

Revocation blocks future calls; it does not cancel already delegated work or undo in-flight mutations. Manage existing tasks and execution in Paperclip. Audit records identify the human caller and connection/client for mutations. OAuth credential bodies and redirect locations are redacted from HTTP logs.

Tool surface

Tool Effect
paperclip_connection Person, company, scopes, connection management link
paperclip_list_agents Safe agent summary and availability
paperclip_list_projects Safe project summary
paperclip_search_tasks Bounded task search with offset pagination
paperclip_read_task Current task plus recent comments/history
paperclip_create_task Assigned task, submitted to existing scheduling
paperclip_add_comment Human feedback; may wake or queue work
paperclip_list_deliverables Documents and work-product references
paperclip_read_document Durable document body
paperclip_pending_approvals Pending approvals and existing decision links

Every company-scoped call requires its explicit authorized company ID. The server emits bounded projections rather than agent configurations or upstream credentials. URLs include the company's prefix so unrelated browser company selection cannot redirect the user to a different team's approval interface.

Writes require a UUID requestId, unique per intended action. A durable receipt is reserved before dispatch, keyed by person, company, operation and request ID (with the originating grant recorded for audit). Matching retries, including after a new authorization grant, replay the recorded result; changed arguments are rejected. A concurrent or unconfirmed result is reported as outcome: unknown. Inspect the task and comments before another action; never retry with a new ID to force success. A known HTTP rejection is recorded and replayed as outcome: rejected.

The REST bridge dispatches only paths constructed by the closed tool catalog, with a request-local verified actor. Existing handlers enforce all domain checks and own their transaction/scheduling semantics. Receipts do not turn existing asynchronous scheduling into an exactly-once execution guarantee. Creating a task is not proof that an agent started or finished it.

Hosted onboarding and release gates

When PAPERCLIP_CLOUD_API_ORIGIN is present, consent links to the existing Cloud /orgs/new flow in a separate tab. Provisioning, mission/template selection, model credentials, execution capacity and spending remain owned by Cloud. Installing a plugin never provisions a company or starts paid agents.

This repository implements the instance-side connection and vendor packages. The companion Cloud implementation supplies the stable public resource, an account-to-stack OAuth broker, explicit organization selection and a return from hosted organization creation. Its public connection screen resumes normal sign-in, lists authorized organizations, reports provisioning/sleeping states, and links to tenant setup for mission, templates, execution and spending.

The Cloud broker forwards the original PKCE challenge to tenant OAuth, validates the resulting person, and wraps tenant credentials in encrypted tokens bound to client, workspace and resource. Every call rechecks current Cloud membership and verified routing; the tenant rechecks company permissions and revocation. Cloud stores request metadata and code hashes, not raw tenant tokens. Unknown mutation outcomes preserve the existing request-ID receipt contract.

Deploy both sides before hosted use. Cloud's tenant front door forwards only exact discovery, OAuth protocol and MCP paths without minting human authority; consent and management retain normal browser entry. The Cloud broker remains opt-in and requires its own durable OAuth state and encryption key from the provider secret store. Installing these source packages does not deploy an endpoint, open signup, register a listing, or provision execution capacity.

Before release, exercise actual ChatGPT/Codex and Claude connections against a staging HTTPS deployment, including client registration, consent, refresh, revocation, reconnect, task delegation and retrieval from another conversation. Prove scheduled execution on a controlled agent and the new-user Cloud return journey. Local OAuth interoperability has been verified with Codex CLI 0.153.4 and Claude Code 2.1.245, using disposable Cloud/tenant fixtures. Protocol tests, CLI login and local package validation do not replace these release gates.

External sessions acting as agents, task leases and third-party granted tools remain the second/third releases; do not add generic executors to this public catalog to implement them.

Registration also enforces shared source quotas (6 per minute and 30 unconsented clients) using a resource-bound hash of the trusted request IP; raw addresses are not stored. Configure trusted proxies correctly. Authorization starts atomically remove expired requests and enforce 10 pending-consent requests per client and 1,000 instance-wide, independently of further client registrations. Existing grants remain usable when anonymous registration or authorization is throttled.

Task monitoring with MCP Events

The same authenticated endpoint now supports MCP 2.0 (2026-07-28) alongside legacy MCP. It advertises events through server/discover and implements events/list, events/subscribe, and events/unsubscribe. MCP 2.0 requests include matching MCP-Protocol-Version/Mcp-Method headers, per-request version and client-capability metadata, and Mcp-Name for tool calls. Existing initialize-based clients keep the ten-tool connection.

Event Required filters Payload
paperclip.task.status_changed companyId, taskId; optional statuses Task ID, status, company ID and task link
paperclip.task.comment_created companyId, taskId Task/company IDs, comment ID and task link
paperclip.task.document_updated companyId, taskId Task/company IDs, document key, revision and task link

In an Events-capable ChatGPT Work Cloud chat or dot, ask, for example: “Watch this task. When it finishes, read its report and tell me the result.” The host supplies a callback URL and signing secret and owns refresh/unsubscribe. Rescan the plugin's MCP server to discover the event catalog. Installing or connecting alone does not start monitoring. Claude and other clients without Events support can continue retrieving results through the read tools.

Callback and hosted-authority verification reserve durable capacity before any remote request. Across replicas, at most 2 verifications per grant, 8 per company and 32 per instance can run concurrently. Attempts are bounded to 30 per grant, 200 per company and 1,000 per instance per minute, including failed verification. New monitors reserve subscription quota before verification; leases expire after one minute. Network waits hold no database transaction, and expired, cancelled or revoked requests cannot finalize a subscription.

Delivery uses a verified HTTPS callback, Standard Webhooks HMAC signatures, public-address DNS pinning on every connection, and no redirects. Callback URLs, current/previous signing keys and hosted authorization proofs are encrypted with the existing instance secrets master key. Back up that key with the database. Callback bodies contain bounded references, not comment/document text; clients must read current authorized state before responding or taking an action.

Subscriptions last at most 24 hours (default), with a 30-second minimum. Hosted subscriptions last at most five minutes and never outlive the broker access proof: refresh the OAuth token before refreshing a subscription when necessary. The tenant verifies that proof through the fixed PAPERCLIP_CLOUD_API_ORIGIN broker before each delivery, checking current Cloud membership as well as local company membership, grant revocation and task access. A compatible Cloud broker must be deployed first for hosted Events. Direct connections to a Cloud tenant without a broker authority proof cannot create event subscriptions.

Subscriptions and delivery receipts persist across restarts. Activity is scanned without a moving timestamp high-water mark; unique receipts prevent duplicate queue entries and concurrent workers claim deliveries atomically. Delivery is at least once, with up to six attempts and exponential backoff. IDs stay stable across retries while signatures receive fresh timestamps. HTTP 410 stops a monitor; 413 and other permanent failures are not retried. Secret rotation signs with both keys for five minutes. Expired subscriptions and their receipts are removed on the next admission or after seven days; active quotas are 20 per grant, 100 per company and 1,000 per instance. Unsubscribe frees the subscription and its receipts.

This release returns cursor: null: it does not offer protocol replay after an expired/stopped subscription. Use task history and document tools to recover missed changes. In-flight requests may finish during unsubscribe/revocation; subsequent attempts recheck access. Events are data, and may be duplicated or out of order. Do not post comments merely to acknowledge comments or documents, which would risk a feedback loop. Approval decisions remain in Paperclip.

See OpenAI's MCP Events guide for currently supported client surfaces. Actual staging ChatGPT subscription, plugin rescan and event-triggered response are still deployment acceptance gates; local protocol and paid model tests do not establish store/UI readiness.

Storybook previews

Run pnpm storybook and open the Assistant connections group. The stories render the production consent, connection-management, and Experimental pages, including read-only roles, loading, empty, unavailable, pending, revoked, and failed-save states. Interactive stories verify organization-switch consent reset, revocation, and settings rollback. All MCP actions use per-story in-memory fixtures; no credentials are issued and no work is delegated.

The Cloud repository's web Storybook has Assistant connections / Hosted connection for sign-in, organization selection, and the create-and-return flow. OAuth redirects between the two services remain mocked in these previews.

Guided assistant walkthrough

Open Assistant connections → Start here → Guided walkthrough for a presenter-led story about Alex connecting Acme Research. Each step explains where Alex is, what to try, what happens next, and a question to discuss. Next/Back and numbered chapters control the explanation independently of the interactive product preview; Reset this screen restores that step’s fixture. Each screen starts fresh, so sample state does not persist between chapters.

The Cloud walkthrough covers sign-in, choosing or creating an organization, readiness, and the handoff. The Paperclip walkthrough covers the experimental setting, organization consent, example delegation and retrieval conversations, and revocation. Assistant conversations are explicitly illustrative; product screens use isolated service fixtures. No paid work or real OAuth runs here.

Local cross-links expect Paperclip Storybook on port 6106 and Cloud on 6107. The default scripts use port 6006; launch these in separate terminals with explicit overrides:

# From the Paperclip repository's ui/ directory:
pnpm exec storybook dev --port 6106 --config-dir storybook/.storybook --no-open

# From the paperclip-cloud repository's web/ directory:
npm run storybook -- --port 6107

When published elsewhere, open the companion Storybook separately. Each walkthrough works independently. Navigation check is a separate interaction story so the presentation itself never advances automatically.

Cloud selects an organization once and sends its registry company ID as the optional OAuth company_id parameter. Paperclip persists it as mcp_oauth_requests.requested_company_id, filters the consent response to that company, and rejects approval for any other company even if the user belongs to both. It is a scope restriction, never a substitute for active membership or explicit read/write consent. A deleted, archived, or inaccessible company cannot fall back to another one. The UI shows the fixed organization and permissions, with cancel/reconnect guidance if it is unavailable.

Direct instance requests without company_id retain their organization picker. There is no separate “team” entity in this flow. Cloud’s organization maps to its stack’s primary Paperclip company; the stack is hosting infrastructure. The hosted walkthrough uses Consent → Hosted organization; direct selection, read-only, and unavailable-organization variants remain separately inspectable.

Apply the additive nullable request-column migration before running this tenant version, and deploy tenant support before the Cloud broker that sends the binding. Existing direct requests and grants are unchanged.