Skip to main content
Glama

Weather Query MCP Server

by eternachen

Weather Query MCP Server/Client Example

This project is a weather query client that interacts with an MCP (Model-Client-Protocol) server to fetch and display weather information for a specified city.

Features

  • Connects to an MCP server to list available tools.
  • Queries weather information for a specified city.
  • Displays formatted weather information including temperature, humidity, wind speed, and weather description.

Requirements

  • Python 3.8+
  • openai library
  • dotenv library
  • mcp library

Setup

  1. Clone the repository:
    git clone <repository_url> cd <repository_directory>
  2. Create a virtual environment and activate it:
    python -m venv .venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
  3. Install the required dependencies:
    pip install -r requirements.txt
  4. Create a .env file in the root directory and add your OpenAI API key and other configurations:
    OPENAI_API_KEY=<your_openai_api_key> BASE_URL=<your_base_url> MODEL=<your_model>

Usage

  1. Start the MCP server:
    python server.py
  2. Run the client and connect to the server:
    python client.py <path_to_server_script>
  3. Interact with the client:
    • Type the name of the city in English to get the weather information.
    • Type quit to exit the client.

Project Structure

  • server.py: Contains the MCP server implementation and weather query tool.
  • client.py: Contains the MCP client implementation to interact with the server.
  • .env: Environment variables for API keys and configurations.
  • .gitignore: Specifies files and directories to be ignored by git.
  • README.md: Project documentation.

License

This project is licensed under the MIT License.

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

An MCP server implementation that allows users to fetch and display weather information for specified cities, including temperature, humidity, wind speed, and weather descriptions.

  1. Features
    1. Requirements
      1. Setup
        1. Usage
          1. Project Structure
            1. License

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                An MCP server that provides real-time weather information including temperature, humidity, wind speed, and sunrise/sunset times through the OpenWeatherMap API.
                Last updated -
                1
                2
                Python
                MIT License
                • Linux
                • Apple
              • -
                security
                A
                license
                -
                quality
                An MCP server that connects to OpenWeatherMap's API to provide current weather data and multi-day forecasts for locations worldwide in different measurement units.
                Last updated -
                11
                TypeScript
                MIT License
              • A
                security
                F
                license
                A
                quality
                A simple MCP server that provides a tool to fetch current weather information for cities using the Open-Meteo API, communicating through stdin/stdout.
                Last updated -
                1
                2
                TypeScript
              • -
                security
                F
                license
                -
                quality
                An MCP server that provides weather information like forecasts and alerts for US locations using the National Weather Service API.
                Last updated -
                1
                JavaScript

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/eternachen/mcp-playground'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server