Skip to content

fix: send Origin header for streamable HTTP#2731

Open
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/streamable-http-origin-header
Open

fix: send Origin header for streamable HTTP#2731
he-yufeng wants to merge 1 commit into
modelcontextprotocol:mainfrom
he-yufeng:fix/streamable-http-origin-header

Conversation

@he-yufeng
Copy link
Copy Markdown

Fixes #2727.

Summary

  • derive an Origin header from the streamable HTTP endpoint for client requests
  • keep a caller-provided Origin on custom httpx.AsyncClient headers
  • cover the default and custom-Origin paths in streamable HTTP client tests

To verify

  • uv run pytest tests/shared/test_streamable_http.py -q
  • uv run ruff check src/mcp/client/streamable_http.py tests/shared/test_streamable_http.py
  • uv run ruff format --check src/mcp/client/streamable_http.py tests/shared/test_streamable_http.py
  • uv run pyright src/mcp/client/streamable_http.py tests/shared/test_streamable_http.py
  • python -m py_compile src\mcp\client\streamable_http.py tests\shared\test_streamable_http.py

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.

streamable_http client does not send Origin header → rejected with 403 by spec-compliant servers (e.g. go-sdk CrossOriginProtection)

1 participant