Restructure IMcpEndpoint, IMcpClient, and IMcpServer (#723)
* Remove `McpEndpoint` & `IMcpClient` * Revise naming, add abstract classes * Fix missing renames * Move extension methods to instance methods * Add back old API, but obsoleted * Add back obsoleted factory classes * Move deprecation attributes * `SseClientTransport` -> `HttpClientTransport` * Update src/ModelContextProtocol.Core/Server/AugmentedServiceProvider.cs Co-authored-by: Stephen Halter <halter73@gmail.com> * PR feedback * PR feedback * Add back dispose lock * Fix docs projects * PR feedback * Undo `docs/*.md` changes --------- Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
parent
fe2ce2bc60
commit
38b4a26998
1 changed files with 5169 additions and 3786 deletions
|
|
@ -27,8 +27,8 @@ dotnet add package ModelContextProtocol.Core --prerelease
|
|||
|
||||
## Getting Started (Client)
|
||||
|
||||
To get started writing a client, the `McpClientFactory.CreateAsync` method is used to instantiate and connect an `IMcpClient`
|
||||
to a server. Once you have an `IMcpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
|
||||
To get started writing a client, the `McpClient.CreateAsync` method is used to instantiate and connect an `McpClient`
|
||||
to a server. Once you have an `McpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
|
||||
|
||||
```csharp
|
||||
var clientTransport = new StdioClientTransport(new StdioClientTransportOptions
|
||||
|
|
@ -38,7 +38,7 @@ var clientTransport = new StdioClientTransport(new StdioClientTransportOptions
|
|||
Arguments = ["-y", "@modelcontextprotocol/server-everything"],
|
||||
});
|
||||
|
||||
var client = await McpClientFactory.CreateAsync(clientTransport);
|
||||
var client = await McpClient.CreateAsync(clientTransport);
|
||||
|
||||
// Print the list of tools available from the server.
|
||||
foreach (var tool in await client.ListToolsAsync())
|
||||
|
|
|
|||
Loading…
Reference in a new issue