A Model Context Protocol (MCP) server for weather data using OpenWeatherMap API, built for AWS Lambda with CDK.
-
Get OpenWeatherMap API key from https://openweathermap.org/api
-
Store API key in AWS SSM Parameter Store:
aws ssm put-parameter \ --name "/weather-mcp/openweather-api-key" \ --value "your_api_key_here" \ --type "SecureString"
-
Install dependencies:
npm install
npm startnpm run build
npm run deploynpm run synth- Synthesize CloudFormation templatenpm run deploy- Deploy to AWScdk destroy- Remove stack from AWS
Get current weather conditions for a city.
Parameters:
city(required): City nameunits(optional): "metric", "imperial", or "kelvin" (default: "metric")
Get 5-day weather forecast for a city.
Parameters:
city(required): City nameunits(optional): "metric", "imperial", or "kelvin" (default: "metric")
Compare current weather between multiple locations. Great for helping users choose between destination options.
Parameters:
cities(required): Array of city names to compareunits(optional): "metric", "imperial", or "kelvin" (default: "metric")
- Lambda Function: Node.js 20.x runtime with MCP server implementation
- API Gateway: REST API endpoint for MCP communication
- SSM Parameter Store: Secure storage for OpenWeatherMap API key
- IAM Permissions: Lambda has read access to SSM parameter
This server integrates with the main architecture through the MCP Handler Lambda function, providing weather data to the Strands Agent Orchestrator via Amazon Bedrock.
