Weather MCP Server - Sample Implementation
Reference implementation for ASUS and OEM partners
A simple, production-ready MCP server demonstrating how to integrate external services with AI PCs using the Model Context Protocol.
๐ฏ Purpose
This sample MCP server demonstrates:
โ How to create an MCP server from scratch
โ How to expose tools (functions) to AI clients
โ How to integrate external APIs (OpenWeather API)
โ Production-ready error handling
โ Clean, well-documented code
Perfect for: OEM partners building AI PC features, developers learning MCP, proof-of-concept projects
๐ Features
Available Tools
get_current_weather- Get real-time weather for any cityTemperature, conditions, humidity, wind speed
Supports both Celsius and Fahrenheit
get_weather_forecast- Get 5-day forecastDaily high/low temperatures
Weather conditions per day
๐ Quick Start
Prerequisites
Node.js >= 18.0.0
OpenWeather API key (free tier available)
Installation
Get API Key
Visit OpenWeather API
Sign up for free account
Generate API key
Add to
.envfile
Run the Server
๐ Usage Examples
Configure in Claude Desktop
Add to your claude_desktop_config.json:
Test with AI Client
Once configured, you can ask your AI assistant:
The AI will automatically call the appropriate MCP tools!
๐๏ธ Architecture
Key Components
index.js- Main server implementation@modelcontextprotocol/sdk- Official MCP SDKStdioServerTransport- Communicates via stdin/stdoutOpenWeather API- External weather data source
๐ Project Structure
๐ ๏ธ Development
Code Structure
The server is organized into clear sections:
Configuration - API keys, URLs
WeatherServer Class - Main server logic
Tool Registration - Define available tools
Tool Handlers - Implement tool functionality
Error Handling - Robust error management
Adding New Tools
๐งช Testing
Manual Testing
Integration Testing
Use the included examples/client-example.js to test tool calls programmatically.
๐ API Reference
Tool: get_current_weather
Parameters:
city(string, required) - City name (e.g., "Taipei", "Tokyo")units(string, optional) - "metric" (default) or "imperial"
Returns:
Tool: get_weather_forecast
Parameters:
city(string, required) - City nameunits(string, optional) - "metric" (default) or "imperial"
Returns:
๐ Security Best Practices
Implemented in this sample:
โ API keys stored in environment variables (not in code)
โ Input validation for all parameters
โ Proper error handling (no sensitive data leakage)
โ HTTPS for external API calls
โ Minimal dependencies (reduces attack surface)
For production deployments:
๐ Use secrets management system (AWS Secrets Manager, Azure Key Vault)
๐ Implement rate limiting
๐ Add request logging/monitoring
๐ Use TLS for MCP communication if deployed remotely
๐ Localization
This server supports multiple languages through the OpenWeather API:
Supported languages: en, zh_tw, zh_cn, ja, ko, and 50+ more
๐ Troubleshooting
Common Issues
"City not found"
Check spelling of city name
Try including country code: "Taipei,TW"
"Weather API error: Unauthorized"
Verify your API key in
.envCheck API key is active at openweathermap.org
"Module not found"
Run
npm installCheck Node.js version >= 18.0.0
MCP server not detected in Claude
Verify
claude_desktop_config.jsonpathRestart Claude Desktop
Check server logs for errors
๐ Learn More
MCP Resources
Weather API
๐ค For OEM Partners
See :
Detailed integration guide
Deployment options
Customization examples
Production checklist
Support information
Contact: partners@irisgo.ai
๐ License
MIT License - see LICENSE file
๐ Credits
Created by: IrisGo.AI Team
MCP Protocol: Anthropic
Weather Data: OpenWeather
For: ASUS and AI PC OEM partners
๐ฎ Support
Issues: GitHub Issues
Email: support@irisgo.ai
Documentation: docs.irisgo.ai
Last Updated: 2025-11-14 Version: 1.0.0
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables AI assistants to retrieve real-time weather data and 5-day forecasts for any city using the OpenWeather API, supporting both metric and imperial units.
- ๐ฏ Purpose
- ๐ Features
- ๐ Quick Start
- ๐ Usage Examples
- ๐๏ธ Architecture
- ๐ Project Structure
- ๐ ๏ธ Development
- ๐งช Testing
- ๐ API Reference
- ๐ Security Best Practices
- ๐ Localization
- ๐ Troubleshooting
- ๐ Learn More
- ๐ค For OEM Partners
- ๐ License
- ๐ Credits
- ๐ฎ Support