Skip to main content

Weather MCP Tool

一个基于MCP (Model Control Protocol) 的天气查询工具,可以获取美国各州的天气预警和指定位置的天气预报。

功能特点

  • 获取美国各州的实时天气预警信息
  • 根据经纬度获取详细的天气预报
  • 支持与Cline或Cursor-desktop等MCP客户端集成

安装

pip install weather-mcp

使用方法

在Cline或Cursor-desktop中使用

  1. 安装完成后,工具会自动注册到MCP客户端
  2. 可以通过以下方式调用工具:
# 获取加州的天气预警
await get_alerts("CA")

# 获取指定位置的天气预报(例如:旧金山)
await get_forecast(37.7749, -122.4194)

作为独立程序运行

from weather import get_alerts, get_forecast

# 获取天气预警
alerts = await get_alerts("NY")
print(alerts)

# 获取天气预报
forecast = await get_forecast(40.7128, -74.0060)
print(forecast)

API说明

get_alerts(state: str) -> str

获取指定州的天气预警信息。

  • 参数:
    • state: 两字母的美国州代码(例如:CA、NY)
  • 返回:格式化的天气预警信息字符串

get_forecast(latitude: float, longitude: float) -> str

获取指定位置的天气预报。

  • 参数:
    • latitude: 纬度
    • longitude: 经度
  • 返回:格式化的天气预报信息字符串

依赖

  • Python >= 3.11
  • httpx >= 0.28.1
  • mcp[cli] >= 1.6.0

许可证

MIT

Metadata

Release files for weather-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weather-mcp 0.1.1
File Size Uploaded
weather_mcp-0.1.1.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for weather-mcp 0.1.1
File Interpreter ABI Platform
weather_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.7 kB

Release files / weather_mcp-0.1.1.tar.gz

Download URL weather_mcp-0.1.1.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8ca4c9fe535b2d615c2d0d8f0072b50f6cb848a5ec15cb02c6869a34ced173a8
BLAKE2b-256 checksum
How to use checksums
7fef6ebc022276f958c2677bafe554d9bf69c13796160c6c2f28979edc53801f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.3

Release files / weather_mcp-0.1.1-py3-none-any.whl

Download URL weather_mcp-0.1.1-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e9afb54c45ea74e3ad7fbe23167175fedcf9570c082105a05144e041b53677e
BLAKE2b-256 checksum
How to use checksums
55a940d51cb29c62311fc73d1b460c8d4611e882ce8874aa1be0573225749fc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page