Skip to main content
Glama

Weather MCP Server

by akaramanapp

天气 MCP 服务器

一个模型上下文协议 (MCP) 服务器,使用国家气象局 (NWS) API 提供美国各地的天气信息和警报。该服务器旨在供 AI 代理通过模型上下文协议使用。

特征

  • 获取美国任何州天气警报的工具
  • 使用坐标获取美国任何地点详细天气预报的工具
  • 支持温度、风力状况和简短预报描述
  • 来自国家气象局的实时数据

先决条件

  • Node.js(v16 或更高版本)
  • npm 或 yarn 包管理器

安装

  1. 克隆存储库:
git clone https://github.com/akaramanapp/weather-mcp-server.git cd weather-mcp-server
  1. 安装依赖项:
npm install
  1. 构建应用程序:
npm run build

MCP 工具

服务器提供了两个可供AI代理使用的MCP工具:

获取警报

获取特定美国州的天气警报。

参数:

  • state :两个字母的州代码(例如 CA、NY)

响应示例:

{ "content": [ { "type": "text", "text": "Active alerts for CA: ..." } ] }

获取预测

使用坐标获取特定位置的天气预报。

参数:

  • latitude :位置的纬度(-90 到 90)
  • longitude :位置经度(-180 至 180)

响应示例:

{ "content": [ { "type": "text", "text": "Morning: Temperature: 72°F, Wind: 5mph NW, Partly cloudy..." } ] }

项目结构

weather/ ├── src/ │ └── index.ts # Main server code with MCP tool implementations ├── build/ # Compiled JavaScript files ├── package.json # Project dependencies and scripts └── tsconfig.json # TypeScript configuration

技术细节

  • 使用 TypeScript 构建
  • 实现模型上下文协议(MCP)服务器
  • 使用@modelcontextprotocol/sdk 实现 MCP 服务器
  • 与国家气象局 (NWS) API 接口
  • ES2022 目标与 Node16 模块解析

发展

要修改或扩展服务器:

  1. src/index.ts文件中进行更改
  2. 重建应用程序:
npm run build

依赖项

  • @modelcontextprotocol/sdk:MCP服务器实现框架
  • zod:工具参数的运行时类型检查和验证
  • TypeScript:类型安全的开发依赖关系

执照

国际学习中心

笔记

  • 该服务器仅适用于美国地区,因为它使用国家气象局 API
  • API 请求有速率限制,并且需要 User-Agent 标头
  • 所有坐标均应采用十进制度格式
  • 这不是一个独立的 CLI 应用程序,而是一个通过模型上下文协议为 AI 代理提供工具的服务器
Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

模型上下文协议服务器为 AI 代理提供工具,使用国家气象局 API 检索美国各地的天气警报和详细预报。

  1. 特征
    1. 先决条件
      1. 安装
        1. MCP 工具
          1. 获取警报
          2. 获取预测
        2. 项目结构
          1. 技术细节
            1. 发展
              1. 依赖项
                1. 执照
                  1. 笔记

                    Related MCP Servers

                    • -
                      security
                      -
                      license
                      -
                      quality
                      Provides a Model Context Protocol server that enables large language models to query and retrieve real-time weather forecasts for cities and regions across China.
                      Last updated -
                      Python
                    • A
                      security
                      F
                      license
                      A
                      quality
                      A Model Context Protocol server that provides comprehensive weather data querying capabilities based on the Caiyun Weather API, supporting real-time weather, forecasts, and alerts with multi-language support.
                      Last updated -
                      7
                      2
                      TypeScript
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A customizable Model Context Protocol server implementation that enables AI models to interact with external tools including weather queries, Google search, and camera control functionality.
                      Last updated -
                      8
                      Python
                      Apache 2.0
                      • Linux
                      • Apple
                    • -
                      security
                      -
                      license
                      -
                      quality
                      A Model Context Protocol server that provides current weather information and 3-day forecasts for specified cities using the Open-Meteo API.
                      Last updated -
                      Python

                    View all related MCP servers

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/akaramanapp/weather-mcp-server'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server