Open-Meteo Weather MCP server

Integrates with the Open-Meteo API to provide real-time weather data for specified cities, including temperature, wind speed, and conditions, using asynchronous HTTP requests and Docker containerization for easy deployment.
Back to servers
Provider
dennj
Release date
Feb 27, 2025
Language
Python

The MCP Weather server provides a way to bridge between OpenAI assistants and weather data sources. It implements the Model Context Protocol (MCP) to securely exchange data between AI models and weather APIs, allowing assistants to access real-time weather information.

Installation

You can install the weather MCP server using npm:

npm install -g @mcp-plugins/weather

You will need Node.js version 16.0.0 or later.

Configuration

Before using the server, you need to configure your weather API credentials.

Weather API Setup

  1. Sign up for a free API key at WeatherAPI.com
  2. Copy your API key from the dashboard

Environment Variables

Create a .env file in your project directory with the following variables:

WEATHER_API_KEY=your_api_key_here
PORT=3000  # Optional, defaults to 3000

Alternatively, you can set these environment variables in your system.

Running the Server

Start the server with:

weather-mcp-server

Or if you installed it locally:

npx @mcp-plugins/weather

The server will start and listen on the specified port (default: 3000).

Usage

Basic Usage with OpenAI Assistants

When creating or updating an OpenAI Assistant, add a Tool with the following configuration:

{
  "type": "function",
  "function": {
    "name": "get_weather",
    "description": "Get current weather information for a location",
    "parameters": {
      "type": "object",
      "properties": {
        "location": {
          "type": "string",
          "description": "City name, zip/postal code, or lat,lng coordinates"
        }
      },
      "required": ["location"]
    }
  }
}

In your application code, when the Assistant needs to call this tool, route the request to your MCP server at:

http://localhost:3000/api/v1/tools/get_weather

Example Request and Response

Request:

{
  "location": "San Francisco, CA"
}

Response:

{
  "location": {
    "name": "San Francisco",
    "region": "California",
    "country": "United States of America",
    "lat": 37.78,
    "lon": -122.42,
    "localtime": "2023-11-15 12:30"
  },
  "current": {
    "temp_c": 15.6,
    "temp_f": 60.1,
    "condition": {
      "text": "Partly cloudy",
      "icon": "//cdn.weatherapi.com/weather/64x64/day/116.png"
    },
    "wind_mph": 6.9,
    "wind_dir": "WSW",
    "humidity": 72,
    "feelslike_c": 15.6,
    "feelslike_f": 60.1,
    "uv": 5.0
  }
}

Advanced Usage

Custom Endpoints

The server supports multiple weather-related endpoints:

  • /api/v1/tools/get_weather - Current weather conditions
  • /api/v1/tools/get_forecast - Multi-day weather forecast
  • /api/v1/tools/get_astronomy - Astronomy data (sunrise, sunset, moon phase)

Forecast Example

To get a 3-day forecast, create a tool with:

{
  "type": "function",
  "function": {
    "name": "get_forecast",
    "description": "Get weather forecast for a location",
    "parameters": {
      "type": "object",
      "properties": {
        "location": {
          "type": "string",
          "description": "City name, zip/postal code, or lat,lng coordinates"
        },
        "days": {
          "type": "integer",
          "description": "Number of days to forecast (1-7)",
          "default": 3
        }
      },
      "required": ["location"]
    }
  }
}

Route these requests to:

http://localhost:3000/api/v1/tools/get_forecast

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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