@@ -3,7 +3,7 @@ import { randomUUID } from 'node:crypto';
3
3
import { z } from 'zod' ;
4
4
import { McpServer } from '../../server/mcp.js' ;
5
5
import { StreamableHTTPServerTransport } from '../../server/streamableHttp.js' ;
6
- import { mcpAuthRouter , mcpProtectedResourceRouter , getOAuthProtectedResourceMetadataUrl } from '../../server/auth/router.js' ;
6
+ import { mcpAuthRouter , getOAuthProtectedResourceMetadataUrl } from '../../server/auth/router.js' ;
7
7
import { requireBearerAuth } from '../../server/auth/middleware/bearerAuth.js' ;
8
8
import { CallToolResult , GetPromptResult , isInitializeRequest , ReadResourceResult } from '../../types.js' ;
9
9
import { InMemoryEventStore } from '../shared/inMemoryEventStore.js' ;
@@ -188,7 +188,6 @@ if (useOAuth) {
188
188
authApp . use ( mcpAuthRouter ( {
189
189
provider,
190
190
issuerUrl : authServerUrl ,
191
- baseUrl : authServerUrl ,
192
191
scopesSupported : [ 'mcp:tools' ] ,
193
192
// This endpoint is set up on the Authorization server, but really shouldn't be.
194
193
protectedResourceOptions : {
@@ -202,12 +201,15 @@ if (useOAuth) {
202
201
console . log ( `OAuth Authorization Server listening on port ${ AUTH_PORT } ` ) ;
203
202
} ) ;
204
203
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,
207
207
issuerUrl : authServerUrl ,
208
- serverUrl : mcpServerUrl ,
209
208
scopesSupported : [ 'mcp:tools' ] ,
210
- resourceName : 'MCP Demo Server' ,
209
+ protectedResourceOptions : {
210
+ serverUrl : mcpServerUrl ,
211
+ resourceName : 'MCP Demo Server' ,
212
+ } ,
211
213
} ) ) ;
212
214
213
215
authMiddleware = requireBearerAuth ( {
0 commit comments