Add McpSessions.NegotiatedProtocolVersion property. (#794)
This commit is contained in:
parent
38b4a26998
commit
7cfe0ef621
2 changed files with 57 additions and 20 deletions
|
|
@ -6,6 +6,7 @@ namespace ModelContextProtocol.Server;
|
|||
internal sealed class DestinationBoundMcpServer(McpServerImpl server, ITransport? transport) : McpServer
|
||||
{
|
||||
public override string? SessionId => transport?.SessionId ?? server.SessionId;
|
||||
public override string? NegotiatedProtocolVersion => server.NegotiatedProtocolVersion;
|
||||
public override ClientCapabilities? ClientCapabilities => server.ClientCapabilities;
|
||||
public override Implementation? ClientInfo => server.ClientInfo;
|
||||
public override McpServerOptions ServerOptions => server.ServerOptions;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ using System.Text.Json.Serialization.Metadata;
|
|||
|
||||
namespace ModelContextProtocol.Server;
|
||||
|
||||
// TODO: Fix merge conflicts in this file.
|
||||
|
||||
/// <inheritdoc />
|
||||
internal sealed partial class McpServerImpl : McpServer
|
||||
{
|
||||
|
|
@ -31,6 +29,7 @@ internal sealed partial class McpServerImpl : McpServer
|
|||
private Implementation? _clientInfo;
|
||||
|
||||
private readonly string _serverOnlyEndpointName;
|
||||
private string? _negotiatedProtocolVersion;
|
||||
private string _endpointName;
|
||||
private int _started;
|
||||
|
||||
|
|
@ -116,6 +115,9 @@ internal sealed partial class McpServerImpl : McpServer
|
|||
/// <inheritdoc/>
|
||||
public override string? SessionId => _sessionTransport.SessionId;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string? NegotiatedProtocolVersion => _negotiatedProtocolVersion;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ServerCapabilities ServerCapabilities { get; } = new();
|
||||
|
||||
|
|
@ -212,6 +214,8 @@ internal sealed partial class McpServerImpl : McpServer
|
|||
McpSessionHandler.LatestProtocolVersion;
|
||||
}
|
||||
|
||||
_negotiatedProtocolVersion = protocolVersion;
|
||||
|
||||
return new InitializeResult
|
||||
{
|
||||
ProtocolVersion = protocolVersion,
|
||||
|
|
|
|||
Loading…
Reference in a new issue