天气数据服务

提供美国国家气象局(NWS)的实时天气警报和短期天气预报服务的MCP服务器。

  • by rsys-vtiwari
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 rsys-vtiwari/weather-mcp

使用说明

气象MCP服务器

MCP服务器提供:

  • 美国国家气象局(NWS)通过两个字母的州代码发出主动警报
  • 纬度/经度坐标的短期点预测(未来5个周期)

数据来源于公共NWS APIhttps://api.weather.gov.

工具

工具 描述 输入
get_alerts 获取美国某个州的活跃NWS警报 state (字符串,两个字母的代码)
get_forecast 获取坐标的短期预测(未来5个周期) latitude (数字), longitude (编号)

用法(本地)

安装依赖项:

pip install .

运行MCP服务器(stdio传输):

python -m weather.weather

您的MCP客户端应配置为通过包入口点或上述模块路径启动服务器。

服务器JSON摘要

看 server.json 用于注册表元数据,包括名称、版本、工具和入口点配置。

发布步骤(概述)

  1. 使用发布者(GitHub命名空间)进行身份验证:
    mcp-publisher login github
    
  2. 创建并将repo推送到GitHub(见下面的步骤)。
  3. (可选)如果作为包分发,则发布到PyPI。
  4. 发布到MCP注册表:
    mcp-publisher publish
    
  5. 验证:
    curl "https://registry.modelcontextprotocol.io/v0/servers?search=io.github.vtiwari/weather-mcp"
    

创建并推送GitHub存储库

如果此目录还不是git repo:

git init
git add .
git commit -m "Initial commit: Weather MCP server"

创建仓库(GitHub CLI)并推送:

gh repo create vtiwari/weather-mcp --public --source . --remote origin --push

如果不使用GitHub CLI,请通过GitHub web UI手动创建仓库,然后:

git remote add origin https://github.com/vtiwari/weather-mcp.git
git branch -M main
git push -u origin main

标记版本以保持发布一致性:

git tag v0.1.0
git push origin v0.1.0

PyPI包装(可选)

要通过PyPI分发,请确保 pyproject.toml 包括构建后端和元数据(作者、许可证)。然后:

pip install build twine
python -m build
twine upload dist/*

许可证

MIT(如果不同,请进行调整)。

免责声明

此服务器使用公共NOAA/NWS端点。遵守API使用指南和费率限制。