diff --git a/.github/workflows/markdown-link-check.yml b/.github/workflows/markdown-link-check.yml new file mode 100644 index 000000000..d3fdfeaf9 --- /dev/null +++ b/.github/workflows/markdown-link-check.yml @@ -0,0 +1,16 @@ +name: Check Markdown links + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + markdown-link-check: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@main + - name: Markup Link Checker (mlc) + uses: becheran/mlc@v0.15.4 \ No newline at end of file diff --git a/README.MD b/README.MD index 40d53841f..13e0e1b96 100644 --- a/README.MD +++ b/README.MD @@ -10,6 +10,7 @@ The official C# SDK for the [Model Context Protocol](https://modelcontextprotoco The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). It enables secure integration between LLMs and various data sources and tools. For more information about MCP: + - [Official Documentation](https://modelcontextprotocol.io/) - [Protocol Specification](https://spec.modelcontextprotocol.io/) - [GitHub Organization](https://github.com/modelcontextprotocol) @@ -19,12 +20,13 @@ For more information about MCP: To get started writing a client, the `McpClientFactory.CreateAsync` method is used to instantiate and connect an `IMcpClient` to a server, with details about the client and server specified in `McpClientOptions` and `McpServerConfig` objects. Once you have an `IMcpClient`, you can interact with it, such as to enumerate all available tools and invoke tools. + ```csharp McpClientOptions options = new() { ClientInfo = new() { Name = "TestClient", Version = "1.0.0" } }; - + McpServerConfig config = new() { Id = "everything", @@ -36,7 +38,7 @@ McpServerConfig config = new() ["arguments"] = "-y @modelcontextprotocol/server-everything", } }; - + var client = await McpClientFactory.CreateAsync(config, options); // Print the list of tools available from the server. @@ -55,11 +57,12 @@ var result = await client.CallToolAsync( Console.WriteLine(result.Content.First(c => c.Type == "text").Text); ``` -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. +You can find samples demonstrating how to use ModelContextProtocol with an LLM SDK in the [samples](samples) directory, and also refer to the [tests](tests/ModelContextProtocol.Tests) project for more examples. Additional examples and documentation will be added as in the near future. 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. Tools can be exposed easily as `AIFunction` instances so that they are immediately usable with `IChatClient`s. + ```csharp // Get available functions. IList tools = await client.GetAIFunctionsAsync(); @@ -103,6 +106,7 @@ public static class EchoTool ``` More control is also available, with fine-grained control over configuring the server and how it should handle client requests. For example: + ```csharp using ModelContextProtocol.Protocol.Transport; using ModelContextProtocol.Protocol.Types; diff --git a/src/ModelContextProtocol/README.md b/src/ModelContextProtocol/README.md index b2205768b..a109addce 100644 --- a/src/ModelContextProtocol/README.md +++ b/src/ModelContextProtocol/README.md @@ -10,6 +10,7 @@ The official C# SDK for the [Model Context Protocol](https://modelcontextprotoco The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). It enables secure integration between LLMs and various data sources and tools. For more information about MCP: + - [Official Documentation](https://modelcontextprotocol.io/) - [Protocol Specification](https://spec.modelcontextprotocol.io/) - [GitHub Organization](https://github.com/modelcontextprotocol) @@ -17,12 +18,13 @@ For more information about MCP: ## Getting Started (Client) Then create a client and start using tools, or other capabilities, from the servers you configure: + ```csharp McpClientOptions options = new() { ClientInfo = new() { Name = "TestClient", Version = "1.0.0" } }; - + McpServerConfig config = new() { Id = "everything", @@ -34,7 +36,7 @@ McpServerConfig config = new() ["arguments"] = "-y @modelcontextprotocol/server-everything", } }; - + var client = await McpClientFactory.CreateAsync(config, options); // Print the list of tools available from the server. @@ -57,13 +59,14 @@ Note that you should pass CancellationToken objects suitable for your use case, It is also highly recommended that you pass a proper LoggerFactory instance to the factory constructor, to enable logging of MCP client operations. -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. +You can find samples demonstrating how to use ModelContextProtocol with an LLM SDK in the [samples](https://github.com/modelcontextprotocol/csharp-sdk/tree/main/samples) directory, and also refer to the [tests](https://github.com/modelcontextprotocol/csharp-sdk/tree/main/tests/ModelContextProtocol.Tests) project for more examples. Additional examples and documentation will be added as in the near future. 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. Tools can be exposed easily as `AIFunction` instances so that they are immediately usable with `IChatClient`s. + ```csharp // Get available functions. IList tools = await client.GetAIFunctionsAsync(); @@ -107,6 +110,7 @@ public static class EchoTool ``` More control is also available, with fine-grained control over configuring the server and how it should handle client requests. For example: + ```csharp using ModelContextProtocol.Protocol.Transport; using ModelContextProtocol.Protocol.Types; @@ -174,4 +178,4 @@ await Task.Delay(Timeout.Infinite); ## License -This project is licensed under the [MIT License](LICENSE). +This project is licensed under the [MIT License](https://github.com/modelcontextprotocol/csharp-sdk/blob/main/LICENSE).