Add a supported auth hook instead of wrapping fetch and listen
Author: aiden-laneCreated Sep 28, 2026Updated Sep 28, 2026
Labelsserver
We maintain @getonlane/mcp-auth, an OAuth resource-server adapter for mcp-use servers (mcp-use 2.5.2).
What we do today: to admit or refuse a request before mcp-use handles it, the adapter overwrites server.fetch (declared readonly in the .d.ts) and replaces server.listen, then re-implements the checks listen performs. Any minor release can break this.
What we need: a supported auth extension point, for example:
oauth.admit(request: Request, messages: JSONRPCMessage[]) => Promise<Response | {bearer: string; authInfo: AuthInfo}>plus listen() serving whatever handler is installed, so an adapter never has to replace public members.
Why: so auth adapters can support a wide mcp-use version range without depending on internals.
We are happy to send a PR.
Source: mcp-use/mcp-use