Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<ItemGroup>
<PackageReference Include="Azure.AI.OpenAI" Version="2.2.0-beta.5" />
<PackageReference Include="Azure.Identity" Version="1.17.1" />
<PackageReference Include="Microsoft.Extensions.AI" Version="10.2.0" />
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.4.3-preview.1.25230.7" />
<PackageReference Include="ModelContextProtocol" Version="0.1.0-preview.14" />
<PackageReference Include="Microsoft.Extensions.AI" Version="10.3.0" />
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="10.3.0" />
<PackageReference Include="ModelContextProtocol" Version="1.0.0" />
</ItemGroup>

</Project>
18 changes: 10 additions & 8 deletions docs/ai/quickstarts/snippets/mcp-client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Azure.Identity;
using Microsoft.Extensions.AI;
using ModelContextProtocol.Client;
using ModelContextProtocol.Protocol;

// Create an IChatClient using Azure OpenAI.
IChatClient client =
Expand All @@ -12,15 +13,16 @@
.UseFunctionInvocation()
.Build();

// Create the MCP client
// Create the MCP client.
// Configure it to start and connect to your MCP server.
IMcpClient mcpClient = await McpClientFactory.CreateAsync(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexwolfmsft McpClientFactory API was removed in the latest MCP package. Does this modification look correct?

new StdioClientTransport(new()
{
Command = "dotnet run",
Arguments = ["--project", "<path-to-your-mcp-server-project>"],
Name = "Minimal MCP Server",
}));
var transport = new StdioClientTransport(new()
{
Command = "dotnet run",
Arguments = ["--project", "<path-to-your-mcp-server-project>"],
Name = "Minimal MCP Server",
});
ITransport connectedTransport = await transport.ConnectAsync();
McpClient mcpClient = (McpClient)connectedTransport;

// List all available tools from the MCP server.
Console.WriteLine("Available tools:");
Expand Down