Skip to content

fix: pass streamable HTTP auth via http_client#259

Open
jstar0 wants to merge 1 commit into
MCP-Audit:developfrom
jstar0:fix/streamable-http-client-headers
Open

fix: pass streamable HTTP auth via http_client#259
jstar0 wants to merge 1 commit into
MCP-Audit:developfrom
jstar0:fix/streamable-http-client-headers

Conversation

@jstar0

@jstar0 jstar0 commented Jun 12, 2026

Copy link
Copy Markdown

Summary

  • Route streamable HTTP auth headers through the MCP SDK's http_client hook instead of the removed headers argument.
  • Keep the SSE transport path unchanged, where sse_client(..., headers=...) is still supported.
  • Add focused regression coverage for both transport construction paths.

Changes

  • Create an MCP SDK HTTP client with resolved remote auth headers for streamable HTTP probes.
  • Pass that client to streamable_http_client(..., http_client=...) and keep it open for the transport/session lifetime.
  • Add a focused test that verifies streamable HTTP no longer receives headers=.
  • Add a focused SSE regression test to preserve the existing direct-header path.
  • Document the fix in the changelog.

Why

mcp>=1.27.2 no longer accepts headers= on streamable_http_client(), so remote streamable HTTP probes fail before any network I/O. The SDK expects callers to configure headers on an httpx.AsyncClient and pass that client via http_client=.

Verification

uv run pytest tests/test_remote_probe_http_session.py -q
uv run pytest tests/test_fuzz_remote.py -q
uv run pytest tests/test_live_probe.py tests/test_remote_probe_http_session.py tests/test_fuzz_remote.py -q
uv run ruff check .
uv run ruff format --check .

Fixes #148

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.

[BUG] Fix crash when probing remote MCP servers over streamable HTTP

1 participant