feat!: add SEP-2243 HTTP standard headers (#907)

* feat: add SEP-2243 HTTP standard headers

* feat!: validate Mcp-Param-* headers on server

* fix: emit Mcp-Method on reinit initialized POST

* fix: align header mismatch error code with draft spec

* chore: remove redundant streamable HTTP client comments
This commit is contained in:
Dale Seo 2026-07-10 11:16:29 -04:00 • committed by GitHub
commit 11f525c503
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -168,6 +168,9 @@ impl ProtocolVersion {
pub const V_2024_11_05: Self = Self(Cow::Borrowed("2024-11-05"));
pub const LATEST: Self = Self::V_2025_11_25;
/// First protocol version that requires SEP-2243 standard HTTP headers.
pub const STANDARD_HEADERS: Self = Self::V_2026_07_28;
/// All protocol versions known to this SDK.
pub const KNOWN_VERSIONS: &[Self] = &[
Self::V_2024_11_05,
@ -512,6 +515,7 @@ pub struct JsonRpcNotification<N = Notification> {
pub struct ErrorCode(pub i32);
impl ErrorCode {
pub const HEADER_MISMATCH: Self = Self(-32020);
pub const RESOURCE_NOT_FOUND: Self = Self(-32002);
pub const INVALID_REQUEST: Self = Self(-32600);
pub const METHOD_NOT_FOUND: Self = Self(-32601);
@ -557,7 +561,9 @@ impl ErrorData {
pub fn resource_not_found(message: impl Into<Cow<'static, str>>, data: Option<Value>) -> Self {
Self::new(ErrorCode::RESOURCE_NOT_FOUND, message, data)
}
pub fn header_mismatch(message: impl Into<Cow<'static, str>>, data: Option<Value>) -> Self {
Self::new(ErrorCode::HEADER_MISMATCH, message, data)
}
pub fn parse_error(message: impl Into<Cow<'static, str>>, data: Option<Value>) -> Self {
Self::new(ErrorCode::PARSE_ERROR, message, data)
}