examples: web-standard twin of the bearer-auth story (#2424)

This commit is contained in:
Felix Weinberger 2026-07-06 19:58:41 +01:00 • committed by GitHub
commit 7015d2129b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,18 @@
# bearer-auth-web
The web-standard twin of [`bearer-auth`](../bearer-auth/): the same minimal
Resource-Server-only story built entirely from `@modelcontextprotocol/server`
exports, with no framework.
Host and origin validation plus `requireBearerAuth` gate `createMcpHandler`,
composed as one `fetch(request)` handler. On Cloudflare Workers, Deno, or Bun
that handler is the whole server; `toNodeHandler` bridges it onto `node:http`
so the story runs in this repo's example matrix.
No Authorization Server and no discovery documents here, matching the sibling
— see [`oauth`](../oauth/) for the full RS + AS dance.
```sh
pnpm --filter @mcp-examples/bearer-auth-web server -- --http --port 3000
pnpm --filter @mcp-examples/bearer-auth-web client -- --http http://127.0.0.1:3000/mcp
```