File tree Expand file tree Collapse file tree
ModelContextProtocol.AspNetCore
ModelContextProtocol/Server
tests/ModelContextProtocol.TestSseServer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44namespace ModelContextProtocol . AspNetCore ;
55
6- internal class StatelessSessionId
6+ internal sealed class StatelessSessionId
77{
88 [ JsonPropertyName ( "capabilities" ) ]
99 public ClientCapabilities ? Capabilities { get ; init ; }
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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 ; }
Original file line number Diff line number Diff line change 33using ModelContextProtocol . Server ;
44using ModelContextProtocol . Utils . Json ;
55using Serilog ;
6- using System . Diagnostics ;
76using System . Text ;
87using System . Text . Json ;
98
You can’t perform that action at this time.
0 commit comments