Weather MCP Server

Weather MCP Server

Provides weather information tools including alerts for US states and forecasts by coordinates using the National Weather Service API. Uses streamable HTTP transport for scalable, multi-session connections.

Category
Visit Server

README

Weather MCP Server

A Node.js Model Context Protocol (MCP) server that provides weather information tools using Streamable HTTP Transport.

Features

  • get-alerts: Get weather alerts for a US state
  • get-forecast: Get weather forecast for a location using latitude/longitude coordinates
  • HTTP Transport: Uses streamable HTTP instead of stdio for better scalability
  • Session Management: Supports multiple concurrent client sessions
  • Health Check: Built-in health monitoring endpoint

Setup

  1. Install dependencies:
npm install
  1. Build the TypeScript code:
npm run build
  1. Start the HTTP server:
npm start

The server will start on port 3000 by default.

Usage

This server implements the Model Context Protocol using HTTP transport. It provides:

  • MCP Endpoint: http://localhost:3000/mcp
  • Health Check: http://localhost:3000/health

get-alerts

Get weather alerts for a US state.

Parameters:

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

HTTP Example:

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -H "mcp-session-id: your-session-id" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "get-alerts",
      "arguments": {
        "state": "CA"
      }
    }
  }'

get-forecast

Get weather forecast for a location using coordinates.

Parameters:

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

HTTP Example:

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -H "mcp-session-id: your-session-id" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "get-forecast",
      "arguments": {
        "latitude": 40.7128,
        "longitude": -74.0060
      }
    }
  }'

MCP Client Configuration

Use this configuration in your MCP client:

{
  "mcpServers": {
    "weather": {
      "transport": {
        "type": "http",
        "url": "http://localhost:3000/mcp"
      }
    }
  }
}

Development

  • Run in development mode:
npm run dev
  • Test the server:
npm test
  • Health check:
curl http://localhost:3000/health

Transport Features

  • Session Management: Each client gets a unique session ID
  • Concurrent Connections: Multiple clients can connect simultaneously
  • Server-Sent Events: Real-time notifications via GET requests
  • Session Termination: Clean session cleanup via DELETE requests
  • DNS Rebinding Protection: Disabled for local development (enable in production)

Security Note

For production deployments, enable DNS rebinding protection:

// In src/index.ts
enableDnsRebindingProtection: true,
allowedHosts: ['your-domain.com'],
allowedOrigins: ['https://your-domain.com'],

Environment Variables

  • PORT: Server port (default: 3000)

API Endpoints

  • POST /mcp: Main MCP communication endpoint
  • GET /mcp: Server-to-client notifications (SSE)
  • DELETE /mcp: Session termination
  • GET /health: Health check endpoint

Requirements

  • Node.js 18 or higher
  • TypeScript 5.5 or higher
  • Internet connection for weather API access

Directory Structure

weather-server/
├── src/
│   └── index.ts          # Main HTTP server implementation
├── dist/                 # Compiled JavaScript output
├── package.json          # Node.js dependencies and scripts
├── tsconfig.json         # TypeScript configuration
├── test.js              # HTTP client test script
├── mcp-config.json      # MCP client configuration
└── README.md            # This file

Requirements

  • Node.js 18 or higher
  • TypeScript 5.5 or higher
  • Internet connection for weather API access

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
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
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
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