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.1.tar.gz (1.9 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.1-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: weather_mcp_x-0.1.1.tar.gz
  • Upload date:
  • Size: 1.9 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.1.tar.gz
Algorithm Hash digest
SHA256 b4c4dc7cb0d7ab3c071003575949a60d1fa171c8e447ce48881be3ecf538a27b
MD5 4b2cd228351f185eeb23549a7f6d8f40
BLAKE2b-256 ba55fcf3856b45f7cc2ceb8ec3baf33463fb06511addc101e86c3945a8e0512c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: weather_mcp_x-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3daeab1fb0b56df587486dd62e874d8ec26b7fddb083641986bc9c55d8df437
MD5 eb1b6369f052c937a9d50ec36a89939e
BLAKE2b-256 0576b9077972b8111fb3ecc23e1d2841c60797e6dba3acf6b0cd7cc7f53f63ee

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