Skip to content

Add cloud MCP server with WorkOS OAuth - #128

Merged
RhysSullivan merged 8 commits into
mainfrom
feat/cloud-mcp-server
Apr 9, 2026
Merged

Add cloud MCP server with WorkOS OAuth#128
RhysSullivan merged 8 commits into
mainfrom
feat/cloud-mcp-server

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

Summary

  • Add MCP server endpoint at /mcp on the cloud app with WorkOS OAuth authentication (JWT verification via AuthKit JWKS at signin.executor.sh)
  • OAuth discovery via /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server endpoints
  • Durable Object sessions (McpSessionDO) to persist client capabilities and support pause/resume for clients without elicitation
  • Custom server entrypoint (src/server.ts) for DO class export with TanStack Start
  • Workers-compatible JSON Schema validator replacing Ajv (which uses new Function())
  • Fix static cloudflare:workers import causing SSR 500s → dynamic imports
  • MCP install card only shows HTTP transport option on cloud app

Test plan

  • OAuth flow works — Claude Code authenticates via AuthKit
  • execute tool visible (elicitation-capable clients hide resume)
  • Code execution works end-to-end through MCP
  • Well-known endpoints return correct metadata
  • Unauthenticated requests get 401 with WWW-Authenticate header

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 9, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing c112518 Commit Preview URL

Branch Preview URL
Apr 09 2026, 06:20 AM

RhysSullivan commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator Author

Static top-level import of cloudflare:workers in env.ts breaks TanStack
Start SSR, causing every route to 500. Move all Cloudflare binding access
to dynamic import() calls at each call site. Also adds MCP server
middleware and dependencies.
- Add /mcp endpoint with WorkOS OAuth (JWT verification via AuthKit JWKS)
- Add /.well-known/oauth-protected-resource and oauth-authorization-server endpoints
- Use Durable Objects for session persistence (client capabilities, pause/resume)
- Custom server entrypoint for DO class export
- Workers-compatible JSON Schema validator (replaces Ajv which uses new Function())
- Fix static cloudflare:workers import causing SSR 500s (dynamic imports)
- Show only HTTP transport option in MCP install card for cloud app
Users must already exist (created at signup). The MCP handler now
fails with a clear error if no team is found instead of silently
creating accounts.
@RhysSullivan
RhysSullivan force-pushed the feat/cloud-mcp-server branch 2 times, most recently from 6aef748 to 71d3d23 Compare April 9, 2026 06:15
@RhysSullivan
RhysSullivan force-pushed the feat/cloud-mcp-server branch from 71d3d23 to c112518 Compare April 9, 2026 06:18

RhysSullivan commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

  • Apr 9, 6:20 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 9, 6:20 AM UTC: @RhysSullivan merged this pull request with Graphite.

@RhysSullivan
RhysSullivan merged commit 8f81fb6 into main Apr 9, 2026
2 checks passed
RhysSullivan added a commit that referenced this pull request May 31, 2026
## Summary
- Add MCP server endpoint at `/mcp` on the cloud app with WorkOS OAuth authentication (JWT verification via AuthKit JWKS at `signin.executor.sh`)
- OAuth discovery via `/.well-known/oauth-protected-resource` and `/.well-known/oauth-authorization-server` endpoints
- Durable Object sessions (`McpSessionDO`) to persist client capabilities and support pause/resume for clients without elicitation
- Custom server entrypoint (`src/server.ts`) for DO class export with TanStack Start
- Workers-compatible JSON Schema validator replacing Ajv (which uses `new Function()`)
- Fix static `cloudflare:workers` import causing SSR 500s → dynamic imports
- MCP install card only shows HTTP transport option on cloud app

## Test plan
- [x] OAuth flow works — Claude Code authenticates via AuthKit
- [x] `execute` tool visible (elicitation-capable clients hide `resume`)
- [x] Code execution works end-to-end through MCP
- [x] Well-known endpoints return correct metadata
- [x] Unauthenticated requests get 401 with `WWW-Authenticate` header
@RhysSullivan
RhysSullivan deleted the feat/cloud-mcp-server branch June 11, 2026 08:01
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