OpenWeatherMap MCP server

Integrates with OpenWeatherMap API to provide current conditions, forecasts, air quality monitoring, weather alerts, and location services through 11 specialized tools for weather-dependent applications and travel planning.
Back to servers
Setup instructions
Provider
Robert Niimi
Release date
Jun 14, 2025
Language
Python

OpenWeatherMap MCP Server provides comprehensive weather data and forecasts through the OpenWeatherMap API. This server enables AI assistants to access real-time weather information, forecasts, air quality data, and location services through the Model Context Protocol (MCP).

Features

Weather Tools

  • Current Weather - Get current conditions for any location
  • Weather Forecast - 5-day weather forecast with 3-hour intervals
  • Hourly Forecast - Detailed hourly forecasts for up to 48 hours
  • Daily Forecast - Daily weather forecasts for up to 8 days with temperature ranges and astronomical data
  • Minutely Forecast - Minute-by-minute precipitation forecasts for the next hour
  • Weather Alerts - Active weather warnings and alerts with severity classification

Air Quality & Location

  • Current Air Pollution - Real-time air quality index and pollutant measurements
  • Location Info - Reverse geocoding to get location details from coordinates
  • OneCall Weather - Comprehensive weather data combining multiple forecasts
  • Air Pollution - Historical and forecast air quality data
  • Geocoding - Convert location names to coordinates

Installation

Prerequisites

Setup

  1. Clone the repository:
git clone https://github.com/robertn702/mcp-openweathermap.git
cd mcp-openweathermap
  1. Install dependencies:
bun install
  1. Set up your environment variables:
cp .env.example .env
# Edit .env and add your OpenWeatherMap API key

Environment Variables

  • OPENWEATHER_API_KEY - Your OpenWeatherMap API key (required for stdio transport only)
  • PORT - Server port for HTTP transport (default: 3000)
  • MCP_TRANSPORT - Transport type: stdio or httpStream (default: stdio)
  • MCP_ENDPOINT - HTTP endpoint path (default: /stream)

Usage

Running the Server

Stdio Transport (default):

bun run src/main.ts

HTTP Stream Transport:

MCP_TRANSPORT=httpStream PORT=3000 bun run src/main.ts

Claude Desktop Configuration

Add this configuration to your Claude Desktop MCP settings:

{
  "mcpServers": {
    "openweathermap": {
      "command": "npx",
      "args": ["mcp-openweathermap"],
      "env": {
        "OPENWEATHER_API_KEY": "your-api-key-here"
      }
    }
  }
}

Available Tools

Weather Information

  • get-current-weather - Current weather conditions
  • get-weather-forecast - 5-day forecast
  • get-hourly-forecast - Hourly forecasts (up to 48 hours)
  • get-daily-forecast - Daily forecasts (up to 8 days)
  • get-minutely-forecast - Minute-by-minute precipitation

Alerts & Air Quality

  • get-weather-alerts - Weather warnings and alerts
  • get-current-air-pollution - Current air quality data
  • get-air-pollution - Air quality forecasts and history

Location Services

  • get-location-info - Reverse geocoding from coordinates
  • geocode-location - Convert addresses to coordinates
  • get-onecall-weather - Comprehensive weather data

Authentication

Stdio Transport: Requires OPENWEATHER_API_KEY environment variable.

HTTP Transport: The OpenWeatherMap API key is passed as a bearer token in the HTTP request headers. No environment variable needed.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "openweathermap" '{"command":"npx","args":["mcp-openweathermap"],"env":{"OPENWEATHER_API_KEY":"your-api-key-here"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "openweathermap": {
            "command": "npx",
            "args": [
                "mcp-openweathermap"
            ],
            "env": {
                "OPENWEATHER_API_KEY": "your-api-key-here"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "openweathermap": {
            "command": "npx",
            "args": [
                "mcp-openweathermap"
            ],
            "env": {
                "OPENWEATHER_API_KEY": "your-api-key-here"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later