Skip to content

fix(den-api): accept CIMD clients listing unsupported grant types - #5467

Merged
benjaminshafii merged 1 commit into
devfrom
fix/den-api-cimd-ignore-unsupported-grants
Sep 30, 2026
Merged

benjaminshafii merged 1 commit into
devfrom
fix/den-api-cimd-ignore-unsupported-grants

Conversation

@benjaminshafii

Copy link
Copy Markdown
Member

What is this about?

Connecting Claude to the OpenWork MCP server works again.

What problem does it solve?

Adding the OpenWork MCP connector in Claude failed with invalid_client: grant_types must be a subset of ["authorization_code", "refresh_token"].

What was the situation before?

Since #5293, Den advertises Client ID Metadata Document (CIMD) support, so Claude sends its CIMD URL as client_id instead of registering dynamically. Claude's document also lists urn:ietf:params:oauth:grant-type:jwt-bearer, and @better-auth/cimd rejects the whole document when it sees a grant type it doesn't support.

How is this implemented?

  • patches/@[email protected]: right after the metadata document is parsed, drop grant types the plugin does not support and keep the supported ones. A document with no supported grant type is still rejected. Every other validation is unchanged.
  • Registered in pnpm-workspace.yaml patchedDependencies, next to the existing better-auth patches.

What else changed?

none

Release note

Connecting Claude to OpenWork through the MCP connector no longer fails with an invalid_client grant_types error.

Evidence

No E2E. ee/apps/den-api/test/mcp-oauth-cimd.test.ts adds a test that uses Claude's published document verbatim. Without the patch it fails with the grant_types error. With the patch, authorize redirects to consent and the client is stored with ["authorization_code","refresh_token"]. 9/9 pass.

Claude's Client ID Metadata Document lists
urn:ietf:params:oauth:grant-type:jwt-bearer next to authorization_code and
refresh_token. @better-auth/cimd rejected the whole document, so connecting
Claude to the MCP server failed with invalid_client since #5293 started
advertising CIMD support. Patch the plugin to keep only the supported grant
types before validation.

Signed-off-by: Benjamin Shafii <[email protected]>
@benjaminshafii
benjaminshafii requested a review from a team September 30, 2026 00:18
@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 30, 2026 12:20am UTC
openwork-den Ready Ready Preview Sep 30, 2026 12:20am UTC
openwork-diagnostics Ready Ready Preview Sep 30, 2026 12:20am UTC
openwork-landing Ready Ready Preview, v0 Sep 30, 2026 12:20am UTC

This branch was successfully deployed

4 active deployments
Preview – openwork-landing — 7e047453 Deployed Sep 30, 2026 by vercel[bot]
Preview – openwork-app — 7e047453 Deployed Sep 30, 2026 by vercel[bot]
Preview – openwork-den — 7e047453 Deployed Sep 30, 2026 by vercel[bot]
Preview – openwork-diagnostics — 7e047453 Deployed Sep 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant