Weather Server

Weather Server

Provides access to weather alerts and forecasts for US locations using the National Weather Service public APIs.

Category
访问服务器

README

weather — Enhanced MCP Weather Server

<img width="1123" height="869" alt="Screenshot 2025-11-15 at 6 37 38 PM" src="https://github.com/user-attachments/assets/717f5316-8553-4d96-a139-93d56ba17b3e" />

<img width="318" height="245" alt="Screenshot 2025-11-15 at 7 23 28 PM" src="https://github.com/user-attachments/assets/ac1a0203-d479-4a26-aa33-1392c84f2f1b" />

A feature-rich MCP (Model Context Protocol) server that provides comprehensive weather data using the NWS (National Weather Service) public APIs. Includes input validation, error handling, geocoding, and a unique weather comparison feature.

Quick start

  1. Install uv (macOS / Linux):
curl -LsSf https://astral.sh/uv/install.sh | sh
# restart your terminal
  1. Create project, venv and install deps:
uv init weather
cd weather
uv venv
source .venv/bin/activate
uv add "mcp[cli]" httpx
  1. Run the server:
uv run main.py
# or
uv run weather.py

Available Tools

The server provides the following MCP tools:

1. get_alerts(state: str)

Get active weather alerts for a US state.

  • Input: Two-letter US state code (e.g., "CA", "NY", "TX")
  • Features: Validates state codes, provides detailed alert information

2. get_forecast(latitude: float, longitude: float)

Get detailed weather forecast for a location using coordinates.

  • Input: Latitude (-90 to 90) and Longitude (-180 to 180)
  • Features: 10-period forecast (5 days), includes humidity and precipitation probability

3. get_forecast_by_city(city_name: str)

Get weather forecast by city name (no coordinates needed!).

  • Input: City name (e.g., "San Francisco", "New York", "Chicago")
  • Features: Automatic geocoding, works with city names

4. get_current_conditions(latitude: float, longitude: float)

Get real-time current weather conditions.

  • Input: Latitude and Longitude
  • Features: Temperature, humidity, wind, pressure, visibility, and more

5. compare_weather(location1: str, location2: str)

Compare weather conditions between two locations side-by-side.

  • Input: Two locations (city names or "lat,lon" format)
  • Features: Side-by-side comparison, temperature difference analysis, supports both city names and coordinates

Features

  • Input Validation: Validates state codes and coordinate ranges
  • Better Error Handling: Specific, helpful error messages
  • Geocoding Support: Search by city name using Open-Meteo geocoding API
  • Current Conditions: Real-time weather observations
  • Enhanced Forecasts: More detailed information including humidity and precipitation
  • Weather Comparison: Unique feature to compare two locations
  • Location Detection: Automatically detects and displays city/state names

Files

  • weather.py — Main MCP server implementation with all tools
  • main.py — Entry point that imports and runs the server

Notes

  • Python 3.11+ required (see pyproject.toml)
  • NWS Coverage: The NWS API only covers US territories. International locations will not work.
  • Transport: The server uses stdio transport by default
  • MCP Clients: Use Claude Desktop, mcp CLI, or another MCP client to connect
  • Geocoding: City name search uses Open-Meteo's free geocoding API (no API key required)

Example Usage

Once connected to an MCP client, you can use the tools like:

# Get alerts for California
get_alerts("CA")

# Get forecast by city name
get_forecast_by_city("San Francisco")

# Get current conditions
get_current_conditions(37.7749, -122.4194)

# Compare weather between two cities
compare_weather("New York", "Los Angeles")

License

Apache License 2.0 — see LICENSE. Replace the placeholder year/name in LICENSE if needed.


推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选