File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131 Name = "Secure Weather Client" ,
3232 OAuth = new ( )
3333 {
34- ClientId = "demo-client" ,
35- ClientSecret = "demo-secret" ,
34+ ClientName = "ProtectedMcpClient" ,
3635 RedirectUri = new Uri ( "http://localhost:1179/callback" ) ,
3736 AuthorizationRedirectDelegate = HandleAuthorizationUrlAsync ,
3837 }
5049Console . WriteLine ( $ "Found { tools . Count } tools on the server.") ;
5150Console . WriteLine ( ) ;
5251
53- if ( tools . Any ( t => t . Name == "GetAlerts " ) )
52+ if ( tools . Any ( t => t . Name == "get_alerts " ) )
5453{
55- Console . WriteLine ( "Calling GetAlerts tool..." ) ;
54+ Console . WriteLine ( "Calling get_alerts tool..." ) ;
5655
5756 var result = await client . CallToolAsync (
58- "GetAlerts " ,
57+ "get_alerts " ,
5958 new Dictionary < string , object ? > { { "state" , "WA" } }
6059 ) ;
6160
Original file line number Diff line number Diff line change 11using Microsoft . AspNetCore . Authentication . JwtBearer ;
22using Microsoft . IdentityModel . Tokens ;
33using ModelContextProtocol . AspNetCore . Authentication ;
4- using ModelContextProtocol . Authentication ;
54using ProtectedMCPServer . Tools ;
65using System . Net . Http . Headers ;
76using System . Security . Claims ;
109
1110var serverUrl = "http://localhost:7071/" ;
1211var inMemoryOAuthServerUrl = "https://localhost:7029" ;
13- var demoClientId = "demo-client" ;
1412
1513builder . Services . AddAuthentication ( options =>
1614{
9088Console . WriteLine ( $ "Starting MCP server with authorization at { serverUrl } ") ;
9189Console . WriteLine ( $ "Using in-memory OAuth server at { inMemoryOAuthServerUrl } ") ;
9290Console . WriteLine ( $ "Protected Resource Metadata URL: { serverUrl } .well-known/oauth-protected-resource") ;
93- Console . WriteLine ( $ "Demo Client ID: { demoClientId } ") ;
9491Console . WriteLine ( "Press Ctrl+C to stop the server" ) ;
9592
9693app . Run ( serverUrl ) ;
You can’t perform that action at this time.
0 commit comments