Skip to content

feat(transport): expose streamable HTTP Host header check - #1343

Draft
monody0007 wants to merge 1 commit into
modelcontextprotocol:mainfrom
monody0007:oss-pilot/rust-sdk-1334-public-host-check
Draft

monody0007 wants to merge 1 commit into
modelcontextprotocol:mainfrom
monody0007:oss-pilot/rust-sdk-1334-public-host-check

Conversation

@monody0007

Copy link
Copy Markdown

An authentication layer in front of the Streamable HTTP service currently runs before rmcp rejects a disallowed Host. Reusing rmcp's check requires access to its private validation helpers.

Add StreamableHttpServerConfig::is_host_allowed(uri, headers) so middleware can check the configured allowed hosts first. The method and service share the same validator, preserving Host precedence, HTTP/2 authority fallback, port matching, and existing error responses; Origin validation is unchanged.

Tested offline with 23 request cases comparing the public check against service responses, existing Host and Origin tests, library tests, a rustdoc example, formatting checks, and targeted Clippy.

Closes #1334

@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-transport Transport layer changes labels Oct 12, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-test Testing related changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose the streamable HTTP server's Host validation

1 participant