Skip to main content

A MCP server for querying current weather and forecasts via OpenWeatherMap API

Project description

accton-mcpdemo-weather

一个基于 MCP (Model Context Protocol) 的天气查询服务器,通过 OpenWeatherMap API 提供实时天气和未来天气预报。

功能

  • 🌍 查询全球城市的当前实时天气(温度、湿度、风速、气压、日出日落等)
  • 📅 查询未来 5 天的天气预报(每 3 小时一个时段,含降水概率)
  • 🌐 支持中文和英文城市名称

安装

pip install accton-mcpdemo-weather

配置

使用前需要设置环境变量:

export OPENWEATHER_API_KEY="your-api-key"

OpenWeatherMap 注册即可免费获取 API Key。

使用

命令行运行

accton-mcpdemo-weather

作为 MCP Server 配置

在 Claude Desktop 或其他 MCP 客户端的配置文件中添加:

{
  "mcpServers": {
    "weather": {
      "command": "uvx",
      "args": ["accton-mcpdemo-weather"],
      "env": {
        "OPENWEATHER_API_KEY": "your-api-key"
      }
    }
  }
}

提供的工具

工具 说明
get_current_weather 获取指定城市的当前实时天气
get_weather_forecast 获取指定城市未来某天的天气预报
get_weather 综合查询:不传日期返回当前天气,传日期返回预报

开发

# 克隆仓库
git clone https://github.com/your-repo/accton-mcpdemo-weather.git
cd accton-mcpdemo-weather

# 安装依赖
uv sync

# 运行
uv run accton-mcpdemo-weather

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

accton_mcpdemo_weather-0.1.9.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

accton_mcpdemo_weather-0.1.9-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file accton_mcpdemo_weather-0.1.9.tar.gz.

File metadata

  • Download URL: accton_mcpdemo_weather-0.1.9.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for accton_mcpdemo_weather-0.1.9.tar.gz
Algorithm Hash digest
SHA256 0f65edd815f429df9a667b0132fcfb1d98bf88187be21a59e6734259068bec9d
MD5 95f798b67bcf9a622cb4001d83fc1706
BLAKE2b-256 bcfafac0035b49d97e71428c2a665d84a40d660662f5a8ac54cf3d79e744cf43

See more details on using hashes here.

File details

Details for the file accton_mcpdemo_weather-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: accton_mcpdemo_weather-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for accton_mcpdemo_weather-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 8a0cbf3c079e4fd8a2aced3b6255d8ec295f425acf4451128f33f665fda689b2
MD5 6ac15d902862a10acedf093d2b14db44
BLAKE2b-256 f7223886a23ab669a5e1354dbc3141851c71fa9c4811370eed25b9718846db57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page