Skip to content

Add HeaderName constants for MCP HTTP headers - #1202

Open
gandhipratik203 wants to merge 1 commit into
modelcontextprotocol:mainfrom
gandhipratik203:add-headername-constants
Open

Add HeaderName constants for MCP HTTP headers#1202
gandhipratik203 wants to merge 1 commit into
modelcontextprotocol:mainfrom
gandhipratik203:add-headername-constants

Conversation

@gandhipratik203

Copy link
Copy Markdown

Summary

  • Add lowercase http::HeaderName constants for exact MCP HTTP headers while keeping the existing &str constants.
  • Add a lowercase Mcp-Param-* prefix constant for prefix matching.
  • Switch internal exact header lookups/inserts to the typed constants where useful.

Validation

  • cargo test -p rmcp --features client-side-sse,server-side-http --lib transport::common::http_header
  • cargo test -p rmcp --lib
  • cargo test -p rmcp --features client,transport-streamable-http-client-reqwest,transport-streamable-http-server --lib
  • cargo test -p rmcp --features client,transport-streamable-http-client-unix-socket --lib
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --all-features

Signed-off-by: Pratik Gandhi <gandhipratik203@gmail.com>
@github-actions github-actions Bot added T-core Core library changes T-transport Transport layer changes labels Aug 22, 2026
@gandhipratik203
gandhipratik203 marked this pull request as ready for review August 22, 2026 09:03
@gandhipratik203
gandhipratik203 requested a review from a team as a code owner August 22, 2026 09:03
@gandhipratik203

Copy link
Copy Markdown
Author

Context for this PR: this came out of downstream integration work in ContextForge, where we needed typed HeaderName constants for MCP headers instead of rebuilding them locally.

I checked the contribution notes after opening this and saw the "discuss first" preference. Happy to move this into an issue/discussion first if that is preferred.

This keeps the existing &str constants and only adds typed constants for exact header lookups/inserts.

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-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant