Repository navigation
From real MCP previews to HTTPX GET/POST serialization, using only MockTransport #3886
aistudio12
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
SocialMediaScraper · API docs · Pricing
This MIT example checks a practical boundary for Python API-client developers: turning an offline API request plan into HTTPX query parameters and JSON bytes, while keeping data execution out of the demonstration. Codex provided AI assistance in development and verification. It is not a vulnerability report, an HTTPX maintenance request, or a claim of live API integration testing.
The current repository contribution guide places HTTPX in maintenance and directs feature contributions to hip. This is a usage example of the installed HTTPX 0.29.0 API, not a feature request or a claim of hip compatibility.
Complete source, installation, platform-specific hash lock and recorded checks: https://github.com/aistudio12/socialmediascraper-mcp-node/tree/e35c7e1073eb92cece15cb16e75d81d33ac6d5d0/examples/httpx-plan-serialization
Real plans, synthetic transport responses
A real Python MCP client connects to the fixed local Node adapter, discovers four tools, then makes four genuine tool calls: inspect+preview for
tiktok_profile(GET), and inspect+preview forfacebook_adlibrary_search_ads_post(POST). The preview results are not mocks. Both SDK contexts close before HTTPX serialization begins.The HTTPX portion uses only
Client(transport=MockTransport(...), trust_env=False, follow_redirects=False).build_request()creates actual HTTPX request objects. Twosend()calls go into a local in-memory handler, which returns invented JSON containingsynthetic_transport_response: true. There is no DNS lookup, socket or provider HTTP, even though the plan's host string is the real origin. The responses are explicitly synthetic and are not examples of SocialMediaScraper's live response schema.The complete source provides the named functions and validation. Do not replace the mock transport with a default transport and send requests based on this demonstration. The reusable builder itself only constructs a request object; real execution requires independent authorization and the current API contract.
What the assertions check
{"handle":"synthetic example & Ω"}round-trips Unicode, spaces and ampersands through HTTPX URL parameters, with an empty request body.{"query":"synthetic Ω & example","trim":true,"search_type":"keyword_exact_phrase"}becomes actual JSON bytes with a real JSON boolean andapplication/jsonmedia type.Reproduce
The README creates a project-local environment and installs the adapter from its actual GitHub development prerelease tarball. It does not assume npm registry publication. Archive SHA-256:
98d24faf67114de1596645e40f5808fe514c0acec27a0b8c410aa735439fcc0e.Recorded runtime: CPython 3.13.5, HTTPX 0.29.0, Python MCP SDK 1.30.0, Node 22.22.3, macOS arm64. This is
httpx, nothttpx2orhip; no MCP SDK 2.3.0 test is claimed for this example. The 29-package hash lock includes compiled wheel hashes for this CPython/platform. Existing task dependencies were reused without new downloads, and all 13 installed adapter archive files matched byte for byte. A new empty-environment dependency install is not claimed; setup downloads are separate from runtime API access.The actual standalone program passed in a minimal subprocess environment with test-only Python/Node socket guards: both recorded zero attempts. Provider/model/paid calls: zero. This does not verify TLS, HTTP/2, redirects, retry semantics, hosted OAuth, live responses or authentication, other operating systems, or other package versions.
Commercial API boundary
The adapter discovers
search_operations,inspect_operation,preview_request, andexecute_request. This example calls only inspect/preview. Its child receives an empty API key, paid execution explicitlyfalse, and process budget0; no execution tool is invoked. The local executable paths must be trusted.The bundled 197-operation catalog and estimates are a fixed
2026-11-23.2snapshot, not current quotes, reservations or provider billing limits. Current official schemas may add optionalx-price-versionand response details under the same label. Generated/v1/...URLs are unsent plan metadata, not verified live landing pages. Free MIT installation and offline planning do not include free API data. Separately authorized real data requires your own key, prepaid credits and applicable charges; see the current docs and pricing.All reactions