Skip to content

fix: normalize headers in sse transport #856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marcrasi
Copy link

@marcrasi marcrasi commented Aug 7, 2025

The SSE transport does not properly forward custom headers that are provided as a Headers object or as a [string, string][].

The Streamable HTTP transport already implements the correct solution to this problem, so I moved the solution into a common helper function, used it from both transports, and added a test to the SSE transport that exercises this.

Motivation and Context

Bug

How Has This Been Tested?

I have an internal application that passes custom headers [["Authorization", "Bearer XYZ"]] to the client. Before this change, this was getting forwarded to the server as a header {0: "Authorization,Bearer XYZ"}. After this change, it is correctly forwarded as {Authorization: "Bearer XYZ"}.

Also, I added a unit test.

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling (N/A: doesn't add new error possibilities)
  • I have added or updated documentation as needed (N/A: just a fix to existing functionality)

Additional context

None

@marcrasi marcrasi requested a review from a team as a code owner August 7, 2025 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant