You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.MD
+6-10Lines changed: 6 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# MCP C# SDK
2
2
3
-
The official C# SDK for the [Model Context Protocol](https://modelcontextprotocol.io/), enabling .NET applications to connect to and interact with MCP clients and servers.
3
+
The official C# SDK for the [Model Context Protocol](https://modelcontextprotocol.io/), enabling .NET applications, services, and libraries to implement and interact with MCP clients and servers.
4
4
5
5
> [!NOTE]
6
6
> This repo is still in preview, breaking changes can be introduced without prior notice.
@@ -16,7 +16,9 @@ For more information about MCP:
16
16
17
17
## Getting Started (Client)
18
18
19
-
Then create a client and start using tools, or other capabilities, from the servers you configure:
19
+
To get started writing a client, the `McpClientFactory.CreateAsync` method is used to instantiate and connect an `IMcpClient`
20
+
to a server, with details about the client and server specified in `McpClientOptions` and `McpServerConfig` objects.
21
+
Once you have an `IMcpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
20
22
```csharp
21
23
McpClientOptionsoptions=new()
22
24
{
@@ -53,15 +55,9 @@ var result = await client.CallToolAsync(
Note that you should pass CancellationToken objects suitable for your use case, to enable proper error handling, timeouts, etc. This example also does not paginate the tools list, which may be necessary for large tool sets. See the IntegrationTests project for an example of pagination, as well as examples of how to handle Prompts and Resources.
58
+
You can find samples demonstrating how to use ModelContextProtocol with an LLM SDK in the [samples](samples) directory, and also refer to the [IntegrationTests](test/ModelContextProtocol.IntegrationTests) project for more examples. Additional examples and documentation will be added as in the near future.
57
59
58
-
It is also highly recommended that you pass a proper LoggerFactory instance to the factory constructor, to enable logging of MCP client operations.
59
-
60
-
You can find samples demonstrating how to use ModelContextProtocol with an LLM SDK in the [samples](samples) directory, and also refer to the [IntegrationTests](test/ModelContextProtocol.IntegrationTests) project for more examples.
61
-
62
-
Additional examples and documentation will be added as in the near future.
63
-
64
-
Remember you can connect to any MCP server, not just ones created using ModelContextProtocol. The protocol is designed to be server-agnostic, so you can use this library to connect to any compliant server.
60
+
Clients can connect to any MCP server, not just ones created using this library. The protocol is designed to be server-agnostic, so you can use this library to connect to any compliant server.
65
61
66
62
Tools can be exposed easily as `AIFunction` instances so that they are immediately usable with `IChatClient`s.
0 commit comments