- Home
- MCP servers
- OpenWeather
OpenWeather
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"mattiaperi-openweathermap-mcp-server": {
"command": ".venv/bin/python",
"args": [
"server.py"
],
"env": {
"OPENWEATHER_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}This MCP server delivers weather data from the OpenWeatherMap API through a streamlined, multi-tool service. You can obtain current conditions, forecast data, and air quality information for any city, enabling you to build conversational experiences or automated workflows that respond with accurate, up-to-date weather insights.
How to use
You interact with the weather MCP through an MCP client to request specific data for any city. Use the available tools to retrieve real-time conditions, a 5‑day forecast in 3‑hour intervals, or air pollution metrics. Start by asking for weather in a city, then refine your request to forecasts or pollution data as needed. The server returns structured responses containing the data you asked for, so you can extract temperature, humidity, pollutant levels, and more in your application or chat flow.
Practical usage patterns include asking for current weather in a city you’re planning to visit, requesting a 5‑day forecast before a trip, or checking air quality for outdoor activities. Ensure you have a valid OpenWeatherMap API key and your MCP client is configured to communicate with the weather MCP server using the provided endpoint or local runtime configuration.
How to install
Prerequisites you need before installation: Python 3.12 or newer and an OpenWeatherMap API key.
-
Clone the project repository into your working directory.
-
Create and activate a virtual environment.
-
Install the required dependencies from the requirements file.
-
Set your OpenWeatherMap API key in your environment.
-
Run the MCP server using the Python runtime from your virtual environment.
Configuration and quick start
The MCP server can be integrated with clients like Amazon Q by providing a local runtime configuration that runs the server via the virtual environment. An example MCP configuration for a local setup is shown here.
Security and best practices
Keep API keys out of version control. Use environment variables for sensitive data. Apply rate limiting in production and validate input parameters to guard against malformed requests.
Development and tools
The server provides three main tools for data access: get_current_weather(city: str) to obtain current conditions, get_weather_forecast(city: str) for a 5-day forecast with 3-hour steps, and get_air_pollution(city: str) for air quality and pollutant concentrations.
Troubleshooting
If the server does not start, verify that Python 3.12+ is installed, the virtual environment is activated, and the OPENWEATHER_API_KEY environment variable is set. Check that the required dependencies are installed and that the API key is valid.
Notes
The server exposes its data through clearly defined tools. Use the provided start command to run the server locally and then query the desired tool from your MCP client.
Available tools
get_current_weather
Returns current weather conditions including temperature, humidity, pressure, and a weather description for a given city.
get_weather_forecast
Returns a 5-day weather forecast with data points every 3 hours for a given city.
get_air_pollution
Returns air quality data including AQI and pollutant concentrations (CO, NO, NO2, O3, SO2, PM2.5, PM10, NH3) for a given city.