mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-05 05:47:01 +01:00
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work.
> - Agents reach external apps through MCP connections. Paperclip
records each call and shows it as a tool row in the task chat.
> - MCP Apps (SEP-1865, extension `io.modelcontextprotocol/ui`, spec
2026-01-26) lets an MCP server attach an interactive `ui://` view to a
tool. Claude, Claude Code and VS Code render these views in chat.
Circleback uses them to show meeting cards.
> - Paperclip dropped the tool's `_meta.ui` at discovery and the
result's `_meta` at call time. Its gateway reported MCP App UI as
"unsupported". Circleback was reachable only through Composio, whose
toolkit has no `Display*` tools.
> - This pull request makes Paperclip an MCP Apps host. It also adds
Circleback as a native catalog connection.
> - The benefit is that a Circleback recap in a task shows the same
meeting cards as in Claude, and any other MCP server with views works
the same way.
## Linked Issues or Issue Description
**Subsystem affected**
Connections and apps (remote MCP gateway) and the task chat.
**Problem or motivation**
An agent that uses Circleback in Paperclip can only return text. The
same tools in Claude Code show interactive meeting cards
(`DisplayMeetings`). Paperclip discards the MCP Apps metadata, so it
cannot show them.
**Proposed solution**
Paperclip implements the host side of MCP Apps end to end. It keeps the
tool's view declaration and records each call that has a view. It
renders the view under the tool row in a sandboxed iframe that uses the
MCP Apps postMessage protocol. Circleback becomes a native catalog
connection, so its `Display*` tools are available.
**Alternatives considered**
Composio's `circleback_mcp` toolkit has 11 read tools and no `Display*`
tools, and its meta-tools return plain JSON, so it cannot carry views.
The spec's double-iframe sandbox proxy on a separate origin needs a
second origin that Paperclip does not have. A single opaque-origin
`srcdoc` frame with an injected CSP gives the same isolation.
**Roadmap alignment**
This extends the existing Apps catalog and MCP gateway. It adds no new
integration substrate (decision D4 in doc/connections/README.md).
**Additional context**
The standard, the design and the testing plan are in
`doc/connections/MCP-APPS.md`.
## What Changed
- **Shared:** `packages/shared/src/mcp-apps.ts` adds MCP Apps types,
`_meta.ui` and resource parsing (current and legacy keys), and a CSP
builder that keeps only well-formed `https` origins.
- **DB:** migration `0471` (`online_compatible`) adds
`tool_catalog_entries.ui_meta` and a new `tool_mcp_app_views` table.
- **Server, catalog:** discovery keeps each tool's `_meta.ui`. It is not
part of the version hash, so a view never quarantines a reviewed tool.
- **Server, gateway:**
- Paperclip advertises the MCP Apps client capability when it
initializes a session.
- App-only tools (`visibility: ["app"]`) are hidden from agents.
- The result `_meta` is kept for the view and is not sent to the agent.
- Each successful call to a tool with a view records a view row.
Recording is best effort.
- The gateway's `initialize` now reports `paperclip/mcp-app-ui:
host_rendered`.
- The context protocol (`resources/read`) now uses the injected test
transport, like the other remote calls.
- **Server, routes:** `server/src/routes/mcp-apps.ts`
- `GET /api/issues/:issueId/mcp-app-views` lists a task's views. It
needs task read access.
- `GET /api/issues/:issueId/mcp-app-views/:viewId` returns the view
document, read live through the agent's connection.
- `POST /api/issues/:issueId/mcp-app-views/:viewId/tool-calls` runs the
view's `tools/call`. It needs `tools:use` and reaches only tools of the
same connection that allow `app`. It uses the connection test-call path,
so policy, Ask first and audit apply.
- **UI:** `ui/src/components/mcp-app/`
- The host protocol: `ui/initialize` with theme, style variables and
size limits; tool-input; tool-result; size-changed; `tools/call`;
`ui/open-link` (http and https only); teardown.
- An opaque-origin iframe (`allow-scripts`, never `allow-same-origin`)
with the CSP placed before the view's markup.
- The views of a run render with that run's reply, in the live turn and
in settled history. They are keyed by the reply's run, so history needs
no transcript.
- **Circleback:** a native catalog app (`mcp-oauth`, DCR, `user
user:write`) with:
- the official logo;
- a reviewed risk classifier (Share* tools are writes, Delete* tools are
destructive, Display* tools are reads);
- warnings in the sign-in step;
- `doc/connections/CIRCLEBACK.md`.
Search now prefers a native app over an aggregator listing named "X
MCP".
- **Storybook:** `Tasks/MCP App views` shows the tool row with its view,
the ready state (Refresh calls a tool), loading, view unavailable, and a
tool call that needs approval.
## Verification
- `pnpm exec vitest run packages/shared/src/mcp-apps.test.ts
ui/src/components/mcp-app/`: 19 passed.
- `pnpm exec vitest run server/src/__tests__/mcp-apps.test.ts`: 3
passed, on embedded Postgres. The test connects Circleback through the
catalog with DCR OAuth against a fake Circleback MCP server. It checks:
- `ui_meta` is stored;
- an app-only tool is hidden from the agent;
- an agent call records one view with arguments, structured content and
`_meta`;
- a call without a view records nothing;
- the routes serve the view's HTML and CSP;
- the view's tool call works and a model-only tool is refused;
- another task, another company and an agent actor are refused.
- Circleback connector: 13 focused files, 645 tests passed. These are
the app definitions, search, aggregator fallback, connection intents,
tool policy, `AppsConnect` and `Browse`.
- Typecheck passed for `@paperclipai/shared`, `@paperclipai/server` and
`@paperclipai/ui`. `node scripts/storybook-catalog.mjs` and the
migration compatibility check also passed.
- Storybook check in the browser:
- In both themes, the view runs the handshake, renders the meeting cards
from `structuredContent`, picks up the theme variables, and resizes to
its content.
- Refresh sends `tools/call` and re-renders the cards.
- **Live Circleback end to end** on a local instance, with a real
Circleback account:
- Connected through the catalog entry with Circleback's dynamic client
registration and OAuth.
- Discovery stored the real view declarations:
- `DisplayMeetings` uses `ui://circleback/meetings.v2.html`.
- `DisplayActionItems` and `DisplayCalendarEvents` also have views.
- `ListAssigneeOptions` and `SetCalendarEventRecording` are app-only
helpers with no view. They are hidden from agents.
- A `claude_local` agent called `DisplayMeetings` on two tasks.
- The real 3.5 MB Circleback view rendered the meeting cards with the
agent's reply.
- Clicking a card opened that meeting in Circleback through
`ui/open-link`.
- The live run found two bugs, both fixed in this PR, each with a
regression test:
- The 1 MB tool-result limit blocked the view document.
- Views were hidden inside the folded tool history.
## Risks
- **New migration:** a new table and a nullable column. It is
`online_compatible`.
- **Existing connections:** tools get `ui_meta` on the next catalog
refresh. Until then, no view shows and the tool row is unchanged.
- **Untrusted provider HTML:** the view runs as provider HTML in an
opaque-origin sandbox. It cannot reach Paperclip's session, DOM or API.
Its network access is limited to the origins its server declared. A
view's tool calls use the viewer's permissions and the normal policy and
Ask-first path.
- **Agent tool lists:** app-only tools are removed from them. No current
provider marks tools app-only, so no listed tool disappears.
- **Search:** the change that prefers a native app over an "X MCP"
aggregator listing affects every app.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and
subagents (one subagent authored the Circleback catalog connector).
## 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
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
170 lines
14 KiB
Markdown
170 lines
14 KiB
Markdown
# Tool connection permission audit — 2026-09-30
|
|
|
|
This review covers 119 tool methods (85 OAuth methods). The machine-readable
|
|
[source of reviewed defaults](./tool-method-permission-reviews.json) lists each
|
|
method's exact requested scopes, supported actions, restrictions, sources and
|
|
verification limits. AI runtime authentication and chat/channel setup are
|
|
separate contracts and were not changed.
|
|
|
|
Methods reviewed after this audit carry their own `reviewedAt` date in the same
|
|
ledger; the counts above are not restated. Later additions: [Neon](./NEON.md)
|
|
(`mcp-oauth`, `mcp-api-key`; 2026-10-02), [Superagent](./SUPERAGENT.md)
|
|
(`mcp-api-key`; 2026-10-06), [Gauge](./GAUGE.md)
|
|
(`mcp-oauth`, `mcp-api-key`; 2026-10-08), [Ditto](./DITTO.md)
|
|
(`mcp-oauth`, `mcp-api-key`; 2026-10-10), [Unikraft](./UNIKRAFT.md)
|
|
(`api-token`; 2026-10-15), [Circleback](./CIRCLEBACK.md)
|
|
(`mcp-oauth`; 2026-11-12).
|
|
|
|
## Shared credential failure
|
|
|
|
Zapier's secret URL exposed a shared ownership/resolution problem. The same
|
|
invariants apply to personal pasted-key and custom-header methods, including
|
|
Bitly, Cloudflare, Coda, Fireflies, GitHub PATs, Kernel, O'Reilly, PagerDuty,
|
|
PostHog, Postman, Razorpay, Sanity, Similarweb, Stripe, Supabase and You.com.
|
|
Generic MCP setup uses this path too, so “Connect your own” was not a reliable
|
|
workaround. This is a code-path finding, not a claim that every provider was
|
|
tested with a live account.
|
|
|
|
Personal invocation secrets now belong to the grant's user. Setup, health,
|
|
discovery and the run gateway share ownership checks and canonical credential
|
|
paths. Public unauthenticated URLs need no credential repair. OAuth client
|
|
registration secrets remain company-owned and separate from invocation tokens.
|
|
Existing connections with incorrectly owned credentials require the owner to
|
|
reconnect with a fresh key or secret URL. There is no automatic ownership backfill.
|
|
|
|
## Changes
|
|
|
|
- Airtable now requests its seven documented record, schema, comment and
|
|
workspace/base scopes, including writes.
|
|
- Explicit scope sets were added for providers that advertise a scoped MCP
|
|
resource, including Beehiiv, Netlify, Miro, Sentry, Supabase, Todoist and
|
|
TickTick. Read and write remain subject to provider roles and resource selection.
|
|
- Hugging Face adds repository read/contribution and jobs to `read-mcp`.
|
|
Optional tools still need enabling in HF's MCP settings.
|
|
- Slack's reviewed set now covers the documented message, channel, reaction,
|
|
canvas, file and list actions. It replaces the obsolete generic search scope
|
|
with the documented search scopes. The fixed app/approval gate remains.
|
|
- Google write/draft methods take priority over managed read-only methods when
|
|
available. Existing Google profiles, preview verification and availability
|
|
gates remain. People and Workspace Search stay read-only.
|
|
- The hosted Fireflies server also exposes meeting sharing, renaming, moving and
|
|
soundbite creation. Its identity scopes are retained; meeting ownership and
|
|
team roles decide which mutations succeed.
|
|
- Provider read-only choices stay available under Advanced. Existing OAuth
|
|
tokens and action restrictions are untouched. Permissions offers reconnect
|
|
when provider consent needs changing.
|
|
|
|
## Provider-default exceptions
|
|
|
|
These are deliberate exceptions to supplying `scopesHint`, not claims that an
|
|
old grant can write. Several servers put resource/permission selection in their
|
|
own consent screen; Box uses registered app scopes, and managed GitHub uses
|
|
installation permissions. An authorization server's general scope catalog is
|
|
not a safe substitute for the MCP permission contract.
|
|
|
|
| Provider / method | Reason and limits |
|
|
| --- | --- |
|
|
| bitly / `mcp-oauth` | The official MCP quickstart uses browser authorization without client-selected scopes; neither protected-resource nor authorization-server metadata advertises a scope list. Bitly account permissions govern link actions. [Evidence](https://dev.bitly.com/bitly-mcp/overview/quickstart/) |
|
|
| box / `mcp-own-oauth` | Box requires scopes (including Manage AI) on the registered Box app in the Admin Console. Its MCP authorization metadata has no request-scope list; consent and the app registration control file operations. [Evidence](https://support.box.com/hc/en-us/articles/43847256139923-Managing-Box-MCP-Servers) |
|
|
| egnyte / `mcp-oauth` | The hosted authorization server selects the Egnyte tenant/account permissions. Neither MCP nor authorization-server metadata advertises request scopes. Documentation rendered no readable body during this review; tenant-bound write proof remains required. [Evidence](https://developers.egnyte.com/docs/Remote_MCP_Server) |
|
|
| github / `managed` | Managed github.code uses a GitHub App installation and selected repositories. Installation permissions, not OAuth scope strings, grant code and pull-request writes; retain the managed profile. [Evidence](https://api.githubcopilot.com/.well-known/oauth-protected-resource/mcp/) |
|
|
| make / `mcp-oauth` | Make documents selecting scopes and scenarios during its hosted connection flow. Management tools require a paid plan. Do not replace that resource selection with invented MCP client scopes. [Evidence](https://developers.make.com/mcp-server) |
|
|
| oauth-generic / `oauth` | Operator-defined OAuth endpoints have no provider-specific reviewed scope list. Request only the scopes supplied by the operator; this template is not a curated provider allowlist. [Evidence](https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization) |
|
|
| planetscale / `mcp-oauth` | PlanetScale documents choosing organizations, databases and read/write permission at authorization. Its general authorization server advertises unrelated organization administration too; retain the provider consent selection, and the separate insights-only endpoint. [Evidence](https://planetscale.com/docs/connect/mcp) |
|
|
| planetscale / `mcp-insights-only` | PlanetScale documents choosing organizations, databases and read/write permission at authorization. Its general authorization server advertises unrelated organization administration too; retain the provider consent selection, and the separate insights-only endpoint. [Evidence](https://planetscale.com/docs/connect/mcp) |
|
|
| posthog / `mcp-oauth` | PostHog documents the no-scope MCP setup as read/write, with optional readonly and feature filters. The authorization server advertises account administration unrelated to many tools; retain its MCP consent defaults and the existing explicit filters. [Evidence](https://posthog.com/docs/model-context-protocol) |
|
|
| postman / `mcp-oauth-minimal` | The official remote MCP setup uses browser sign-in and endpoint-selected minimal/code/full tool catalogs. Its protected-resource and authorization-server metadata publish no scope set; account/workspace rights govern writes. [Evidence](https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server) |
|
|
| postman / `mcp-oauth-code` | The official remote MCP setup uses browser sign-in and endpoint-selected minimal/code/full tool catalogs. Its protected-resource and authorization-server metadata publish no scope set; account/workspace rights govern writes. [Evidence](https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server) |
|
|
| postman / `mcp-oauth-full` | The official remote MCP setup uses browser sign-in and endpoint-selected minimal/code/full tool catalogs. Its protected-resource and authorization-server metadata publish no scope set; account/workspace rights govern writes. [Evidence](https://learning.postman.com/latest-v-12/docs/reference/postman-api/postman-mcp-server/postman-mcp-remote-server) |
|
|
| razorpay / `mcp-oauth` | Neither protected-resource nor authorization-server metadata advertises scopes. Keep hosted provider consent; the previous official OAuth documentation URL returned 404 during review. Account-bound writes need live confirmation. [Evidence](https://razorpay.com/docs/mcp-server/oauth/) |
|
|
| ticket-tailor / `mcp-oauth` | Hosted authorization controls box-office API-key permissions; do not treat OAuth sign-in as increasing the underlying key permissions. This method requires account-bound proof. [Evidence](https://developers.tickettailor.com/docs/mcp/authentication/) |
|
|
| webflow / `mcp-oauth` | The official MCP setup installs the Bridge App and asks users to authorize sites. Neither protected-resource nor authorization-server metadata publishes a request-scope list; the installed app and site selection govern writes. [Evidence](https://developers.webflow.com/mcp/reference/getting-started) |
|
|
|
|
## Read-only and provider-controlled methods
|
|
|
|
Candid, Context7, O'Reilly, Similarweb and You.com expose retrieval/research
|
|
capabilities rather than document/account mutation. PlanetScale's insights-only
|
|
endpoint deliberately excludes query execution. Xero's current published MCP
|
|
scope set includes invoice/report reads and settings access, without invoice
|
|
write permission. Do not widen these using unrelated general API scopes.
|
|
|
|
Scopes such as `openid`, `global`, `mcp:all` or `workspace:member` do not have to
|
|
contain the word “write” to authorize work. The provider's MCP tool contract,
|
|
role and consent selection determine their meaning. In particular, Cloudflare,
|
|
Vercel, Wix, Kernel and Supermemory retain their provider-side permission gates.
|
|
|
|
## Evidence and verification boundaries
|
|
|
|
Official docs and unauthenticated protected-resource/authorization metadata were
|
|
retrieved on 2026-09-30. The review records source URLs per method. Some pages
|
|
(especially Egnyte and Razorpay's old OAuth URL) were unavailable or unreadable;
|
|
those entries explicitly retain that limitation. Embat publishes identity
|
|
metadata but no verified write contract. No account-bound write guarantee is
|
|
made for these entries.
|
|
|
|
No provider account was used for live read/write verification in this task.
|
|
In particular, public scope metadata is **not** proof that an existing token has
|
|
those permissions or that an account has the required paid plan, resource ACLs,
|
|
admin approval, or Google preview enrollment. Use test accounts/resources for
|
|
that proof before claiming provider-level acceptance.
|
|
|
|
Backend regressions execute catalog Zapier, generic secret URLs, personal
|
|
bearer/custom headers, organization credentials and public URLs through the
|
|
run-scoped gateway using a fixture transport. They assert canonical persisted
|
|
ownership/declarations and run read and write calls. Reconnect regressions cover
|
|
replacing legacy company credentials with user-owned values and declarations.
|
|
OAuth fixtures assert exact authorization scopes and rejection of an unrelated
|
|
advertised admin scope; they do not contact provider accounts.
|
|
|
|
The managed worktree has a separate instance configuration and database path.
|
|
Local CLI provisioning was attempted with both minimal and full seed modes;
|
|
both failed while applying the copied database's migrations because
|
|
`tool_connections_transport_check` was missing. The development instance was
|
|
not started from that clone. Clean fixture databases were used for the backend and Apps browser
|
|
checks; their success does not establish successful seeding of that local copy.
|
|
|
|
### Embedded-browser acceptance
|
|
|
|
On 2026-09-30, a hands-on walkthrough used the PR checkout's built UI and actual
|
|
server, a fresh isolated database created through CLI onboarding, and a local
|
|
HTTP MCP fixture. Starting from the sidebar's Connectors page, the operator
|
|
selected “Just me,” entered a bearer key, and created and read back a disposable
|
|
widget through the Permissions screen's agent test controls.
|
|
|
|
After seeding the legacy ownership mismatch in that disposable connection,
|
|
invocation and catalog refresh rejected it with `grant_credential_invalid`.
|
|
The catalog showed “Needs attention” and offered Reconnect. Replacing the key
|
|
through that UI preserved the connection and personal grant, created a fresh
|
|
user-owned secret and canonical declaration, and restored writes. The legacy
|
|
company secret retained its ownership. Separate HTTP calls through a session
|
|
bound to a fixture agent run also completed a write and read-back.
|
|
|
|
The walkthrough exposed and verified fixes for a false “Still not working”
|
|
message after successful reconnect, incorrect action-input advice for ownership
|
|
errors, and Cancel attempting to save an invalid Zapier URL. The browser
|
|
reconnect regression now performs the replacement through the form and checks
|
|
that the stale warning disappears.
|
|
|
|
A second personal connection used a secret URL. After reproducing its legacy
|
|
ownership failure, the browser could replace the URL and create/read back a
|
|
widget. Generic reconnect now derives URL/header fields from the stored
|
|
credential placement instead of assuming a bearer key, and rejects replacement
|
|
URLs for a different public endpoint. A new public, organization-wide connection
|
|
also appeared immediately when returning to Browse, without a page reload.
|
|
The walkthrough fixed setup cache invalidation and a cramped reconnect banner.
|
|
|
|
Zapier's URL validation and cancellation were exercised, but a live Zapier
|
|
connection was not completed. Gmail stopped at instance enrollment. Neither
|
|
journey establishes provider-account consent or live provider read/write proof.
|
|
|
|
### Automated verification
|
|
|
|
- Run `pnpm -r typecheck`, `pnpm build`, and `pnpm check:token-gates`.
|
|
- The affected Apps browser suites passed 10 tests, with one existing restart
|
|
case skipped. These used clean, isolated fixture databases.
|
|
- Run `pnpm test:run` for the full suite. Current-head CI and local results are
|
|
recorded in the pull request; fixture coverage is distinct from provider proof.
|
|
- New gateway fixtures execute both read and write calls through real run-scoped
|
|
gateway sessions. They also verify that invalid ownership requires reconnect
|
|
and that the owner's fresh credentials restore access without changing identity.
|