mcpField
๐ŸŒฆ
๐ŸŒฆ๏ธ Weather MCP (Model Context Protocol) Demo

๐ŸŒฆ๏ธ Weather MCP (Model Context Protocol) Demo

Local
github.com/sturleseMedia & Design0Updated 77w ago

About ๐ŸŒฆ๏ธ Weather MCP (Model Context Protocol) Demo

Weather MCP Demo combines a Python weather server with a GPT-4 command-line client for natural-language weather queries. It is an example system showing how a client can discover and use a server tool.

Key features

  1. 01Weather server over SSE
  2. 02Discoverable fetch-weather tool
  3. 03GPT-4 natural-language client
  4. 04Interactive command-line interface

Use cases

  1. 01Asking for weather in natural language
  2. 02Exploring client-side tool discovery
  3. 03Studying a weather MCP client-server setup

MCP support

The server exposes a fetch-weather tool over SSE for MCP clients. The included OpenAI client discovers and uses that tool to handle weather queries.

Configuration

Local server config is the same for every client. Copy it into your clientโ€™s MCP config file.

No install method listed yet

We havenโ€™t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

๐ŸŒฆ๏ธ Weather MCP (Model Context Protocol) Demo

This project demonstrates the implementation of a Model Context Protocol (MCP) system for weather information, consisting of a client using OpenAI's agents and a dedicated MCP server. The system allows users to query weather information through a natural language interface powered by GPT-4.


๐ŸŒŸ Overview

The project is split into two main components:

  • Weather MCP Server: A Python-based server that provides weather information.
  • Weather OpenAI Client: A client that uses OpenAI's GPT-4 model to process natural language requests and interact with the MCP server.

๐Ÿš€ Components

๐ŸŒ Weather MCP Server

๐Ÿ“ Located in: /server_weather/

The server component implements a Model Context Protocol server that:

  • Exposes a weather information endpoint via SSE (Server-Sent Events).
  • Provides a fetch-weather tool that can be discovered by MCP clients.
  • Runs on http://localhost:4000/sse.
๐Ÿค– Weather OpenAI Client

๐Ÿ“ Located in: /client_weather_openai/

The client component features:

  • Integration with OpenAI's GPT-4 model.
  • Automatic tool discovery from the MCP server.
  • Natural language processing for weather queries.
  • Interactive command-line interface for user interactions.

๐Ÿ“‹ Prerequisites

  • Python 3.x
  • OpenAI API Key (Get yours from OpenAI Platform)
  • Environment Variables properly configured (.env file)

๐Ÿ”ง Setup

1. Clone this repository
git clone [email protected]:sturlese/client_server_mcp.git
cd client_server_mcp
2. Set up environment variables
  • Create a .env file in the root of each component (/server_weather/ and /client_weather_openai/).
  • Add your OpenAI API key:
# Example of .env file
OPENAI_API_KEY='your-api-key-here'
3. Install dependencies
Server component:
cd server_weather/
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Client component:
cd ../client_weather_openai/
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

๐ŸŽฎ Usage

Start the MCP Server
cd server_weather/
source venv/bin/activate
python server_weather.py
Start the OpenAI Client
cd client_weather_openai/
source venv/bin/activate
python weather_agent_openai.py
Example Usage
What's the weather in New York today?

๐Ÿ—๏ธ Architecture

The system uses the Model Context Protocol (MCP) to enable seamless communication between the AI agent and the weather service:

User ---> OpenAI Agent (Client) ---> MCP Server ---> Weather Data

๐Ÿ“ License

This project is open-source and available under the MIT License.


๐Ÿค Contributing

Contributions, issues, and feature requests are welcome!

  1. Fork the project.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add your feature').
  5. Push to your branch (git push origin feature/your-feature).
  6. Open a pull request.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.