Skip to content
Back to search

mcp-streamable-http

Example implementation of MCP Streamable HTTP client/server in Python and TypeScript.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/invariantlabs-ai--mcp-streamable-http/badge.svg)](/listings/invariantlabs-ai--mcp-streamable-http)

HTML

<a href="/listings/invariantlabs-ai--mcp-streamable-http"><img src="/api/listings/invariantlabs-ai--mcp-streamable-http/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

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

---

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 116 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # MCP Streamable HTTP – Python and Typescript Examples
  2. 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](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
  3. 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.
  4. ## 🚀 Getting Started
  5. ### 1. Clone the Repository
  6. ```bash
  7. git clone https://github.com/invariantlabs-ai/mcp-streamable-http.git
  8. cd python-example
  9. ```
  10. ### 2. Python Example
  11. #### 1. Add Your Anthropic API Key
  12. Update the `.env` file inside the `python-example/client` directory with the following content:
  13. ```env
  14. ANTHROPIC_API_KEY=your_api_key_here
  15. ```
  16. #### 2. Set Up the Server
  17. ```bash
  18. cd python-example/server
  19. pip install .
  20. python weather.py
  21. ```
  22. By default, the server will start at `http://localhost:8123`.
  23. If you'd like to specify a different port, use the `--port` flag:
  24. ```bash
  25. python weather.py --port=9000
  26. ```
  27. #### 3. Set Up the Client
  28. ```bash
  29. cd ../client
  30. pip install .
  31. ```
  32. #### 4. Run the Client
  33. ```bash
  34. python client.py
  35. ```
  36. This will start an **interactive chat loop** using the MCP Streamable HTTP protocol.
  37. If you started the MCP server on a different port, specify it using the `--mcp-localhost-port` flag:
  38. ```bash
  39. python client.py --mcp-localhost-port=9000
  40. ```
  41. ### 3. Typescript Example
  42. #### 1. Add Your Anthropic API Key
  43. Update the `.env` file inside the `typescript-example/client` directory with the following content:
  44. ```env
  45. ANTHROPIC_API_KEY=your_api_key_here
  46. ```
  47. #### 2. Set Up the Server
  48. ```bash
  49. cd typescript-example/server
  50. npm install && npm run build
  51. node build/index.js
  52. ```
  53. By default, the server will start at `http://localhost:8123`.
  54. If you'd like to specify a different port, use the `--port` flag:
  55. ```bash
  56. node build/index.js --port=9000
  57. ```
  58. #### 3. Set Up the Client
  59. ```bash
  60. cd ../client
  61. npm install && npm run build
  62. ```
  63. #### 4. Run the Client
  64. ```bash
  65. node build/index.js
  66. ```
  67. This will start an **interactive chat loop** using the MCP Streamable HTTP protocol.
  68. If you started the MCP server on a different port, specify it using the `--mcp-localhost-port` flag:
  69. ```bash
  70. node build/index.js --mcp-localhost-port=9000
  71. ```
  72. ---
  73. ## 💬 Example Queries
  74. In the client chat interface, you can ask questions like:
  75. - “Are there any weather alerts in Sacramento?”
  76. - “What’s the weather like in New York City?”
  77. - “Tell me the forecast for Boston tomorrow.”
  78. 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.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.