Fix Canva MCP connect after OAuth succeeds - #419
TheGreatAxios merged 10 commits into
Conversation
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Comment
Pins Canva MCP connect to the same origins later calls allow, sends advertised DCR scopes, and surfaces client-registration failures and tool count on the Plugins row.
Findings
packages/connections/src/mcp-oauth-routes.ts:84—CLIENT_REJECTED_OAUTH_CODESincludesinvalid_redirect_uri, but SDK 1.30.0parseErrorResponsemaps that unmapped RFC 7591 code toServerError(errorCodeserver_error). Set membership never fires; classification depends on description substrings. A DCR 400{error: "invalid_redirect_uri"}with empty or unrelatederror_descriptionyieldsdiscovery_failed, notclient_rejected.
Notes
- Live Canva-account connect is not verified on this branch. Linear outcome boxes stay unchecked until that repro lands on main.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Critic · Comment
Connect probes pin to the same origins later tool calls allow; DCR sends Canva scopes; Plugins maps client_rejected and hydrates tool count; MCP tool calls wait 2 minutes.
Findings
packages/connections/src/mcp-oauth-routes.ts:84—invalid_redirect_uriinCLIENT_REJECTED_OAUTH_CODESis dead: SDK 1.30.0 maps it toServerError. Classification falls through to description substrings. Untested path: DCR 400{error: "invalid_redirect_uri"}with emptyerror_descriptionyieldsdiscovery_failed.
Notes
packages/connections/src/mcp-oauth-routes.ts:116— substring matching onError.messagecan misclassify a discovery/network throw asclient_rejected.packages/plugins-ui/src/mcp-preset-cards.tsx:258—toolCountsis seeded only from the OAuth return query; a later/pluginsload withouttoolCountfalls back to a bare Connected.packages/mcp-tools/src/mcp-client.ts:28— the 2 minute timeout also applies tolistMcpTools, so a hung post-authtools/listcan block the callback for 2 minutes.packages/credential-providers/src/mcp-origin-pinned-fetch.ts:13— extras allowhttps://canva.aiwhen pinned tohttps://mcp.canva.com;canva.comremains refused.packages/connections/src/mcp-oauth.ts:142—refreshMcpOAuthTokensstill constructs the provider withoutscope.
0e32828 to
c9ad47f
Compare
Connect used an unpinned fetch that followed redirects, so a handshake could succeed while later tool calls refused Canva's https://canva.ai first hop. Extra origins are an explicit map; 3xx is never followed.
Canva's protected-resource metadata advertises the scopes its MCP tools need. Including them in dynamic client registration keeps the authorize request explicit instead of relying on server-side defaults.
/start now maps DCR and client-metadata rejections to code=client_rejected so Plugins can say the app refused Workbench as a client, instead of a generic discovery failure.
The callback already sends toolCount; the Plugins card ignored it and showed a bare Connected.
The SDK times out at 60s, which is the documented duration of long tools. Two minutes sits under the 5 minute chat turn so a slow call can finish without outliving the turn.
SDK 1.30.0 maps unknown codes such as invalid_redirect_uri onto ServerError and drops the original error. Capture the HTTP body's error field before that mapping so an empty description still redirects as client_rejected.
Launch already knows the ref is missing (resolveRef returns null) and then called through to listAssetBlobs, which throws and kills every agent on the tenant. The tarball REST list already returns [] for the same not_found. Pins against a missing tarball still fail as unknown package.
5f51710 to
6ec8741
Compare
TheGreatAxios
left a comment
There was a problem hiding this comment.
critique · approve
Canva MCP connect path matches the brief: shared origin pin (mcp.canva.com plus canva.ai first hop, no 3xx follow), DCR scopes, client_rejected for RFC 7591 4xx, toolCount on return, 120s tool timeout, empty package-registry catalog. mcp-tools 0.0.10 matches the timeout source change. No DATABASE_URL leak.
Live Canva OAuth is still unverified (docs already say so) — not a code defect.
GitHub will not accept approve on the author's own PR; this comment is the review.
Summary
Verification
Touched-package tests pass in the worktree. Live Canva-account connect is not verified on this branch.
Linear: CL-7083
Closes CL-7083