Learn it. Build it. Ship it for others.
MCP Streamable HTTP examples for Python and TypeScript
This repo provides example MCP Streamable HTTP client and server code in both Python and TypeScript. It uses a simple weather server and interactive client loop to show how the transport works, including cross-language client-server pairs.
People who want to build or learn an MCP Streamable HTTP client-server setup for their own tools.
You can copy a working MCP Streamable HTTP pattern instead of piecing together the transport from the spec alone.
What it does
Python client and server example
A Python client in `python-example/client` and a Python server in `python-example/server`.
TypeScript client and server example
A TypeScript client in `typescript-example/client` and a TypeScript server in `typescript-example/server`.
Cross-language compatibility
The README shows a Python client talking to a TypeScript server, and the reverse.
Interactive chat loop
The client runs an interactive chat loop that sends requests over MCP Streamable HTTP.
How to get it
- 1Run
git clone https://github.com/invariantlabs-ai/mcp-streamable-http.git cd python-example
- 2Run
cd python-example/server pip install . python weather.py
- 3By default, the server will start at http://localhost:8123. If you'd like to specify a…
python weather.py --port=9000
- 4Run
cd ../client pip install .
- 5Run
python client.py
- 6This will start an interactive chat loop using the MCP Streamable HTTP protocol. If you…
python client.py --mcp-localhost-port=9000
README
MCP Streamable HTTP – Python and Typescript Examples
This repository provides example implementations of MCP (Model Context Protocol) Streamable HTTP client and server in Python and Typescript, based on the specification: 📄 MCP Streamable HTTP Spec.
You can set up a client + server stack entirely using either Python or TypeScript. This example also demonstrates cross-language compatibility, allowing a Python client to communicate with a TypeScript server, and vice-versa.
🚀 Getting Started
1. Clone the Repository
git clone https://github.com/invariantlabs-ai/mcp-streamable-http.git
cd python-example
2. Python Example
1. Add Your Anthropic API Key
Update the .env file inside the python-example/client directory with the following content:
ANTHROPIC_API_KEY=your_api_key_here
2. Set Up the Server
cd python-example/server
pip install .
python weather.py
By default, the server will start at http://localhost:8123.
If you'd like to specify a different port, use the --port flag:
python weather.py --port=9000
3. Set Up the Client
cd ../client
pip install .
4. Run the Client
python client.py
This will start an interactive chat loop using the MCP Streamable HTTP protocol.
If you started the MCP server on a different port, specify it using the --mcp-localhost-port flag:
python client.py --mcp-localhost-port=9000
3. Typescript Example
1. Add Your Anthropic API Key
Update the .env file inside the typescript-example/client directory with the following content:
ANTHROPIC_API_KEY=your_api_key_here
2. Set Up the Server
cd typescript-example/server
npm install && npm run build
node build/index.js
By default, the server will start at http://localhost:8123.
If you'd like to specify a different port, use the --port flag:
node build/index.js --port=9000
3. Set Up the Client
cd ../client
npm install && npm run build
4. Run the Client
node build/index.js
This will start an interactive chat loop using the MCP Streamable HTTP protocol.
If you started the MCP server on a different port, specify it using the --mcp-localhost-port flag:
node build/index.js --mcp-localhost-port=9000
💬 Example Queries
In the client chat interface, you can ask questions like:
- “Are there any weather alerts in Sacramento?”
- “What’s the weather like in New York City?”
- “Tell me the forecast for Boston tomorrow.”
The client will forward requests to the local MCP weather server and return the results using Anthropic’s Claude language model. The MCP transport layer used will be Streamable HTTP.
Files in the repo
- python-example
- typescript-example
- .gitignore
- README.md
Discussion (0)
Ask about usage, or say what you built with itSign in to join the discussion.
No comments yet. Be the first to say what this is good for.
More tutorials & guides
Bash is all you need - A nano claude code–like 「agent harness」, built from 0 to 1
A visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
Specification and documentation for Agent Skills

💻 vibe coding 101|The first course for AI-native product builders.

End-to-end, code-first tutorials for building production-grade GenAI agents. From prototype to enterprise deployment.