Skip to content

Commit 9a9ba5b

Browse files
Update code samples.
1 parent 7a1279e commit 9a9ba5b

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,15 @@ To get started writing a client, the `McpClientFactory.CreateAsync` method is us
3131
to a server. Once you have an `IMcpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
3232

3333
```csharp
34-
var client = await McpClientFactory.CreateAsync(new()
34+
var clientTransport = new StdioClientTransport(new()
3535
{
36-
Id = "everything",
3736
Name = "Everything",
38-
TransportType = TransportTypes.StdIo,
39-
TransportOptions = new()
40-
{
41-
["command"] = "npx",
42-
["arguments"] = "-y @modelcontextprotocol/server-everything",
43-
}
37+
Command = "npx",
38+
Arguments = ["-y", "@modelcontextprotocol/server-everything"],
4439
});
4540

41+
var client = await McpClientFactory.CreateAsync(clientTransport);
42+
4643
// Print the list of tools available from the server.
4744
foreach (var tool in await client.ListToolsAsync())
4845
{

samples/QuickstartClient/Program.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313

1414
var (command, arguments) = GetCommandAndArguments(args);
1515

16-
await using var mcpClient = await McpClientFactory.CreateAsync(new StdioClientTransport(new()
16+
var clientTransport = new StdioClientTransport(new()
1717
{
18+
Name = "Demo Server",
1819
Command = command,
1920
Arguments = arguments,
20-
Name = "Demo Server",
21-
}));
21+
});
22+
23+
await using var mcpClient = await McpClientFactory.CreateAsync(clientTransport);
2224

2325
var tools = await mcpClient.ListToolsAsync();
2426
foreach (var tool in tools)

0 commit comments

Comments
 (0)