File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,15 @@ async function handleMcpPost (
150150 req . headers . accept = 'application/json, text/event-stream'
151151 }
152152
153- // Extract auth from headers
153+ // Extract auth from headers and set on request for transport
154154 const token = extractAuthToken ( req )
155+ if ( token ) {
156+ ; ( req as any ) . auth = {
157+ token,
158+ clientId : '' ,
159+ scopes : [ ] ,
160+ }
161+ }
155162
156163 // Create fresh transport for this request (stateless mode)
157164 const transport = new StreamableHTTPServerTransport ( {
@@ -164,13 +171,6 @@ async function handleMcpPost (
164171 // Connect server to transport
165172 await server . connect ( transport )
166173
167- // Inject auth info if present
168- if ( token ) {
169- // The transport needs to know about the auth for tool handlers
170- // We pass it via a custom header that handleRequest will pick up
171- ; ( req as any ) . _mcpAuthToken = token
172- }
173-
174174 // Set up cleanup on close
175175 transport . onclose = ( ) => {
176176 server . close ( ) . catch ( error => console . error ( 'Error closing server:' , error ) )
You can’t perform that action at this time.
0 commit comments