Example implementation of MCP Streamable HTTP client/server in Python and TypeScript.
# Add to your Claude Code skills
git clone https://github.com/invariantlabs-ai/mcp-streamable-httpThis 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.
git clone https://github.com/invariantlabs-ai/mcp-streamable-http.git
cd python-example
Update the .env file inside the python-example/client directory with the following content:
ANTHROPIC_API_KEY=your_api_key_here
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
cd ../client
pip install .
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 flag:
--mcp-localhost-portpython client.py --mcp-localhost-port=9000
Update the .env file inside the typescript-example/client directory with the following content:
ANTHROPIC_API_KEY=your_api_key_here
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
cd ../client
npm install && npm run build
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
In the client chat interface, you can ask questions like:
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.