Skip to content

feat(mcp demos): move OAuth templates to workers-oauth-provider 1.2.4 - #681

Merged
mattzcarey merged 3 commits into
mainfrom
mcp-demos-oauth-provider-1x
Oct 27, 2026
Merged

mattzcarey merged 3 commits into
mainfrom
mcp-demos-oauth-provider-1x

Conversation

@mattzcarey

Copy link
Copy Markdown
Member

The MCP OAuth templates now use @cloudflare/workers-oauth-provider@^1.2.4, still with the single-Worker OAuthProvider. Follow-up to #680, whose last two commits landed on the branch after it merged.

1.x requires resourceMetadata.resource, the URL every token is bound to:

  • Each template reads it from an MCP_RESOURCE var, as cloudflare-mcp does. The default in wrangler.jsonc is the local dev URL (http://localhost:<port>/mcp).
  • Each README says to set MCP_RESOURCE to the deployed URL before deploying.
  • The removed allowPlainPKCE option is dropped, and mcp-server-bearer-auth (which only imports a type) is bumped too.
export default new OAuthProvider<Env>({
	apiRoute: "/mcp",
	apiHandler: { fetch: (request, env, ctx) => mcpHandler(request, env, ctx) },
	defaultHandler: app,
	authorizeEndpoint: "/authorize",
	tokenEndpoint: "/token",
	clientRegistrationEndpoint: "/register",
	resourceMetadata: { resource: env.MCP_RESOURCE },
});

Covers remote-mcp-server, -server-autorag, -github-oauth, -google-oauth, -logto, -authkit, -cf-access, -auth0/mcp-auth0-oidc and mcp-slack-oauth.

  • tsc --noEmit and wrangler deploy --dry-run pass for each template.
  • Ran remote-mcp-server under wrangler dev through registration, /authorize, token exchange and an authorized tools/call on 1.2.4. The protected resource metadata reports the MCP_RESOURCE value.

Bump every OAuthProvider demo to @cloudflare/workers-oauth-provider ^1.2.4 and
keep the single-Worker OAuthProvider. 1.x requires resourceMetadata.resource,
so each demo builds one provider per origin with resource `${origin}/mcp`,
which works on workers.dev, custom domains and wrangler dev. Drop the removed
allowPlainPKCE option.
Replace the per-origin provider map with a single OAuthProvider whose
resourceMetadata.resource comes from an MCP_RESOURCE var, as cloudflare-mcp
does. The default points at the local dev URL; READMEs say to set it to the
deployed URL.
@changeset-bot

changeset-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8995121

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Add it to minimumReleaseAgeExclude, as the repo does for other fresh releases,
and update the lockfile for mcp-server-bearer-auth's bump.
@pkg-pr-new

pkg-pr-new Bot commented Oct 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/cloudflare/ai/ai-gateway-provider@681
npx https://pkg.pr.new/cloudflare/ai/ai-search-provider@681
npx https://pkg.pr.new/cloudflare/ai/@cloudflare/tanstack-ai@681
npx https://pkg.pr.new/cloudflare/ai/workers-ai-provider@681

commit: 8995121

@mattzcarey
mattzcarey merged commit 34a8f4c into main Oct 27, 2026
4 checks passed
@mattzcarey
mattzcarey deleted the mcp-demos-oauth-provider-1x branch October 27, 2026 10:39
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