Remove McpServerConfig and have McpClientFactory accept IClientTransport instances directly. (#230)
* Remove McpServerConfig and have McpClientFactory accept IClientTransport instances directly. * Address feedback and use lists when representing stdio arguments. * Use "Name" for transport descriptors and "EndpointName" for MCP clients and servers. * Update code samples. * Fix source file naming
This commit is contained in:
parent
8bd9ee81c0
commit
3e21f3594a
1 changed files with 315 additions and 527 deletions
13
README.md
13
README.md
|
|
@ -31,18 +31,15 @@ To get started writing a client, the `McpClientFactory.CreateAsync` method is us
|
|||
to a server. Once you have an `IMcpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
|
||||
|
||||
```csharp
|
||||
var client = await McpClientFactory.CreateAsync(new()
|
||||
var clientTransport = new StdioClientTransport(new()
|
||||
{
|
||||
Id = "everything",
|
||||
Name = "Everything",
|
||||
TransportType = TransportTypes.StdIo,
|
||||
TransportOptions = new()
|
||||
{
|
||||
["command"] = "npx",
|
||||
["arguments"] = "-y @modelcontextprotocol/server-everything",
|
||||
}
|
||||
Command = "npx",
|
||||
Arguments = ["-y", "@modelcontextprotocol/server-everything"],
|
||||
});
|
||||
|
||||
var client = await McpClientFactory.CreateAsync(clientTransport);
|
||||
|
||||
// Print the list of tools available from the server.
|
||||
foreach (var tool in await client.ListToolsAsync())
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue