Weather MCP Server

Weather MCP Server

Provides real-time weather forecasts and alerts for US locations using the National Weather Service API, allowing users to query weather alerts by state and forecasts by coordinates.

Category
Visit Server

README

Weather MCP Server

A Model Context Protocol (MCP) server that provides real-time weather data and alerts for Claude for Desktop and other MCP clients. This server integrates with the US National Weather Service API to deliver accurate weather forecasts and severe weather alerts.

Table of contents

Introduction

Many language models like Claude lack access to real-time data such as weather forecasts and severe weather alerts. This MCP server solves that problem by providing a bridge between Claude for Desktop and the US National Weather Service API.

The server exposes two powerful tools:

  • Weather Alerts: Get active severe weather alerts for any US state
  • Weather Forecasts: Get detailed weather forecasts for any US location using coordinates

Built with TypeScript and the official MCP SDK, this server follows the Model Context Protocol specification and integrates seamlessly with Claude for Desktop and other MCP-compatible clients.

Features

  • 🌤️ Real-time Weather Data: Access current weather forecasts and alerts
  • 🚨 Severe Weather Alerts: Get active weather alerts by state
  • 📍 Location-based Forecasts: Get detailed forecasts using latitude/longitude coordinates
  • 🔧 MCP Compliant: Built using the official Model Context Protocol SDK
  • 🚀 Zero Configuration: No API keys required - uses free NWS API
  • 📦 Easy Installation: Simple npm/pnpm installation process
  • 🛡️ Error Handling: Robust error handling for network issues and invalid inputs
  • 🎯 TypeScript: Full TypeScript support with type safety

Installation

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm
  • TypeScript 5.0+

Installation Steps

  1. Clone the repository:

    git clone <repository-url>
    cd weather
    
  2. Install dependencies:

    pnpm install
    
  3. Build the project:

    pnpm build
    
  4. Test the server:

    pnpm start
    

You should see: Weather MCP Server running on stdio

Quick start

After installation, the server is ready to use with Claude for Desktop:

  1. Configure Claude for Desktop:

    macOS: Open the configuration file:

    code ~/Library/Application\ Support/Claude/claude_desktop_config.json
    

    Windows: Open the configuration file:

    code "%APPDATA%\Claude\claude_desktop_config.json"
    

    Add this configuration to your claude_desktop_config.json:

    {
      "mcpServers": {
        "weather": {
          "command": "node",
          "args": ["/path/to/weather/build/index.js"],
          "env": {}
        }
      }
    }
    

    Note: Replace /path/to/weather/build/index.js with the actual absolute path to your weather server build file.

  2. Restart Claude for Desktop

  3. Test the tools:

    • Ask Claude: "What are the weather alerts in California?"
    • Ask Claude: "What's the weather forecast for coordinates 40.7128, -74.0060?"

For Client Developers

If you're building your own MCP client, check out the MCP Quickstart for Client Developers to learn how to integrate with this weather server and other MCP servers.

Usage

Available Tools

get-alerts

Get weather alerts for a specific US state.

Parameters:

  • state (string): Two-letter state code (e.g., "CA", "NY", "TX")

Example:

{
  "name": "get-alerts",
  "kwargs": {
    "state": "CA"
  }
}

get-forecast

Get weather forecast for a specific location using coordinates.

Parameters:

  • latitude (number): Latitude coordinate (-90 to 90)
  • longitude (number): Longitude coordinate (-180 to 180)

Example:

{
  "name": "get-forecast", 
  "kwargs": {
    "latitude": 40.7128,
    "longitude": -74.0060
  }
}

Sample Outputs

Weather Alerts:

Active alerts for CA:

Event: Severe Thunderstorm Warning
Area: Los Angeles County
Severity: Severe
Status: Actual
Headline: Severe Thunderstorm Warning issued for Los Angeles County
---

Weather Forecast:

Forecast for 40.7128, -74.0060:

Tonight:
Temperature: 45°F
Wind: 10 mph NW
Mostly clear with a low around 45°F
---

Tomorrow:
Temperature: 62°F  
Wind: 15 mph SW
Sunny with a high near 62°F
---

Configuration

Claude for Desktop Configuration

The server can be configured in Claude for Desktop's configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": ["/absolute/path/to/weather/build/index.js"],
      "env": {}
    }
  }
}

Environment Variables

No environment variables are required. The server uses the free US National Weather Service API which doesn't require authentication.

API Reference

National Weather Service API

This server integrates with the US National Weather Service API:

  • Base URL: https://api.weather.gov
  • Authentication: None required
  • Rate Limits: None specified
  • Coverage: United States only

Server Endpoints

The server exposes two MCP tools that internally call the NWS API:

  1. Alerts Endpoint: /alerts?area={state}
  2. Points Endpoint: /points/{lat},{lon}
  3. Forecast Endpoint: Dynamically retrieved from points response

Known issues and limitations

  • US Coverage Only: The National Weather Service API only covers the United States
  • Coordinate Precision: Coordinates are rounded to 4 decimal places for API compatibility
  • Network Dependency: Requires internet connection to access weather data
  • API Reliability: Depends on the NWS API availability and response times

Getting help

If you encounter issues:

  1. Check the logs: The server outputs error messages to stderr
  2. Verify coordinates: Ensure coordinates are within valid ranges
  3. Test connectivity: Verify internet connection and NWS API availability
  4. Check configuration: Ensure Claude for Desktop configuration is correct

For bugs or feature requests, please open an issue on the project repository.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Build and test: pnpm build && pnpm start
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to the branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Original Author and License

This example is based on the code explained in MCP Quickstart (github), whose license is CC-BY-4.0. The completed code examples are also hosted in this repo, whose license is MIT (Copyright (c) 2025 Model Context Protocol). So I've chosen the MIT license for this repo.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Model Context Protocol: For providing the excellent SDK and specification
  • US National Weather Service: For providing free, reliable weather data
  • Claude for Desktop: For implementing MCP client support
  • TypeScript Team: For the excellent type system and tooling
  • pnpm: For fast, efficient package management

Author: Mohamed Lakssir (thejokers69)
Version: 1.0.0
Last Updated: January 2025

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured