Skip to content

Commit b61ed6c

Browse files
authored
Merge branch 'main' into copilot/implement-allowed-values-completion
2 parents 10b4748 + 1578e94 commit b61ed6c

File tree

13 files changed

+65
-173
lines changed

13 files changed

+65
-173
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ The official C# SDK for the [Model Context Protocol](https://modelcontextprotoco
88

99
This SDK consists of three main packages:
1010

11-
- **[ModelContextProtocol.Core](https://www.nuget.org/packages/ModelContextProtocol.Core)** [![NuGet version](https://img.shields.io/nuget/v/ModelContextProtocol.Core.svg)](https://www.nuget.org/packages/ModelContextProtocol.Core) - For projects that only need to use the client or low-level server APIs and want the minimum number of dependencies. [Documentation](src/ModelContextProtocol.Core/README.md)
11+
- **[ModelContextProtocol.Core](https://www.nuget.org/packages/ModelContextProtocol.Core)** [![NuGet version](https://img.shields.io/nuget/v/ModelContextProtocol.Core.svg)](https://www.nuget.org/packages/ModelContextProtocol.Core) - For projects that only need to use the client or low-level server APIs and want the minimum number of dependencies.
1212

13-
- **[ModelContextProtocol](https://www.nuget.org/packages/ModelContextProtocol)** [![NuGet version](https://img.shields.io/nuget/v/ModelContextProtocol.svg)](https://www.nuget.org/packages/ModelContextProtocol) - The main package with hosting and dependency injection extensions. References `ModelContextProtocol.Core`. This is the right fit for most projects that don't need HTTP server capabilities. [Documentation](src/ModelContextProtocol/README.md)
13+
- **[ModelContextProtocol](https://www.nuget.org/packages/ModelContextProtocol)** [![NuGet version](https://img.shields.io/nuget/v/ModelContextProtocol.svg)](https://www.nuget.org/packages/ModelContextProtocol) - The main package with hosting and dependency injection extensions. References `ModelContextProtocol.Core`. This is the right fit for most projects that don't need HTTP server capabilities.
1414

15-
- **[ModelContextProtocol.AspNetCore](https://www.nuget.org/packages/ModelContextProtocol.AspNetCore)** [![NuGet version](https://img.shields.io/nuget/v/ModelContextProtocol.AspNetCore.svg)](https://www.nuget.org/packages/ModelContextProtocol.AspNetCore) - The library for HTTP-based MCP servers. References `ModelContextProtocol`. [Documentation](src/ModelContextProtocol.AspNetCore/README.md)
15+
- **[ModelContextProtocol.AspNetCore](https://www.nuget.org/packages/ModelContextProtocol.AspNetCore)** [![NuGet version](https://img.shields.io/nuget/v/ModelContextProtocol.AspNetCore.svg)](https://www.nuget.org/packages/ModelContextProtocol.AspNetCore) - The library for HTTP-based MCP servers. References `ModelContextProtocol`.
1616

1717
## Getting Started
1818

@@ -26,7 +26,8 @@ The Model Context Protocol (MCP) is an open protocol that standardizes how appli
2626

2727
For more information about MCP:
2828

29-
- [Official Documentation](https://modelcontextprotocol.io/)
29+
- [Official MCP Documentation](https://modelcontextprotocol.io/)
30+
- [MCP C# SDK Documentation](https://modelcontextprotocol.github.io/csharp-sdk/)
3031
- [Protocol Specification](https://modelcontextprotocol.io/specification/)
3132
- [GitHub Organization](https://github.com/modelcontextprotocol)
3233

docs/concepts/transports/transports.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ app.MapMcp("/mcp");
137137

138138
When using a custom route, Streamable HTTP clients should connect directly to that route (e.g., `https://host/mcp`), while SSE clients should connect to `{route}/sse` (e.g., `https://host/mcp/sse`).
139139

140-
See the `ModelContextProtocol.AspNetCore` package [README](https://github.com/modelcontextprotocol/csharp-sdk/blob/main/src/ModelContextProtocol.AspNetCore/README.md) for more configuration options.
141-
142140
### SSE transport (legacy)
143141

144142
The [SSE (Server-Sent Events)] transport is a legacy mechanism that uses unidirectional server-to-client streaming with a separate HTTP endpoint for client-to-server messages. New implementations should prefer Streamable HTTP.

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1717
<AssemblyOriginatorKeyFile>$(RepoRoot)\Open.snk</AssemblyOriginatorKeyFile>
1818
<SignAssembly>true</SignAssembly>
19+
<EnablePackageValidation>true</EnablePackageValidation>
20+
<PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>
1921
</PropertyGroup>
2022

2123
<ItemGroup>

src/ModelContextProtocol.AspNetCore/ModelContextProtocol.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<None Include="README.md" pack="true" PackagePath="\" />
20+
<None Include="..\PACKAGE.md" Pack="true" PackagePath="\README.md" />
2121
</ItemGroup>
2222

2323
<ItemGroup>

src/ModelContextProtocol.AspNetCore/README.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/ModelContextProtocol.Core/McpSessionHandler.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ public McpSessionHandler(
132132
_incomingMessageFilter = incomingMessageFilter ?? (next => next);
133133
_outgoingMessageFilter = outgoingMessageFilter ?? (next => next);
134134
_logger = logger;
135+
136+
// Per the MCP spec, ping may be initiated by either party and must always be handled.
137+
_requestHandlers.Set(
138+
RequestMethods.Ping,
139+
(request, _, cancellationToken) => new ValueTask<PingResult>(new PingResult()),
140+
McpJsonUtilities.JsonContext.Default.JsonNode,
141+
McpJsonUtilities.JsonContext.Default.PingResult);
142+
135143
LogSessionCreated(EndpointName, _sessionId, _transportKind);
136144
}
137145

src/ModelContextProtocol.Core/ModelContextProtocol.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
</ItemGroup>
7474

7575
<ItemGroup>
76-
<None Include="README.md" pack="true" PackagePath="\" />
76+
<None Include="..\PACKAGE.md" Pack="true" PackagePath="\README.md" />
7777
</ItemGroup>
7878

7979
</Project>

src/ModelContextProtocol.Core/README.md

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/ModelContextProtocol.Core/Server/McpServerImpl.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public McpServerImpl(ITransport transport, McpServerOptions options, ILoggerFact
9191
ConfigureLogging(options);
9292
ConfigureCompletion(options);
9393
ConfigureExperimental(options);
94-
ConfigurePing();
9594

9695
// Register any notification handlers that were provided.
9796
if (options.Handlers.NotificationHandlers is { } notificationHandlers)
@@ -204,14 +203,6 @@ public override async ValueTask DisposeAsync()
204203
await _sessionHandler.DisposeAsync().ConfigureAwait(false);
205204
}
206205

207-
private void ConfigurePing()
208-
{
209-
SetHandler(RequestMethods.Ping,
210-
async (request, _) => new PingResult(),
211-
McpJsonUtilities.JsonContext.Default.JsonNode,
212-
McpJsonUtilities.JsonContext.Default.PingResult);
213-
}
214-
215206
private void ConfigureInitialize(McpServerOptions options)
216207
{
217208
_requestHandlers.Set(RequestMethods.Initialize,

0 commit comments

Comments
 (0)