Skip to content

feat: add remote streamable-http client example#2807

Open
twzrd-sol wants to merge 1 commit into
modelcontextprotocol:mainfrom
twzrd-sol:feat/twzrd-agent-intel-example
Open

feat: add remote streamable-http client example#2807
twzrd-sol wants to merge 1 commit into
modelcontextprotocol:mainfrom
twzrd-sol:feat/twzrd-agent-intel-example

Conversation

@twzrd-sol
Copy link
Copy Markdown

Summary

Adds examples/clients/remote_streamablehttp_client.py — a minimal, runnable example showing how to connect to a remote (hosted) MCP server using streamable-http transport.

The existing examples/servers/simple-streamablehttp/ shows how to build a streamable-http server. This example shows the client side: connecting to an already-deployed remote server with no local setup required.

Why this is useful

The streamable-http transport is the recommended transport for production/hosted MCP servers, but the SDK examples only show local server patterns. New SDK users frequently ask "how do I connect to a remote server?"—this answers that question with a single runnable file.

What the example uses

TWZRD Agent Intel (https://intel.twzrd.xyz/mcp) — a live production MCP server with free tools, so the example works out-of-the-box without any API key or local server setup:

  • score_agent(wallet) — returns a 0-100 trust score for a Web3 agent wallet
  • preflight_check(wallet) — quick go/no-go check before making a payment

The example:

  1. Connects via streamablehttp_client
  2. Initializes the session
  3. Lists available tools
  4. Calls score_agent and preflight_check
  5. Prints results

Install

pip install mcp
python examples/clients/remote_streamablehttp_client.py

No credentials needed — the free tools are public.

Test plan

  • pip install mcp in a fresh env
  • python examples/clients/remote_streamablehttp_client.py runs without error
  • Server name/version prints correctly from initialize()
  • Both tool calls return text content

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