Skip to content

Commit cbb5c36

Browse files
committed
Working client-server interaction
1 parent 6768089 commit cbb5c36

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

samples/ProtectedMCPClient/BasicOAuthAuthorizationProvider.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
namespace 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

samples/ProtectedMCPClient/Program.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)