Skip to content

Add a markdown link checker #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/markdown-link-check.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 7 additions & 3 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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",
Expand All @@ -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.
Expand All @@ -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<AIFunction> tools = await client.GetAIFunctionsAsync();
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 8 additions & 4 deletions src/ModelContextProtocol/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ 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)

## 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",
Expand All @@ -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.
Expand All @@ -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<AIFunction> tools = await client.GetAIFunctionsAsync();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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).