Merge pull request #392 from koic/fallback_missing_protocol_version_in_streamable_http_transport
Default missing `MCP-Protocol-Version` to 2025-03-26 in StreamableHTTPTransport
This commit is contained in:
commit
3d7046ab1a
2 changed files with 46 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ module MCP
|
|||
SUPPORTED_STABLE_PROTOCOL_VERSIONS = [
|
||||
LATEST_STABLE_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05",
|
||||
]
|
||||
DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26"
|
||||
|
||||
attr_writer :exception_reporter, :around_request
|
||||
|
||||
|
|
|
|||
|
|
@ -551,8 +551,7 @@ module MCP
|
|||
end
|
||||
|
||||
def validate_protocol_version_header(request)
|
||||
header_value = request.env["HTTP_MCP_PROTOCOL_VERSION"]
|
||||
return if header_value.nil?
|
||||
header_value = request.env["HTTP_MCP_PROTOCOL_VERSION"] || MCP::Configuration::DEFAULT_NEGOTIATED_PROTOCOL_VERSION
|
||||
return if MCP::Configuration::SUPPORTED_STABLE_PROTOCOL_VERSIONS.include?(header_value)
|
||||
|
||||
supported = MCP::Configuration::SUPPORTED_STABLE_PROTOCOL_VERSIONS.join(", ")
|
||||
|
|
|
|||
Loading…
Reference in a new issue