Back to MCP directory
publicPublicdnsLocal runtime

MCP

一个基于MCP框架的天气数据服务器,从美国国家气象局API获取天气警报和短期预报数据。

article

README

🚀 天气 MCP 服务器

本 MCP 服务器可从国家气象局 API 获取天气数据。它提供了两个实用工具,能帮助你轻松获取天气相关信息:

  • 及时掌握指定美国州(通过两位字母代码指定)的活跃天气警报。
  • 获取指定位置的短期天气预报。

🚀 快速开始

✨ 主要特性

  • get_alerts(state: str):返回指定美国州(使用其两位字母代码)的活跃天气警报。
  • get_forecast(latitude: float, longitude: float):返回指定位置的短期天气预报。

📦 安装指南

安装要求

  • Python 3.7+
  • httpx
  • MCP 框架 mcp[cli]

安装命令

使用以下命令进行安装:

uv add mcp[cli] httpx requests

💻 使用示例

基础用法

使用以下命令运行服务器:

uv run weather.py

该服务器使用标准输入输出进行通信。

📚 详细文档

MCP 客户端配置

在你的 MCP 客户端配置文件(config.json)中添加以下内容片段:

{
  "mcpServers": {
    "weather": {
      "command": "C:/path/to/your/uv",
      "args": [
        "--directory",
        "C:/path/to/your/project",
        "run",
        "weather.py"
      ]
    }
  }
}
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client