
mcp yrno weather prediction server
提供挪威气象局天气数据的 MCP 服务器,支持实时、逐小时和逐日天气预报。
Repository Info
About This Server
提供挪威气象局天气数据的 MCP 服务器,支持实时、逐小时和逐日天气预报。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
MCP YR.no Weather Server
A Model Context Protocol (MCP) server that provides access to Norwegian Meteorological Institute (YR.no) weather data. This server exposes weather forecasting capabilities through the MCP protocol, allowing AI assistants to fetch current weather, hourly forecasts, and daily forecasts for any location worldwide.
Features
- Current Weather: Get real-time weather conditions for any location
- Hourly Forecasts: Get detailed hourly weather predictions (up to 48 hours)
- Daily Forecasts: Get daily weather summaries (up to 7 days)
- Detailed Forecasts: Get comprehensive weather data with all available parameters
- Weather Descriptions: Convert weather symbol codes to human-readable descriptions
Installation
- Clone this repository and navigate to the directory:
git clone <repository-url>
cd mcp-yrno-weather-prediction-server
- Install dependencies:
npm install
- Build the TypeScript code:
npm run build
Usage
Development Mode
Run the server in development mode with auto-reload:
npm run dev
Production Mode
Build and run the compiled server:
npm run build
npm start
MCP Tools
The server provides the following tools:
get_current_weather
Get current weather conditions for a location.
Parameters:
latitude(number, required): Latitude coordinate (-90 to 90, max 4 decimals)longitude(number, required): Longitude coordinate (-180 to 180, max 4 decimals)altitude(number, optional): Altitude in meters
Example:
{
"latitude": 59.9139,
"longitude": 10.7522,
"altitude": 100
}
get_hourly_forecast
Get hourly weather forecast for a location.
Parameters:
latitude(number, required): Latitude coordinate (-90 to 90, max 4 decimals)longitude(number, required): Longitude coordinate (-180 to 180, max 4 decimals)hours(number, optional): Number of hours to forecast (1-48, default: 24)altitude(number, optional): Altitude in meters
get_daily_forecast
Get daily weather forecast for a location (up to 7 days).
Parameters:
latitude(number, required): Latitude coordinate (-90 to 90, max 4 decimals)longitude(number, required): Longitude coordinate (-180 to 180, max 4 decimals)altitude(number, optional): Altitude in meters
get_detailed_forecast
Get detailed weather forecast with complete data available from the API.
Parameters:
latitude(number, required): Latitude coordinate (-90 to 90, max 4 decimals)longitude(number, required): Longitude coordinate (-180 to 180, max 4 decimals)altitude(number, optional): Altitude in meters
get_weather_description
Convert weather symbol codes to human-readable descriptions.
Parameters:
symbolCode(string, required): Weather symbol code (e.g., "clearsky_day", "rain", "snow")
Configuration
The weather client is configured with:
- User-Agent: "MCP-YrNo-Weather-Server/1.0 https://github.com/example/mcp-yrno-weather"
- Base URL: "https://api.met.no/weatherapi/locationforecast/2.0"
- Timeout: 10 seconds
You can modify the configuration in src/weather-client.ts if needed.
MCP Client Configuration
To use this server with an MCP client, add it to your client configuration:
{
"mcpServers": {
"yrno-weather": {
"command": "node",
"args": ["/path/to/your/mcp-yrno-weather-prediction-server/dist/index.js"]
}
}
}
API Rate Limits
The Norwegian Meteorological Institute API has rate limits:
- Be respectful with API usage
- The client automatically rounds coordinates to 4 decimals to comply with API requirements
- Handle rate limit errors (HTTP 429) gracefully
Weather Data
The server provides rich weather data including:
- Temperature (current, min, max)
- Humidity
- Air pressure
- Wind speed and direction
- Cloud coverage
- Precipitation amount and probability
- Weather condition symbols
- UV index (when available)
Error Handling
The server handles various error conditions:
- Invalid coordinates (HTTP 422)
- Rate limiting (HTTP 429)
- Access forbidden (HTTP 403)
- Network timeouts
- Invalid API responses
Development
Scripts
npm run build: Compile TypeScript to JavaScriptnpm run dev: Run in development mode with tsxnpm run watch: Run with file watching for developmentnpm start: Run the compiled server
File Structure
src/
├── index.ts # Main MCP server implementation
└── weather-client.ts # YR.no API client and types
License
MIT License
Credits
- Weather data provided by Norwegian Meteorological Institute
- Built with Model Context Protocol SDK
Quick Start
Clone the repository
git clone https://github.com/alexatnordnet/mcp-yrno-weather-prediction-serverInstall dependencies
cd mcp-yrno-weather-prediction-server
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.