Skip to content

Commit 8de5d49

Browse files
committed
Address PR feedback WIP
1 parent b314605 commit 8de5d49

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/ModelContextProtocol.AspNetCore/StatelessSessionId.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace ModelContextProtocol.AspNetCore;
55

6-
internal class StatelessSessionId
6+
internal sealed class StatelessSessionId
77
{
88
[JsonPropertyName("capabilities")]
99
public ClientCapabilities? Capabilities { get; init; }

src/ModelContextProtocol.AspNetCore/StreamableHttpHandler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,15 @@ private async ValueTask<HttpMcpSession<StreamableHttpServerTransport>> StartNewS
191191
}
192192
else
193193
{
194-
// "(uninitialized stateless id)" is not written anywhere. We delay writing th mcp-session-id
194+
// "(uninitialized stateless id)" is not written anywhere. We delay writing the mcp-session-id
195195
// until after we receive the initialize request with the client info we need to serialize.
196196
sessionId = "(uninitialized stateless id)";
197197
ScheduleStatelessSessionIdWrite(context, transport);
198198
}
199199

200200
var session = await CreateSessionAsync(context, transport, sessionId);
201201

202-
// The HttpMcpSession is not stored between requests in stateless mode. Instead the session is recreated from the mcp-session-id.
202+
// The HttpMcpSession is not stored between requests in stateless mode. Instead, the session is recreated from the mcp-session-id.
203203
if (!HttpServerTransportOptions.Stateless)
204204
{
205205
if (!Sessions.TryAdd(sessionId, session))
@@ -224,8 +224,8 @@ private async ValueTask<HttpMcpSession<StreamableHttpServerTransport>> CreateSes
224224

225225
if (statelessId is not null)
226226
{
227-
mcpServerOptions.KnownClientInfo = statelessId.ClientInfo;
228-
mcpServerOptions.KnownClientCapabilities = statelessId.Capabilities;
227+
mcpServerOptions.KnownClientInfo = statelessId.ClientInfo ?? mcpServerOptions.KnownClientInfo;
228+
mcpServerOptions.KnownClientCapabilities = statelessId.Capabilities ?? mcpServerOptions.KnownClientCapabilities;
229229
}
230230

231231
if (HttpServerTransportOptions.ConfigureSessionOptions is { } configureSessionOptions)

src/ModelContextProtocol/Server/McpServerOptions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@ public class McpServerOptions
7272
/// </summary>
7373
/// <remarks>
7474
/// <para>
75-
/// When not specified, this information sourced from the client's initialize request.
75+
/// When not specified, this information is sourced from the client's initialize request.
7676
/// </para>
7777
/// </remarks>
7878
public Implementation? KnownClientInfo { get; set; }
7979

8080
/// <summary>
81-
/// Gets or sets preexisting knowledge about the client client capabilities to help support
81+
/// Gets or sets preexisting knowledge about the client's capabilities to help support
8282
/// stateless Streamable HTTP servers that encode this knowledge in the mcp-session-id header.
8383
/// </summary>
8484
/// <remarks>
8585
/// <para>
86-
/// When not specified, this information sourced from the client's initialize request.
86+
/// When not specified, this information is sourced from the client's initialize request.
8787
/// </para>
8888
/// </remarks>
8989
public ClientCapabilities? KnownClientCapabilities { get; set; }

tests/ModelContextProtocol.TestSseServer/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using ModelContextProtocol.Server;
44
using ModelContextProtocol.Utils.Json;
55
using Serilog;
6-
using System.Diagnostics;
76
using System.Text;
87
using System.Text.Json;
98

0 commit comments

Comments
 (0)