Skip to content

Commit 9382bb5

Browse files
Copilotjeffhandley
andcommitted
Simplify package READMEs per PR #1387 pattern
Remove inline code samples from all three package READMEs and link to the Getting Started documentation page instead. Change "our" to "the" for API documentation references. Tighten package descriptions. Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
1 parent 692a006 commit 9382bb5

File tree

3 files changed

+26
-205
lines changed

3 files changed

+26
-205
lines changed

src/ModelContextProtocol.AspNetCore/README.md

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,24 @@
22

33
[![NuGet version](https://img.shields.io/nuget/v/ModelContextProtocol.AspNetCore.svg)](https://www.nuget.org/packages/ModelContextProtocol.AspNetCore)
44

5-
ASP.NET Core extensions for 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. Please visit our [API documentation](https://modelcontextprotocol.github.io/csharp-sdk/api/ModelContextProtocol.html) for more details on available functionality.
6-
7-
## About MCP
8-
9-
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.
10-
11-
For more information about MCP:
12-
13-
- [Official Documentation](https://modelcontextprotocol.io/)
14-
- [Protocol Specification](https://modelcontextprotocol.io/specification/)
15-
- [GitHub Organization](https://github.com/modelcontextprotocol)
5+
ASP.NET Core extensions for the official C# SDK for the [Model Context Protocol](https://modelcontextprotocol.io/), providing HTTP-based MCP server support. References `ModelContextProtocol`. Please visit the [API documentation](https://modelcontextprotocol.github.io/csharp-sdk/api/ModelContextProtocol.html) for more details on available functionality.
166

177
## Installation
188

19-
To get started, install the package from NuGet
20-
219
```
22-
dotnet new web
2310
dotnet add package ModelContextProtocol.AspNetCore
2411
```
2512

2613
## Getting Started
2714

28-
```csharp
29-
// Program.cs
30-
using ModelContextProtocol.Server;
31-
using System.ComponentModel;
15+
To get started, see the [Getting Started](https://modelcontextprotocol.github.io/csharp-sdk/concepts/getting-started.html) guide for installation instructions, package-selection guidance, and complete examples for both clients and servers.
3216

33-
var builder = WebApplication.CreateBuilder(args);
34-
builder.Services.AddMcpServer()
35-
.WithHttpTransport()
36-
.WithToolsFromAssembly();
37-
var app = builder.Build();
17+
## About MCP
3818

39-
app.MapMcp();
19+
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.
4020

41-
app.Run("http://localhost:3001");
21+
For more information about MCP:
4222

43-
[McpServerToolType]
44-
public static class EchoTool
45-
{
46-
[McpServerTool, Description("Echoes the message back to the client.")]
47-
public static string Echo(string message) => $"hello {message}";
48-
}
49-
```
23+
- [Official Documentation](https://modelcontextprotocol.io/)
24+
- [Protocol Specification](https://modelcontextprotocol.io/specification/)
25+
- [GitHub Organization](https://github.com/modelcontextprotocol)

src/ModelContextProtocol.Core/README.md

Lines changed: 9 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,96 +2,24 @@
22

33
[![NuGet version](https://img.shields.io/nuget/v/ModelContextProtocol.Core.svg)](https://www.nuget.org/packages/ModelContextProtocol.Core)
44

5-
Core .NET SDK for the [Model Context Protocol](https://modelcontextprotocol.io/), enabling .NET applications, services, and libraries to implement and interact with MCP clients and servers. Please visit our [API documentation](https://modelcontextprotocol.github.io/csharp-sdk/api/ModelContextProtocol.html) for more details on available functionality.
6-
7-
## About MCP
8-
9-
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.
10-
11-
For more information about MCP:
12-
13-
- [Official Documentation](https://modelcontextprotocol.io/)
14-
- [Protocol Specification](https://modelcontextprotocol.io/specification/)
15-
- [GitHub Organization](https://github.com/modelcontextprotocol)
5+
Core .NET SDK for the [Model Context Protocol](https://modelcontextprotocol.io/), providing client and low-level server APIs with minimal dependencies. Please visit the [API documentation](https://modelcontextprotocol.github.io/csharp-sdk/api/ModelContextProtocol.html) for more details on available functionality.
166

177
## Installation
188

19-
To get started, install the core package from NuGet
20-
219
```
2210
dotnet add package ModelContextProtocol.Core
2311
```
2412

25-
## Getting Started (Client)
26-
27-
To get started writing a client, the `McpClient.CreateAsync` method is used to instantiate and connect an `McpClient`
28-
to a server. Once you have an `McpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
13+
## Getting Started
2914

30-
```csharp
31-
var clientTransport = new StdioClientTransport(new StdioClientTransportOptions
32-
{
33-
Name = "Everything",
34-
Command = "npx",
35-
Arguments = ["-y", "@modelcontextprotocol/server-everything"],
36-
});
15+
To get started, see the [Getting Started](https://modelcontextprotocol.github.io/csharp-sdk/concepts/getting-started.html) guide for installation instructions, package-selection guidance, and complete examples for both clients and servers.
3716

38-
var client = await McpClient.CreateAsync(clientTransport);
39-
40-
// Print the list of tools available from the server.
41-
foreach (var tool in await client.ListToolsAsync())
42-
{
43-
Console.WriteLine($"{tool.Name} ({tool.Description})");
44-
}
45-
46-
// Execute a tool (this would normally be driven by LLM tool invocations).
47-
var result = await client.CallToolAsync(
48-
"echo",
49-
new Dictionary<string, object?>() { ["message"] = "Hello MCP!" },
50-
cancellationToken: CancellationToken.None);
51-
52-
// echo always returns one and only one text content object
53-
Console.WriteLine(result.Content.OfType<TextContentBlock>().First().Text);
54-
```
55-
56-
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.
57-
58-
Tools can be easily exposed for immediate use by `IChatClient`s, because `McpClientTool` inherits from `AIFunction`.
59-
60-
```csharp
61-
// Get available functions.
62-
IList<McpClientTool> tools = await client.ListToolsAsync();
63-
64-
// Call the chat client using the tools.
65-
IChatClient chatClient = ...;
66-
var response = await chatClient.GetResponseAsync(
67-
"your prompt here",
68-
new() { Tools = [.. tools] });
69-
```
70-
71-
## Getting Started (Server)
72-
73-
The core package provides the basic server functionality. Here's an example of creating a simple MCP server without dependency injection:
74-
75-
```csharp
76-
using ModelContextProtocol.Server;
77-
using System.ComponentModel;
17+
## About MCP
7818

79-
// Create server options with tools
80-
var serverOptions = new McpServerOptions
81-
{
82-
ToolCollection = [
83-
McpServerTool.Create((string message) => $"hello {message}", new()
84-
{
85-
Name = "echo",
86-
Description = "Echoes the message back to the client."
87-
})
88-
]
89-
};
19+
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.
9020

91-
// Create and run server with stdio transport
92-
await using var stdioTransport = new StdioServerTransport("EchoServer");
93-
await using var server = McpServer.Create(stdioTransport, serverOptions);
94-
await server.RunAsync(CancellationToken.None);
95-
```
21+
For more information about MCP:
9622

97-
For more advanced scenarios with dependency injection, hosting, and automatic tool discovery, see the `ModelContextProtocol` package.
23+
- [Official Documentation](https://modelcontextprotocol.io/)
24+
- [Protocol Specification](https://modelcontextprotocol.io/specification/)
25+
- [GitHub Organization](https://github.com/modelcontextprotocol)

src/ModelContextProtocol/README.md

Lines changed: 9 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -2,107 +2,24 @@
22

33
[![NuGet version](https://img.shields.io/nuget/v/ModelContextProtocol.svg)](https://www.nuget.org/packages/ModelContextProtocol)
44

5-
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. This is the main package with hosting and dependency injection extensions. Please visit our [API documentation](https://modelcontextprotocol.github.io/csharp-sdk/api/ModelContextProtocol.html) for more details on available functionality.
6-
7-
## About MCP
8-
9-
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.
10-
11-
For more information about MCP:
12-
13-
- [Official Documentation](https://modelcontextprotocol.io/)
14-
- [Protocol Specification](https://modelcontextprotocol.io/specification/)
15-
- [GitHub Organization](https://github.com/modelcontextprotocol)
5+
The official C# SDK for the [Model Context Protocol](https://modelcontextprotocol.io/), with hosting and dependency injection extensions. References `ModelContextProtocol.Core`. Please visit the [API documentation](https://modelcontextprotocol.github.io/csharp-sdk/api/ModelContextProtocol.html) for more details on available functionality.
166

177
## Installation
188

19-
To get started, install the package from NuGet
20-
219
```
2210
dotnet add package ModelContextProtocol
2311
```
2412

25-
## Getting Started (Server)
13+
## Getting Started
2614

27-
Create a new console app, add the required packages, and replace `Program.cs` with the code below to get a working MCP server that exposes a single tool over stdio:
15+
To get started, see the [Getting Started](https://modelcontextprotocol.github.io/csharp-sdk/concepts/getting-started.html) guide for installation instructions, package-selection guidance, and complete examples for both clients and servers.
2816

29-
```
30-
dotnet new console
31-
dotnet add package ModelContextProtocol
32-
dotnet add package Microsoft.Extensions.Hosting
33-
```
34-
35-
```csharp
36-
using Microsoft.Extensions.DependencyInjection;
37-
using Microsoft.Extensions.Hosting;
38-
using Microsoft.Extensions.Logging;
39-
using ModelContextProtocol.Server;
40-
using System.ComponentModel;
41-
42-
var builder = Host.CreateApplicationBuilder(args);
43-
builder.Logging.AddConsole(consoleLogOptions =>
44-
{
45-
// Configure all logs to go to stderr
46-
consoleLogOptions.LogToStandardErrorThreshold = LogLevel.Trace;
47-
});
48-
builder.Services
49-
.AddMcpServer()
50-
.WithStdioServerTransport()
51-
.WithToolsFromAssembly();
52-
await builder.Build().RunAsync();
53-
54-
[McpServerToolType]
55-
public static class EchoTool
56-
{
57-
[McpServerTool, Description("Echoes the message back to the client.")]
58-
public static string Echo(string message) => $"hello {message}";
59-
}
60-
```
61-
62-
The call to `WithToolsFromAssembly` discovers every class marked with `[McpServerToolType]` in the assembly and registers every `[McpServerTool]` method as a tool. Prompts and resources work the same way with `[McpServerPromptType]` / `[McpServerPrompt]` and `[McpServerResourceType]` / `[McpServerResource]`.
63-
64-
## Getting Started (Client)
65-
66-
To get started writing a client, the `McpClient.CreateAsync` method is used to instantiate and connect an `McpClient`
67-
to a server. Once you have an `McpClient`, you can interact with it, such as to enumerate all available tools and invoke tools.
68-
69-
```csharp
70-
var clientTransport = new StdioClientTransport(new StdioClientTransportOptions
71-
{
72-
Name = "Everything",
73-
Command = "npx",
74-
Arguments = ["-y", "@modelcontextprotocol/server-everything"],
75-
});
76-
77-
var client = await McpClient.CreateAsync(clientTransport);
78-
79-
// Print the list of tools available from the server.
80-
foreach (var tool in await client.ListToolsAsync())
81-
{
82-
Console.WriteLine($"{tool.Name} ({tool.Description})");
83-
}
84-
85-
// Execute a tool (this would normally be driven by LLM tool invocations).
86-
var result = await client.CallToolAsync(
87-
"echo",
88-
new Dictionary<string, object?>() { ["message"] = "Hello MCP!" },
89-
cancellationToken: CancellationToken.None);
90-
91-
// echo always returns one and only one text content object
92-
Console.WriteLine(result.Content.OfType<TextContentBlock>().First().Text);
93-
```
94-
95-
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.
17+
## About MCP
9618

97-
Tools can be easily exposed for immediate use by `IChatClient`s, because `McpClientTool` inherits from `AIFunction`.
19+
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.
9820

99-
```csharp
100-
// Get available functions.
101-
IList<McpClientTool> tools = await client.ListToolsAsync();
21+
For more information about MCP:
10222

103-
// Call the chat client using the tools.
104-
IChatClient chatClient = ...;
105-
var response = await chatClient.GetResponseAsync(
106-
"your prompt here",
107-
new() { Tools = [.. tools] });
108-
```
23+
- [Official Documentation](https://modelcontextprotocol.io/)
24+
- [Protocol Specification](https://modelcontextprotocol.io/specification/)
25+
- [GitHub Organization](https://github.com/modelcontextprotocol)

0 commit comments

Comments
 (0)