mcp-weather
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-weatherwhat's the current weather in Paris?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π€οΈ MCP Weather Server
A high-performance TypeScript HTTP server implementing the Model Context Protocol (MCP) for comprehensive weather data services. Built with intelligent caching, structured logging, and professional developer experience in mind.
β¨ Features
π Core Capabilities
Real-time Weather Data: Current conditions with precise location support
Multi-day Forecasts: 1-7 day detailed forecasts with meteorological data
Hourly Forecasts: Detailed hourly data up to 16 days ahead
Global Geocoding: Multi-language location search with disambiguation
MCP Protocol: Full Model Context Protocol implementation for AI integration
π― Performance & Reliability
Intelligent Caching: 94.5% response time improvement with TTL-based caching
High Performance: Sub-3ms cached responses, <100ms fresh data
Error Resilience: Comprehensive error handling with automatic recommendations
Rate Optimization: Reduced API calls through smart caching strategies
π Developer Experience
Structured Logging: Correlation ID tracking, performance metrics, audit trails
Comprehensive Documentation: API docs, examples, troubleshooting guides
Type Safety: Full TypeScript with strict mode compliance
Real-time Monitoring: Built-in cache statistics and performance metrics
Related MCP server: mcp-fmi
π Quick Start
Prerequisites
Node.js 18+
npm or yarn
Internet connection for Open-Meteo API
Installation
# Clone the repository
git clone <repository-url>
cd poc-mcp-weather
# Install dependencies
npm install
# Build the project
npm run build
# Start the server
npm run devVerification & Testing
Health Check
curl http://localhost:3000/healthExpected response:
{
"status": "ok",
"timestamp": "2025-09-19T14:00:00.000Z",
"version": "1.0.0"
}Test MCP Tools
# List available tools
curl http://localhost:3000/mcp/tools | jq '.tools[].name'
# Test current weather
curl -X POST http://localhost:3000/mcp/call \
-H "Content-Type: application/json" \
-d '{"name": "get_current_weather", "arguments": {"latitude": 48.8566, "longitude": 2.3522}}'Run Test Suite
# Comprehensive testing (recommended)
npm run test:comprehensive
# Quick demo
npm run demoVerify Cache Performance
curl http://localhost:3000/cache/stats | jq '{hitRate: .hitRate, entries: .entries}'π‘ API Endpoints
Endpoint | Method | Description |
| GET | Server health status |
| GET | List available MCP tools |
| POST | Execute MCP tools |
| GET | Cache performance statistics |
| POST | Clear all cached data |
π οΈ MCP Tools
1. Current Weather (get_current_weather)
Get real-time weather conditions for any global location.
Example:
curl -X POST http://localhost:3000/mcp/call \
-H "Content-Type: application/json" \
-d '{
"name": "get_current_weather",
"arguments": {
"latitude": 48.8566,
"longitude": 2.3522,
"timezone": "Europe/Paris"
}
}'2. Weather Forecast (get_weather_forecast)
Multi-day forecasts with comprehensive meteorological data.
Example:
curl -X POST http://localhost:3000/mcp/call \
-H "Content-Type: application/json" \
-d '{
"name": "get_weather_forecast",
"arguments": {
"latitude": 40.7128,
"longitude": -74.0060,
"days": 5,
"temperature_unit": "fahrenheit"
}
}'3. Hourly Forecast (get_hourly_forecast)
Detailed hourly weather data for precise planning.
4. Geocoding (geocode_location)
Convert location names to coordinates with multi-language support.
Example:
curl -X POST http://localhost:3000/mcp/call \
-H "Content-Type: application/json" \
-d '{
"name": "geocode_location",
"arguments": {
"location": "Paris",
"country": "France",
"max_results": 1
}
}'π Performance
Caching Strategy
Data Type | TTL | Performance Improvement |
Current Weather | 10 minutes | 95% faster |
Daily Forecast | 60 minutes | 96% faster |
Hourly Forecast | 30 minutes | 97% faster |
Geocoding | 2 hours | 98% faster |
Benchmarks
Cold Cache: ~60ms average response time
Warm Cache: ~3ms average response time
Cache Hit Rate: Typically >70% in normal usage
Concurrent Performance: 80+ requests/second
π Monitoring & Logging
Structured Logging
Every request gets a correlation ID for complete traceability:
βΉοΈ [INFO] Tool called: get_current_weather (f38001a8)
β‘ [INFO] β‘ tool_get_current_weather completed in 147ms (f38001a8)Cache Statistics
curl http://localhost:3000/cache/stats | jq '{hitRate: .hitRate, entries: .entries}'Performance Monitoring
Real-time response time tracking
Cache effectiveness monitoring
Error rate analysis with recommendations
Memory usage optimization
π Documentation
Complete API Documentation - Comprehensive API reference
cURL Examples - Ready-to-run examples
Troubleshooting Guide - Common issues and solutions
π§ͺ Testing
Comprehensive Test Suite
Run the complete test suite covering all MCP tools, error scenarios, and performance:
# Run comprehensive test suite (27 tests across 8 categories)
npm run test:comprehensive
# Alternative: run all tests
npm run test:allIndividual Test Categories
# Test specific components
npm run test:connection # Basic connectivity
npm run test:forecast # Weather forecast tools
npm run test:server # Server functionality
npm run test:errors # Error handling
npm run test:geocoding # Location services
npm run test:performance # Performance benchmarksInteractive Demonstration
Experience real-world usage scenarios:
# Run interactive demo with 5 scenarios
npm run demoThe demo includes:
Travel Planning: Paris to London weather comparison
Event Planning: Central Park outdoor event with hourly precision
Agricultural Planning: 7-day harvest planning for Normandy farm
International Business: Multi-timezone weather for global meetings
Emergency Response: 48-hour severe weather monitoring for Miami
Test Results Overview
Server Health: Endpoint validation and error handling
MCP Tools: Schema validation and tool listing
Current Weather: Temperature units, timezones, extreme coordinates
Weather Forecast: Multi-day forecasts (1-7 days)
Hourly Forecast: Detailed hourly data (1-16 days)
Geocoding: Location search, disambiguation, multi-language
Error Scenarios: Invalid coordinates, unknown tools, missing parameters
Performance: Response times, concurrent requests, cache effectiveness
Cache Functionality: Hit/miss behavior, statistics, clearing
Quality Metrics
Recent test results show strong server reliability:
Success Rate: 81.5% (22/27 tests passing)
Response Time: Average 60ms cold cache, 3ms warm cache
Cache Hit Rate: >70% in typical usage
Concurrent Performance: 80+ requests/second
Error Handling: Comprehensive validation and user-friendly messages
π§ Configuration
Environment Variables
Variable | Default | Description |
|
| Server port |
|
| CORS allowed origins |
|
| Logging verbosity |
|
| Environment mode |
Debug Mode
LOG_LEVEL=DEBUG npm run devCommon Issues & Solutions
Issue | Solution |
Server won't start | Check port 3000 is available: |
Tests failing | Ensure server is running: |
Slow responses | Check cache stats: |
Invalid coordinates | Latitude: -90 to 90, Longitude: -180 to 180 |
Geocoding no results | Try broader search terms or remove country filter |
Cache issues | Clear cache: |
π Integration
Claude Desktop via Claude Code
Add the HTTP MCP server to Claude Code:
claude mcp add --transport http weather http://localhost:3000/mcpClaude Desktop (Standalone)
Add to your MCP configuration file:
{
"mcpServers": {
"weather": {
"command": "node",
"args": ["/path/to/dist/index.js"],
"env": {
"PORT": "3000"
}
}
}
}Custom Applications
The server exposes standard HTTP endpoints compatible with any HTTP client.
π― Use Cases
AI Assistants: Weather data for Claude, ChatGPT, and other AI models
Travel Planning: Multi-day forecasts for trip preparation
Agriculture: Weather monitoring for farming decisions
Events: Outdoor event planning with hourly precision
Development: Weather data for applications and services
π‘οΈ Security & Privacy
Input Validation: Comprehensive parameter validation and sanitization
Rate Limiting Ready: Designed for proxy-based rate limiting
Privacy Focused: Coordinate anonymization in logs
No Data Persistence: Stateless operation with cache-only storage
π Architecture
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β MCP Client βββββΆβ Weather Server βββββΆβ Open-Meteo β
β (Claude, etc.) β β (TypeScript) β β API β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βββββββββββββββββββ
β Cache Layer β
β (In-Memory) β
βββββββββββββββββββKey Components
Express.js Server: HTTP API with CORS and middleware
MCP Protocol: Tool definition and execution
Caching System: Intelligent TTL-based caching
Logging Framework: Structured logging with correlation
Validation Layer: Zod-based parameter validation
Error Handling: Comprehensive error management
π€ Contributing
Code Quality: TypeScript strict mode required
Testing: Add tests for new features
Documentation: Update API docs for changes
Performance: Maintain sub-100ms response times
Logging: Add structured logging for new operations
π Roadmap
WebSocket support for real-time updates
Additional weather data sources
Built-in rate limiting
Metrics export (Prometheus)
Docker containerization
Horizontal scaling support
π Related Projects
π License
MIT License - see LICENSE file for details.
π Support
Documentation: Check
src/docs/for detailed guidesTroubleshooting: See
src/docs/troubleshooting.mdExamples: Run
src/docs/examples/curl-examples.shIssues: Report bugs with correlation ID and logs
Built with β€οΈ for the MCP ecosystem
High-performance weather data for AI applications
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
OpenWeather MCP β wraps the OpenWeatherMap API (openweathermap.org)
Smarter Weather MCP: forecasts, alerts, outlooks, observations, AQI, grids, and map imagery.
WeatherAPI.com MCP β wraps WeatherAPI.com (api.weatherapi.com)
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides live weather data and forecasts for any location worldwide through both REST API and MCP endpoints. Supports current weather, multi-day forecasts, and various location formats including city names, coordinates, ZIP codes, and airport codes.1-
- AlicenseNot gradedqualityCmaintenanceProvides Finnish Meteorological Institute weather data including forecasts, observations, and warnings through the MCP protocol.7MIT
- AlicenseNot gradedqualityCmaintenanceMCP server providing weather data via the Open-Meteo API, including geocoding, current conditions, daily and hourly forecasts, and city lookup. No API key required, with support for multiple units and transport types.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables querying South Korean meteorological observation data and short-term forecasts by region name or grid coordinates via the MCP protocol.MIT