Skip to main content

A weather query tool based on MCP (Model Control Protocol)

Project description

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: weather_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for weather_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8ca4c9fe535b2d615c2d0d8f0072b50f6cb848a5ec15cb02c6869a34ced173a8
MD5 0338d88974f074548089d0f219059362
BLAKE2b-256 7fef6ebc022276f958c2677bafe554d9bf69c13796160c6c2f28979edc53801f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: weather_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for weather_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e9afb54c45ea74e3ad7fbe23167175fedcf9570c082105a05144e041b53677e
MD5 41ac28cb2077f572ea12a7515f469d78
BLAKE2b-256 55a940d51cb29c62311fc73d1b460c8d4611e882ce8874aa1be0573225749fc5

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