Repository navigation
Fix Dato Agent sign-in: use oauth.datocms.com OAuth endpoints - #157
Conversation
mcp.datocms.com/register now answers every dynamic client registration with 401 invalid_client. The MCP server's protected-resource metadata advertises https://oauth.datocms.com as its authorization server, so register, authorize, token and revoke now target /oauth/* there. The resource parameter still names mcp.datocms.com. Bump OAUTH_CLIENT_REGISTRATION_VERSION so client IDs registered against the legacy endpoint are replaced on the next sign-in.
|
(Claude here [Opus 5.5]) TriageStatus: still needed. Master ( Root cause confirmed live today:
Review
Checks
Recommended next step
|
|
Let's merge this! 🙏🏻 |
|
@marcelofinamorvieira I'm going to go ahead and merge this one. (Thank you @rodrigobarona!) But Marcelo, only you can deploy on NPM right now. Claude tested it: pr-157-walkthrough.mp4And I did too (as a human, clicking the mouse like it's 2025 😅)! The existing behavior is already broken and the fix works. Let's separately discuss how we want to go through the rest of the open PRs and issues? I'll review the ones I can and leave notes for you, but those aren't as urgent as this one so they can wait for your blessings 🙏 (Marcelo is the agent's real dad, I'm just babysitting!) |
mcp.datocms.com/.well-known/oauth-protected-resource advertises the resource as "https://mcp.datocms.com/" (trailing slash). RFC 8707 compares resource indicators as strings, so send that exact value in the authorization request and the token exchange. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #156
What
Dato Agent sign-in fails with
Dynamic client registration failed with HTTP 401 (invalid_client)becausemcp.datocms.com/registernow rejects every registration. The MCP server's protected-resource metadata advertiseshttps://oauth.datocms.comas its authorization server, so this PR moves the plugin's OAuth calls there.Changes
src/lib/oauth.ts: addOAUTH_ORIGIN/OAUTH_BASE_URLand usehttps://oauth.datocms.com/oauth/{register,authorize,token,revoke}.navigateOAuthPopupnow only allowshttps://oauth.datocms.com/oauth/authorize. Theresourceparameter is unchanged (https://mcp.datocms.com), since the token audience is still the MCP server.src/lib/credentials.ts: bumpOAUTH_CLIENT_REGISTRATION_VERSIONfrom 2 to 3 so client IDs registered against the legacy endpoint are replaced on the next sign-in, using the existing legacy-registration path.navigateOAuthPopupthat accepts the new authorize URL and rejects the legacy one.No version bump or release; left to maintainers.
Verification
npm run typecheck,npm run lint,npm test(49 files, 952 tests),npm run build: all pass.oauth.datocms.com: DCR with the plugin's payload returns aclient_id./oauth/authorizewith that client, PKCE S256 andresource=https://mcp.datocms.comreturns302to/session/new.Follow-up idea
Discover the authorization server from
https://mcp.datocms.com/.well-known/oauth-protected-resourceinstead of hardcoding it.