From bdf20eb93e4b9f4e5e8d37a24dbc62d336f90b12 Mon Sep 17 00:00:00 2001 From: Gustavo Valverde Date: Wed, 14 Oct 2026 19:47:33 +0000 Subject: [PATCH] fix(demo): link dynamically registered MCP clients to the MCP resource (#11764) --- demo/nextjs/lib/auth.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/demo/nextjs/lib/auth.ts b/demo/nextjs/lib/auth.ts index 5a00dd30a9..698e33384a 100644 --- a/demo/nextjs/lib/auth.ts +++ b/demo/nextjs/lib/auth.ts @@ -37,6 +37,7 @@ import { resolveSCIMDemoSSOUser } from "./scim-demo-employee.ts"; import { getSCIMDemoOIDCProvider } from "./scim-demo-oidc.ts"; const DEMO_SQLITE_CONTENTION_TIMEOUT_MS = 5_000; +const mcpResource = `${process.env.BETTER_AUTH_URL || "https://demo.better-auth.com"}/api/mcp`; const database = (() => { if (process.env.DEMO_SQLITE_PATH) { @@ -420,9 +421,10 @@ const authOptions = { ], resources: [ process.env.BETTER_AUTH_URL || "https://demo.better-auth.com", - (process.env.BETTER_AUTH_URL || "https://demo.better-auth.com") + - "/api/mcp", + mcpResource, ], + // DCR clients omit `resources`; link them to the MCP server like `mcp()` does. + clientRegistrationDefaultResources: [mcpResource], selectAccount: { page: "/oauth/select-account", shouldRedirect: async ({ headers }) => {