Replace httpx and httpx-sse with httpx2 (#2972)
Co-authored-by: Max Isbey <224885523+maxisbey@users.noreply.github.com>
This commit is contained in:
parent
1216c53693
commit
2713b53b12
2 changed files with 1029 additions and 948 deletions
|
|
@ -34,7 +34,7 @@ kill "$SERVER_PID"
|
|||
|
||||
- `client.py` `main` — `async with Client(target, mode=mode) as client:` is an
|
||||
ordinary high-level client; nothing about JSON mode is visible from this side.
|
||||
The same `main` also takes the raw `httpx.AsyncClient` so it can prove what
|
||||
The same `main` also takes the raw `httpx2.AsyncClient` so it can prove what
|
||||
the wire looks like underneath.
|
||||
- `client.py` `RAW_ENVELOPE_BODY` / `MODERN_HEADERS` — the exact 2026 wire
|
||||
shape: three `io.modelcontextprotocol/*` `_meta` keys replace the initialize
|
||||
|
|
@ -52,7 +52,7 @@ kill "$SERVER_PID"
|
|||
## Caveats
|
||||
|
||||
- DNS-rebinding protection is on by default; the harness disables it via
|
||||
`NO_DNS_REBIND` because the in-process httpx client sends no `Origin` header.
|
||||
`NO_DNS_REBIND` because the in-process httpx2 client sends no `Origin` header.
|
||||
- The `streamable_http_app()` call shape here will move when the free-function
|
||||
entry lands (see `_hosting.py`).
|
||||
- `Mcp-Name` is omitted for `tools/list` because the SDK only emits it on
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ sends — this is the only story that shows it. ``main`` posts that body by hand
|
|||
asserts the response is a single ``application/json`` body with no session id.
|
||||
"""
|
||||
|
||||
import httpx
|
||||
import httpx2
|
||||
from mcp_types import TextContent
|
||||
from mcp_types.version import LATEST_MODERN_VERSION
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ MODERN_HEADERS: dict[str, str] = {
|
|||
}
|
||||
|
||||
|
||||
async def main(target: Target, *, mode: str = "auto", http: httpx.AsyncClient) -> None:
|
||||
async def main(target: Target, *, mode: str = "auto", http: httpx2.AsyncClient) -> None:
|
||||
async with Client(target, mode=mode) as client:
|
||||
assert client.protocol_version == LATEST_MODERN_VERSION
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue