1- using Microsoft . AspNetCore . Builder ;
21using ModelContextProtocol ;
32using ModelContextProtocol . AspNetCore ;
43using ModelContextProtocol . Protocol . Auth ;
54using ModelContextProtocol . Protocol . Types ;
65using ModelContextProtocol . Server . Auth ;
7- using System . Text . Json ;
86
97namespace AuthorizationServerExample ;
108
@@ -25,7 +23,7 @@ public static async Task Main(string[] args)
2523 // This is the information that will be provided to clients when they need to authenticate
2624 var prm = new ProtectedResourceMetadata
2725 {
28- Resource = "https ://localhost:7071" , // The resource identifier (typically your server's base URL)
26+ Resource = "http ://localhost:7071" , // Changed from HTTPS to HTTP for local development
2927 AuthorizationServers = [ "https://auth.example.com" ] , // Auth servers that can issue tokens for this resource
3028 BearerMethodsSupported = [ "header" ] , // We support the Authorization header
3129 ScopesSupported = [ "mcp.tools" , "mcp.prompts" , "mcp.resources" ] , // Scopes supported by this resource
@@ -122,10 +120,11 @@ async Task<bool> ValidateToken(string token)
122120 app . MapMcp ( ) ;
123121
124122 // Configure the server URL
125- app . Urls . Add ( "https://localhost:7071" ) ;
123+ app . Urls . Add ( "http://localhost:7071" ) ;
124+
125+ Console . WriteLine ( "Starting MCP server with authorization at http://localhost:7071" ) ;
126+ Console . WriteLine ( "PRM Document URL: http://localhost:7071/.well-known/oauth-protected-resource" ) ;
126127
127- Console . WriteLine ( "Starting MCP server with authorization at https://localhost:7071" ) ;
128- Console . WriteLine ( "PRM Document URL: https://localhost:7071/.well-known/oauth-protected-resource" ) ;
129128 Console . WriteLine ( ) ;
130129 Console . WriteLine ( "To test the server:" ) ;
131130 Console . WriteLine ( "1. Use an MCP client that supports authorization" ) ;
0 commit comments