Skip to main content
Glama

Weather Query MCP Server

by eternachen

天气查询 MCP 服务器/客户端示例

该项目是一个天气查询客户端,它与 MCP(模型客户端协议)服务器交互以获取并显示指定城市的天气信息。

特征

  • 连接到 MCP 服务器以列出可用的工具。
  • 查询指定城市的天气信息。
  • 显示格式化的天气信息,包括温度、湿度、风速和天气描述。

要求

  • Python 3.8+
  • openai
  • dotenv
  • mcp

设置

  1. 克隆存储库:
    git clone <repository_url> cd <repository_directory>
  2. 创建虚拟环境并激活它:
    python -m venv .venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
  3. 安装所需的依赖项:
    pip install -r requirements.txt
  4. 在根目录中创建一个.env文件并添加您的 OpenAI API 密钥和其他配置:
    OPENAI_API_KEY=<your_openai_api_key> BASE_URL=<your_base_url> MODEL=<your_model>

用法

  1. 启动 MCP 服务器:
    python server.py
  2. 运行客户端并连接服务器:
    python client.py <path_to_server_script>
  3. 与客户互动:
    • 输入英文城市名称即可获取天气信息。
    • 输入quit退出客户端。

项目结构

  • server.py :包含 MCP 服务器实现和天气查询工具。
  • client.py :包含与服务器交互的 MCP 客户端实现。
  • .env :API 密钥和配置的环境变量。
  • .gitignore :指定 git 要忽略的文件和目录。
  • README.md :项目文档。

执照

该项目已获得 MIT 许可。

-
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.

MCP 服务器实现允许用户获取和显示指定城市的天气信息,包括温度、湿度、风速和天气描述。

  1. 特征
    1. 要求
      1. 设置
        1. 用法
          1. 项目结构
            1. 执照

              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
                Python
                MIT License
                • Linux
                • Apple
              • -
                security
                F
                license
                -
                quality
                A simple MCP service that allows users to query weather conditions for cities worldwide through the Cursor AI assistant.
                Last updated -
                JavaScript
              • -
                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 -
                12
                TypeScript
                MIT License
              • A
                security
                F
                license
                A
                quality
                MCP server that provides Korean weather information using grid coordinates and the Korea Meteorological Administration API, allowing users to query current weather conditions and forecasts for specific locations in Korea.
                Last updated -
                2
                3
                Python
                • Apple
                • Linux

              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