mcp-streamable-http
Example implementation of MCP Streamable HTTP client/server in Python and TypeScript.
Documentation
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-example2. 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_here2. Set Up the Server
cd python-example/server
pip install .
python weather.pyBy 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=90003. Set Up the Client
cd ../client
pip install .4. Run the Client
python client.pyThis 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=90003. 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_here2. Set Up the Server
cd typescript-example/server
npm install && npm run build
node build/index.jsBy 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=90003. Set Up the Client
cd ../client
npm install && npm run build4. Run the Client
node build/index.jsThis 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.
Frequently asked questions
What is mcp-streamable-http?
mcp-streamable-http is Example implementation of MCP Streamable HTTP client/server in Python and TypeScript.
How do I install mcp-streamable-http?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-streamable-http open source?
Yes β it is hosted on GitHub at https://github.com/invariantlabs-ai/mcp-streamable-http and has 105 stars.
Related MCP tools
Mcp-use is the easiest way to interact with mcp servers with custom agents TypeScript-based implementation. Trusted by 8100+ developers.
A Unified MCP Server Management App TypeScript-based implementation. Trusted by 800+ developers. Trusted by 800+ developers.
An MCP client for Neovim that seamlessly integrates MCP servers into your editing workflow with an intuitive interface for managing, testing, and using MCP s...
A text-based user interface (TUI) client for interacting with MCP servers using Ollama. Features include multi-server, dynamic model switching, streaming res...
5ire is a cross-platform desktop AI assistant, MCP client. It compatible with major service providers, supports local knowledge base and tools via model co...
π€ A visualization mcp contains 25+ visual charts using @antvis. Using for chart generation and data analysis. TypeScript-based implementation.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP