From d4e767d11e02a524851724c1c3c4479096d7d6c3 Mon Sep 17 00:00:00 2001 From: markwallace-microsoft <127216156+markwallace-microsoft@users.noreply.github.com> Date: Thu, 3 Apr 2025 14:16:14 +0100 Subject: [PATCH] Some changes to add clarity and align with the Blog Post --- .../Demos/ModelContextProtocolPlugin/Program.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dotnet/samples/Demos/ModelContextProtocolPlugin/Program.cs b/dotnet/samples/Demos/ModelContextProtocolPlugin/Program.cs index c6c53704aa17..989df9856be6 100644 --- a/dotnet/samples/Demos/ModelContextProtocolPlugin/Program.cs +++ b/dotnet/samples/Demos/ModelContextProtocolPlugin/Program.cs @@ -5,7 +5,9 @@ using Microsoft.Extensions.Logging; using Microsoft.SemanticKernel; using Microsoft.SemanticKernel.Connectors.OpenAI; +using ModelContextProtocol; using ModelContextProtocol.Client; +using ModelContextProtocol.Protocol.Types; var config = new ConfigurationBuilder() .AddUserSecrets() @@ -20,7 +22,7 @@ // Create an MCPClient for the GitHub server await using var mcpClient = await McpClientFactory.CreateAsync( - new() + new McpServerConfig() { Id = "github", Name = "GitHub", @@ -31,7 +33,14 @@ ["arguments"] = "-y @modelcontextprotocol/server-github", } }, - new() { ClientInfo = new() { Name = "GitHub", Version = "1.0.0" } }).ConfigureAwait(false); + new McpClientOptions() + { + ClientInfo = new Implementation() + { + Name = "GitHub", + Version = "1.0.0" + } + }).ConfigureAwait(false); // Retrieve the list of tools available on the GitHub server var tools = await mcpClient.ListToolsAsync().ConfigureAwait(false); @@ -45,7 +54,6 @@ builder.Services .AddLogging(c => c.AddDebug().SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace)) .AddOpenAIChatCompletion( - serviceId: "openai", modelId: config["OpenAI:ChatModelId"] ?? "gpt-4o-mini", apiKey: apiKey); Kernel kernel = builder.Build();