Make client config optional to McpClientFactory.CreateAsync (#65)

* Make client config optional to McpClientFactory.CreateAsync

Unless you're specifying capabilities (sampling/rooting) or need a specific client name/version, the client information can be inferred from the assembly, simplifying the getting-started experience.

* Cache default options

* Update src/ModelContextProtocol/Client/McpClientFactory.cs

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>

---------

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
This commit is contained in:
Stephen Toub 2025-03-24 11:01:13 -04:00 • committed by GitHub
commit 729e688b25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,8 +15,7 @@ var mcpClient = await McpClientFactory.CreateAsync(
{
["command"] = "npx", ["arguments"] = "-y @modelcontextprotocol/server-everything",
}
},
new() { ClientInfo = new() { Name = "ChatClient", Version = "1.0.0" } });
});
// Get all available tools
Console.WriteLine("Tools available:");