Node.js MCP Weather Server

Node.js MCP Weather Server

An MCP server that provides weather information like forecasts and alerts for US locations using the National Weather Service API.

Category
Visit Server

README

Node.js MCP Weather Server with Azure Deployment

A Model Context Protocol (MCP) server built with Express.js and Node.js that provides weather information using the National Weather Service API. Ready for deployment to Azure App Service with Azure Developer CLI (azd).

🌟 Features

  • Express.js Framework: Fast, unopinionated web framework for Node.js
  • MCP Protocol Compliance: Full support for JSON-RPC 2.0 MCP protocol
  • HTTP Transport: HTTP-based communication for web connectivity
  • Weather Tools:
    • get_alerts: Get weather alerts for any US state
    • get_forecast: Get detailed weather forecast for any location
  • Azure Ready: Pre-configured for Azure App Service deployment
  • Web Test Interface: Built-in HTML interface for testing
  • National Weather Service API: Real-time weather data from official US government source

🚀 Quick Deploy to Azure

Prerequisites

Deploy in 3 Commands

# 1. Login to Azure
azd auth login

# 2. Initialize the project
azd init

# 3. Deploy to Azure
azd up

After deployment, your MCP server will be available at:

  • Health Check: https://<your-app>.azurewebsites.net/health
  • MCP Capabilities: https://<your-app>.azurewebsites.net/mcp/capabilities
  • Test Interface: https://<your-app>.azurewebsites.net/test

🧪 Test the Live Server

Once deployed, test the weather tools:

# Get weather alerts for California
curl -X POST "https://<your-app>.azurewebsites.net/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "get_alerts", "arguments": {"state": "CA"}}}'

# Get weather forecast for San Francisco
curl -X POST "https://<your-app>.azurewebsites.net/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "get_forecast", "arguments": {"latitude": 37.7749, "longitude": -122.4194}}}'

💻 Local Development

Prerequisites

  • Node.js 22+ (or Node.js 18+)
  • npm (Node Package Manager)

Setup & Run

  1. Clone and install dependencies:

    git clone <your-repo-url>
    cd remote-mcp-webapp-node
    npm install
    
  2. Start the development server:

    npm run dev
    
  3. Access the server:

    • Server: http://localhost:8000
    • Health Check: http://localhost:8000/health
    • Test Interface: http://localhost:8000/test

🏗️ Architecture

  • server.js: Main Express application with MCP protocol implementation
  • infra/: Azure Bicep templates for infrastructure as code
  • azure.yaml: Azure Developer CLI configuration
  • public/: Static assets for the web test interface

⚙️ Configuration

The server uses these environment variables:

  • PORT: Server port (default: 8000)
  • NODE_ENV: Environment mode (default: development)

Azure App Service automatically configures:

  • Node.js 22 runtime
  • Premium v3 (P0V3) App Service Plan
  • Health check monitoring

🔌 MCP Integration

Connect to MCP Inspector

Use this configuration to connect to your deployed server:

{
  "mcpServers": {
    "weather-server": {
      "transport": {
        "type": "http",
        "url": "https://<your-app>.azurewebsites.net/mcp"
      },
      "name": "Weather MCP Server",
      "description": "Weather forecast and alerts tools"
    }
  }
}

For local development, use http://localhost:8000/mcp.

🛠️ API Endpoints

  • GET /health - Server health check
  • GET /mcp/capabilities - MCP server capabilities
  • POST /mcp - Main MCP JSON-RPC endpoint
  • GET /test - Web test interface

📖 Available Tools

get_alerts

Get weather alerts for any US state.

Parameters:

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

get_forecast

Get detailed weather forecast for any location.

Parameters:

  • latitude (number): Latitude coordinate
  • longitude (number): Longitude coordinate

🧪 Testing

Web Interface

Visit /test endpoint for an interactive testing interface.

Command Line

# List available tools
curl -X POST "http://localhost:8000/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}'

# Get weather forecast
curl -X POST "http://localhost:8000/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "get_forecast", "arguments": {"latitude": 37.7749, "longitude": -122.4194}}, "id": 2}'

🌦️ Data Source

This server uses the National Weather Service (NWS) API:

  • Real-time weather alerts and warnings
  • Detailed weather forecasts
  • Official US government weather data
  • No API key required
  • High reliability and accuracy

� Development Scripts

npm run dev         # Start development server with auto-reload
npm start          # Start production server
npm test           # Run test client against local server

📂 Project Structure

remote-mcp-webapp-node/
├── server.js              # Main Express.js server with MCP implementation
├── test-client.js         # MCP protocol test client
├── package.json           # Dependencies and scripts
├── azure.yaml             # Azure Developer CLI configuration
├── infra/                 # Azure Bicep infrastructure templates
├── public/                # Static web assets
└── README.md              # This documentation

🤝 Contributing

This is a sample project demonstrating MCP server implementation with Azure deployment. Feel free to:

  • Fork and customize for your needs
  • Add new MCP tools
  • Improve the Azure deployment template
  • Submit issues and suggestions

Ready to deploy? Run azd up and have your MCP weather server live on Azure in minutes! 🚀

� License

MIT License - feel free to use this project for your own applications.

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