@@ -3,7 +3,7 @@ import { randomUUID } from 'node:crypto';
33import { z } from 'zod' ;
44import { McpServer } from '../../server/mcp.js' ;
55import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js' ;
6- import { mcpAuthRouter , mcpProtectedResourceRouter , getOAuthProtectedResourceMetadataUrl } from '../../server/auth/router.js' ;
6+ import { mcpAuthRouter , getOAuthProtectedResourceMetadataUrl } from '../../server/auth/router.js' ;
77import { requireBearerAuth } from '../../server/auth/middleware/bearerAuth.js' ;
88import { CallToolResult , GetPromptResult , isInitializeRequest , ReadResourceResult } from '../../types.js' ;
99import { InMemoryEventStore } from '../shared/inMemoryEventStore.js' ;
@@ -188,7 +188,6 @@ if (useOAuth) {
188188 authApp . use ( mcpAuthRouter ( {
189189 provider,
190190 issuerUrl : authServerUrl ,
191- baseUrl : authServerUrl ,
192191 scopesSupported : [ 'mcp:tools' ] ,
193192 // This endpoint is set up on the Authorization server, but really shouldn't be.
194193 protectedResourceOptions : {
@@ -202,12 +201,15 @@ if (useOAuth) {
202201 console . log ( `OAuth Authorization Server listening on port ${ AUTH_PORT } ` ) ;
203202 } ) ;
204203
205- // Add protected resource metadata to the main MCP server
206- app . use ( mcpProtectedResourceRouter ( {
204+ // Add both resource metadata and oauth server metadata (for backwards compatiblity) to the main MCP server
205+ app . use ( mcpAuthRouter ( {
206+ provider,
207207 issuerUrl : authServerUrl ,
208- serverUrl : mcpServerUrl ,
209208 scopesSupported : [ 'mcp:tools' ] ,
210- resourceName : 'MCP Demo Server' ,
209+ protectedResourceOptions : {
210+ serverUrl : mcpServerUrl ,
211+ resourceName : 'MCP Demo Server' ,
212+ } ,
211213 } ) ) ;
212214
213215 authMiddleware = requireBearerAuth ( {
0 commit comments