Skip to main content
Glama

Weather MCP Server

Apache 2.0
16
  • Linux
  • Apple

天气 MCP 服务器

使用 Open-Meteo API 提供天气信息的模型上下文协议 (MCP) 服务器。

特征

  • 获取指定城市的当前天气信息。

安装

Pip 安装和使用,可以使用 pip 安装此包:

pip install mcp_weather_server

该服务器设计为通过将其配置添加到cline_mcp_settings.json文件来手动安装。

  1. 将以下条目添加到cline_mcp_settings.json文件中的mcpServers对象:
{ "mcpServers": { "weather": { "command": "python", "args": [ "-m", "mcp_weather_server" ], "disabled": false, "autoApprove": [] } } }
  1. 保存cline_mcp_settings.json文件。

配置

此服务器不需要 API 密钥。它使用免费且开源的 Open-Meteo API。

用法

该服务器提供了几个工具: get_weatherget_weather_by_datetime_rangeget_current_datetime

get_weather

检索给定城市的当前天气信息。

参数:

  • city (字符串,必需):城市名称。

例子:

要获取台北的天气,您可以使用如下工具:

<use_mcp_tool> <server_name>weather</server_name> <tool_name>get_weather</tool_name> <arguments> { "city": "Taipei" } </arguments> </use_mcp_tool>

get_weather_by_datetime_range

检索开始日期和结束日期之间指定城市的天气信息。

参数:

  • city (字符串,必需):城市名称。
  • start_date (字符串,必需):开始日期,格式为 YYYY-MM-DD(ISO 8601)。
  • end_date (字符串,必需):结束日期,格式为 YYYY-MM-DD(ISO 8601)。

例子:

要获取 2024 年 1 月 1 日至 2024 年 1 月 7 日期间伦敦的天气,您可以使用如下工具:

<use_mcp_tool> <server_name>weather</server_name> <tool_name>get_weather_by_datetime_range</tool_name> <arguments> { "city": "London", "start_date": "2024-01-01", "end_date": "2024-01-07" } </arguments> </use_mcp_tool>

get_current_datetime

检索指定时区的当前时间。

参数:

  • timezone_name (字符串,必需):IANA 时区名称(例如,“America/New_York”、“Europe/London”)。如果用户未提供时区,则使用 UTC 时区。

例子:

要获取纽约的当前时间,您可以使用如下工具:

<use_mcp_tool> <server_name>weather</server_name> <tool_name>get_current_datetime</tool_name> <arguments> { "timezone_name": "America/New_York" } </arguments> </use_mcp_tool>

对于开发人员

运行 Python 之前更改工作目录

python -m mcp_weather_server

或者,如果您希望 Python 不管从哪里运行都能找到您的包,您可以设置 PYTHONPATH:

set PYTHONPATH=C:\xxx\mcp_weather_server\src python -m mcp_weather_server
Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

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.

模型上下文协议服务器使用 Open-Meteo API 检索指定城市的当前天气信息,无需 API 密钥。

  1. 特征
    1. 安装
      1. 配置
        1. 用法
          1. get_weather
          2. get_weather_by_datetime_range
          3. get_current_datetime
        2. 对于开发人员

          Related MCP Servers

          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol server that provides current weather information and 3-day forecasts for specified cities using the Open-Meteo API.
            Last updated -
            Python
          • -
            security
            F
            license
            -
            quality
            A production-ready Model Context Protocol server that provides weather data from OpenWeatherMap API, allowing users to query current weather by city name or coordinates with support for different temperature units.
            Last updated -
            Python
            • Apple
            • Linux
          • A
            security
            A
            license
            A
            quality
            A Model Context Protocol server that provides comprehensive weather data and forecasts through the OpenWeatherMap API, enabling AI assistants to access real-time weather information, forecasts, air quality data, and location services.
            Last updated -
            11
            10
            JavaScript
            MIT License
          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol server that interfaces with OpenWeatherMap API to provide real-time weather information and forecasts for cities worldwide.
            Last updated -
            Python

          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/isdaniel/mcp_weather_server'

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