Skip to content

Extract the authorization-server routes into their own module#472

Merged
alistair3149 merged 1 commit into
masterfrom
extract-as-router
Jul 23, 2026
Merged

Extract the authorization-server routes into their own module#472
alistair3149 merged 1 commit into
masterfrom
extract-as-router

Conversation

@alistair3149

@alistair3149 alistair3149 commented Jul 23, 2026

Copy link
Copy Markdown
Member

Moves the seven hosted-OAuth-proxy endpoints — RFC 8414 AS metadata (×2), RFC 7591 registration, and the authorize / consent / oauth/callback / token flow — plus their helpers (errorReason, readAuthorizeQuery, serializeAuthorizeQuery, redirectHostOf, setTxnCookie, resolveClient) out of the transport's buildApp and into a new mountAuthorizationServer() in src/auth/authorizationServer/router.ts, where the rest of the AS code already lives (per AGENTS.md). buildApp now calls it with a small deps object.

streamableHttp.ts: 1331 → 977 lines. The AS surface is now one 391-line module instead of ~275 lines interleaved with the MCP transport wiring.

Behaviour

Verbatim move — every route body and its per-endpoint 404 guard is unchanged, so behaviour is identical. The end-to-end proxy suite drives every moved route (register → authorize → consent → callback → token, plus AS metadata), and it stays green.

Testing

Full gate green: fmt:check, lint, tsc, and the whole suite (incl. the e2e proxy flow). Pure-internal refactor, so no CHANGELOG/README change per AGENTS.md.

🤖 Generated with Claude Code

Move the seven hosted-OAuth-proxy endpoints (RFC 8414 AS metadata x2, RFC 7591
register, and the authorize/consent/callback/token flow) plus their helpers
(errorReason, readAuthorizeQuery, serializeAuthorizeQuery, redirectHostOf,
setTxnCookie, resolveClient) out of the transport's buildApp into a new
mountAuthorizationServer() under src/auth/authorizationServer/, where the rest of
the AS code lives (per AGENTS.md). buildApp now calls it with a small deps object.

Verbatim move — routes and their per-endpoint 404 guards are unchanged, so
behaviour is preserved; the end-to-end proxy suite drives every moved route.
streamableHttp.ts drops from 1331 to ~1000 lines.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alistair3149
alistair3149 marked this pull request as ready for review July 23, 2026 13:29
@alistair3149
alistair3149 merged commit f916b01 into master Jul 23, 2026
1 check passed
@alistair3149
alistair3149 deleted the extract-as-router branch July 23, 2026 13:29
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