File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
samples/ProtectedMCPClient Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1010namespace ProtectedMCPClient ;
1111
1212/// <summary>
13- /// A simple implementation of an OAuth authorization provider for MCP.
13+ /// A simple implementation of an OAuth authorization provider for MCP. This does not do any token
14+ /// caching or any advanced token protection - it acquires a token and server metadata and holds it
15+ /// in memory as-is. This is NOT PRODUCTION READY and MUST NOT BE USED IN PRODUCTION.
1416/// </summary>
1517/// <remarks>
1618/// Initializes a new instance of the <see cref="BasicOAuthAuthorizationProvider"/> class.
@@ -30,6 +32,7 @@ public class BasicOAuthAuthorizationProvider(
3032
3133 // Single token storage
3234 private TokenContainer ? _token ;
35+
3336 // Store auth server metadata separately so token only stores token data
3437 private AuthorizationServerMetadata ? _authServerMetadata ;
3538
Original file line number Diff line number Diff line change @@ -52,10 +52,14 @@ static async Task Main(string[] args)
5252 Console . WriteLine ( $ "Found { tools . Count } tools on the server.") ;
5353 Console . WriteLine ( ) ;
5454
55- if ( tools . Any ( t => t . Name == "protected-data " ) )
55+ if ( tools . Any ( t => t . Name == "GetAlerts " ) )
5656 {
57- Console . WriteLine ( "Calling protected-data tool..." ) ;
58- var result = await client . CallToolAsync ( "protected-data" ) ;
57+ Console . WriteLine ( "Calling GetAlerts tool..." ) ;
58+ // Update the dictionary to match the expected type IReadOnlyDictionary<string, object?>?
59+ var result = await client . CallToolAsync (
60+ "GetAlerts" ,
61+ new Dictionary < string , object ? > { { "state" , "WA" } }
62+ ) ;
5963 Console . WriteLine ( "Result: " + result . Content [ 0 ] . Text ) ;
6064 Console . WriteLine ( ) ;
6165 }
You can’t perform that action at this time.
0 commit comments