Skip to content

pavansandeep2910/mcp-streamable-http

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP Streamable HTTP – Python Example

This repository provides example implementations of MCP (Model Context Protocol) Streamable HTTP client and server in Python, based on the specification: 📄 MCP Streamable HTTP Spec.

🚀 Getting Started

1. Add Your OpenAI API Key

Update the .env file inside the client directory with the following content:

OPENAI_API_KEY=your_api_key_here

2. Set Up the Server

cd 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

💬 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 GPT-4o language model. The MCP transport layer used will be Streamable HTTP.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%