Skip to main content
Glama
Kaushik2105

mcp-weather

by Kaushik2105

🌀️ Kaushik's Weather MCP Server

TypeScript Model Context Protocol Node.js Tests Claude Verified License: ISC

A production-ready Model Context Protocol (MCP) server built in TypeScript, connecting LLMs (such as Claude Desktop, Cursor, and custom AI agents) to real-time National Weather Service (NWS / NOAA) meteorological data.


πŸ”— Live Proof of Integration

πŸš€ Verified Working with Claude Desktop: Check out the live chat session demonstrating real-time forecast retrieval, alerts, and health diagnostics:
πŸ‘‰ View Live Claude AI Chat Proof


Related MCP server: mcp-weather

✨ Architectural Highlights

  • πŸ—οΈ Modular Clean Architecture: Decoupled into dedicated service layers (CacheService, RateLimiterService, NwsClient, Logger, Formatter).

  • πŸ“‘ Official Meteorological Bulletins: Structured weather reports with standardized metadata and provider attribution.

  • ⚑ In-Memory Caching (5-Min TTL): Thread-safe in-memory cache reducing upstream API traffic by up to 80%.

  • πŸ›‘οΈ Zero-Vibe Security Layer: Strict input sanitization, XSS entity escaping, and client-isolated rate limiting (100 req/min).

  • πŸ” Resilience & Fault Tolerance: Automated exponential backoff retries for HTTP 5xx / 429 errors and request timeout guards.

  • 🩺 Observability & Diagnostics: Built-in health_check, get_metrics, and clear_cache tools with structured JSON logging.


πŸ“ Project Structure

weather/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ config/          # Central configuration & runtime constants
β”‚   β”œβ”€β”€ services/        # Core business logic (Cache, RateLimiter, NwsClient, Formatter, Logger)
β”‚   β”œβ”€β”€ tools/           # MCP Tool handlers (alerts, forecast, diagnostics)
β”‚   β”œβ”€β”€ types/           # Strongly typed TypeScript interfaces
β”‚   β”œβ”€β”€ utils/           # Input sanitization and security helpers
β”‚   └── index.ts         # Server bootstrap, transport initialization & graceful shutdown
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ unit/            # Unit test suites (utils, sanitizer, cache)
β”‚   β”œβ”€β”€ integration/     # Upstream NWS API integration & retry tests
β”‚   β”œβ”€β”€ performance/     # Cache throughput & rate-limiting load tests
β”‚   β”œβ”€β”€ security/        # XSS, injection prevention & boundary tests
β”‚   └── basic.test.ts    # Comprehensive test runner
β”œβ”€β”€ build/               # Compiled ES module JavaScript distribution
β”œβ”€β”€ package.json
└── tsconfig.json

πŸ› οΈ MCP Tools

Tool

Parameters

Description

get_forecast

latitude (number), longitude (number)

Retrieves real-time period forecasts (temperatures, winds, conditions) for US coordinates.

get_alerts

state (2-letter US code, e.g. CA, NY, TX)

Fetches active severe weather alerts, warnings, and meteorological advisories.

health_check

None

Returns runtime health, uptime, heap memory usage, cache size, and API connection status.

get_metrics

None

Outputs performance diagnostics and active rate-limit client buckets.

clear_cache

None

Flushes the in-memory cache and returns the number of purged entries.


πŸš€ Getting Started

1. Clone & Install

git clone https://github.com/Kaushik2105/mcp-weather.git
cd mcp-weather
npm install

2. Build

npm run build

3. Run Test Suite

npm test

πŸ”Œ Connecting to Claude Desktop

Add this configuration to your Claude Desktop configuration file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "kaushik-weather": {
      "command": "node",
      "args": [
        "c:/Workholic/LawSikho/POCs/weather/weather/build/index.js"
      ]
    }
  }
}

Note: Restart Claude Desktop after saving the configuration.


πŸ’¬ Sample Prompts for Claude

  • "Show me the official forecast bulletin from Kaushik's weather tool for Los Angeles (Lat: 34.0522, Lon: -118.2437)"

  • "Are there any active weather alerts for Florida (FL)?"

  • "Run a health check diagnostic on Kaushik's weather MCP server."


πŸ‘¨β€πŸ’» Author

Kaushik Karmakar

Related MCP Connectors

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    Provides real-time US weather alerts and forecasts by integrating with the National Weather Service API. It enables AI assistants to fetch state-specific alerts and detailed local forecasts using geographic coordinates.
    2
    1
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides real-time weather alerts and forecasts from the National Weather Service for US locations, integrating with AI assistants via the Model Control Protocol.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides real-time weather alerts and forecasts for US locations by integrating with the National Weather Service API. Supports both server and client interactions with optional LLM summarization.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides weather forecasts and alerts for US locations via the National Weather Service API, enabling AI assistants to deliver real-time weather information.
    8 npm
    -