Enables retrieving weather data through curl commands for current weather, forecasts, alerts, and location searches
Provides a fetch interface for JavaScript applications to access weather data including current conditions, forecasts, and alerts
Runs as a Node.js application with HTTP API endpoints for weather data, requiring Node.js 18 or later
Uses pnpm as the package manager for installation and dependency management
Developed with TypeScript, providing type-safe interfaces for weather data interaction
Weather MCP Server
A weather MCP (Model Context Protocol) server developed with TypeScript, providing simulated weather data and related functionality.
Features
- 🌤️ Get current weather information
- 📅 Multi-day weather forecast
- ⚠️ Weather alert system
- 🔍 Location search functionality
- 📊 Weather statistics
- 🎭 Mock data support
Install Dependencies
🚀 Usage
Installation and Build
Startup Methods
1. MCP Protocol (stdio)
2. HTTP API Server 🆕
3. Simple HTTP Server (Recommended) 🚀
Dynamic Port Support
The simple HTTP server supports dynamic port configuration:
The server will automatically:
- Use port 8080 as default if no port is specified
- Accept any valid port number as a command line argument
- Display the actual port in the startup message and documentation
HTTP API Usage Examples
Once the HTTP server is started, you can use it in the following ways:
Browser Access
- Open
http://localhost:8080
to view API documentation - Click links directly to test various APIs
curl Commands
JavaScript/Fetch
Development Mode
Available Tools
1. get_current_weather
Get current weather information for a specified location
Parameters:
location
(string): Location name
Example:
2. get_weather_forecast
Get weather forecast for a specified location
Parameters:
location
(string): Location namedays
(number, optional): Forecast days (1-7 days, default 3 days)
Example:
3. get_weather_alerts
Get weather alert information
Parameters:
location
(string, optional): Location name
Example:
4. search_locations
Search supported locations
Parameters:
query
(string): Search keyword
Example:
5. get_weather_stats
Get weather statistics
Parameters: None
Supported Locations
Currently supports detailed weather data for the following locations:
- Hong Kong
- Tokyo, Osaka, Kyoto, Hiroshima, Sapporo, Fukuoka (Japan)
- London (UK)
- New York (USA)
- Sydney (Australia)
Other locations will return randomly generated mock data.
Technical Specifications
- Language: TypeScript
- Package Manager: pnpm
- MCP SDK: @modelcontextprotocol/sdk
- Node.js: >=18
Project Structure
HTTP API Endpoints
Endpoint | Method | Parameters | Description |
---|---|---|---|
/ | GET | - | API documentation page |
/mcp | POST | JSON-RPC 2.0 | MCP protocol endpoint |
/weather | GET | location (required) | Get current weather |
/forecast | GET | location (required), days (optional) | Get weather forecast |
/alerts | GET | location (optional) | Get weather alerts |
/locations | GET | q (required) | Search locations |
/stats | GET | - | Get statistics |
License
MIT License
A TypeScript-based MCP server that provides simulated weather data including current conditions, forecasts, alerts, and location search functionality through both MCP protocol and HTTP API endpoints.
Related MCP Servers
- AsecurityAlicenseAqualityAn MCP server that provides real-time weather information including temperature, humidity, wind speed, and sunrise/sunset times through the OpenWeatherMap API.Last updated -1PythonMIT License
- -securityFlicense-qualityAn MCP server implementation that allows users to fetch and display weather information for specified cities, including temperature, humidity, wind speed, and weather descriptions.Last updated -Python
- -securityAlicense-qualityAn MCP server that connects to OpenWeatherMap's API to provide current weather data and multi-day forecasts for locations worldwide in different measurement units.Last updated -12TypeScriptMIT License
- -securityFlicense-qualityAn MCP server that provides weather information like forecasts and alerts for US locations using the National Weather Service API.Last updated -1JavaScript