Overview
What is Weather MCP (Model Context Protocol) Demo?
Weather MCP (Model Context Protocol) Demo is a demonstration project that implements a Model Context Protocol (MCP) system for weather information. It consists of a Python-based MCP server that provides weather data and an OpenAI GPT-4 client that processes natural language queries, enabling users to ask about weather through a command-line interface.
How to use Weather MCP (Model Context Protocol) Demo?
Clone the repository, create a .env file with your OpenAI API key in both server_weather/ and client_weather_openai/ directories, install dependencies using a Python virtual environment and pip install -r requirements.txt. Start the server with python server_weather.py, then start the client with python weather_agent_openai.py and ask natural language questions like "What's the weather in New York today?"
Key features of Weather MCP (Model Context Protocol) Demo
- Server exposes weather endpoint via SSE (
http://localhost:4000/sse) - Provides a
fetch-weathertool discoverable by MCP clients - Client integrates with OpenAI GPT-4 for natural language processing
- Automatic tool discovery from the MCP server
- Interactive command-line interface for user interactions
Use cases of Weather MCP (Model Context Protocol) Demo
- Query current weather in any city using natural language
- Demonstrate Model Context Protocol integration between an AI agent and a weather service
- Experiment with MCP tool discovery and SSE transport
- Showcase OpenAI GPT-4's ability to invoke external tools
FAQ from Weather MCP (Model Context Protocol) Demo
What does this server do?
The Weather MCP server provides a fetch-weather tool that returns weather information. The client uses OpenAI's GPT-4 to interpret natural language questions and calls the server tool to answer them.
What are the runtime requirements?
You need Python 3.x, an OpenAI API key (obtainable from the OpenAI Platform), and a properly configured .env file with your key.
What transport protocol does it use?
The server communicates via Server-Sent Events (SSE) and listens on http://localhost:4000/sse.
Where does the weather data come from?
The README does not specify the data source; the server provides weather information through its fetch-weather tool.
Is this project ready for production?
No, this is a demonstration project meant for learning and experimentation with the Model Context Protocol. It is open source under the MIT License and welcomes contributions.