Skip to main content

A weather information tool based on FastMCP framework with support for Chinese city weather alerts

Project description

Weather-X 天气查询工具

Weather-X 是一个基于 FastMCP 框架开发的天气查询工具,可以获取中国各城市的天气信息和警报。

功能特性

  • 获取指定城市的天气信息
  • 查询天气警报
  • 基于高德地图天气API实现
  • 支持异步请求处理

安装

pip install weather-x

或从源码安装:

git clone <repository-url>
cd weather-x
pip install -e .

使用方法

from weather import mcp

# 运行MCP服务器
mcp.run(transport='stdio')

或直接运行:

python main.py

API接口

get_alerts(city: str) -> str

获取指定城市的天气警报信息。

参数:

  • city: 城市名称(例如:北京、上海)

返回:

  • 包含天气信息的字符串

依赖

  • Python >= 3.12
  • fastmcp >= 2.12.4
  • httpx >= 0.28.1
  • mcp[cli] >= 1.18.0

配置

项目使用高德地图天气API,需要在代码中配置API密钥。

开发

安装开发依赖:

pip install -e ".[dev]"

许可证

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

weather_mcp_x-0.1.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

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

weather_mcp_x-0.1.2-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file weather_mcp_x-0.1.2.tar.gz.

File metadata

  • Download URL: weather_mcp_x-0.1.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for weather_mcp_x-0.1.2.tar.gz
Algorithm Hash digest
SHA256 555d951280971b316cb16cbf24216d16483b6aede640330d56861df2d24e2f87
MD5 4cdcda65fae670a3289bedc22168bedb
BLAKE2b-256 50cf64a5e2f4d6a07912b4d4c43d5bf4dad8e905d8e63dbedc665a9988dd6489

See more details on using hashes here.

File details

Details for the file weather_mcp_x-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: weather_mcp_x-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for weather_mcp_x-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 200b53b629de652aa39bf10ae7e89b94b8bfe4ac5bb00962d3da5fb6f5d3b8b7
MD5 46582705b98381c4a7bcd36867ccf6fd
BLAKE2b-256 bc17112928e43e383516e119e5bdbe57e6dd4ed6d1d63518a1a9e3a24ddc44c6

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