# Global Weather MCP Server (`jason.hu/weather-mcp`) Actor

MCP server for current weather, hourly and daily forecasts, air quality, lifestyle indices, historical weather, and tides. Data comes from QWeather. Connect over Streamable HTTP at the Standby URL plus /mcp. Query by city or coordinates.

- **URL**: https://apify.com/jason.hu/weather-mcp.md
- **Developed by:** [Jason](https://apify.com/jason.hu) (community)
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 weather-queries

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## weather-mcp

Weather **MCP (Model Context Protocol)** server. It gives clients current conditions, forecasts, air quality, lifestyle indices, historical weather, and tides. Data comes from the [QWeather Open API](https://dev.qweather.com/docs/).

***

### Tools

| MCP Tool | Description | QWeather API |
|---|---|---|
| `get_current_weather` | Current weather, plus current air quality when available | [Current weather](https://dev.qweather.com/docs/api/weather/weather-current/) + [Current air quality](https://dev.qweather.com/docs/api/air-quality/air-current/) |
| `get_current_air_quality` | Current air quality | [Current air quality](https://dev.qweather.com/docs/api/air-quality/air-current/) |
| `get_weather_indices` | Lifestyle indices | [Indices forecast](https://dev.qweather.com/docs/api/indices/indices-forecast/) |
| `get_hourly_weather` | Hourly forecast | [Hourly forecast](https://dev.qweather.com/docs/api/weather/weather-hourly-forecast/) |
| `get_daily_weather` | Daily forecast | [Daily forecast](https://dev.qweather.com/docs/api/weather/weather-daily-forecast/) |
| `get_hourly_airquality` | Hourly air quality | [Hourly air quality](https://dev.qweather.com/docs/api/air-quality/air-hourly-forecast/) |
| `get_daily_airquality` | Daily air quality | [Daily air quality](https://dev.qweather.com/docs/api/air-quality/air-daily-forecast/) |
| `get_historical_weather` | Historical weather | [Time Machine](https://dev.qweather.com/docs/api/time-machine/time-machine-weather/) |
| `get_tide` | Tide | [Tide](https://dev.qweather.com/docs/api/ocean/tide/) |

All nine tools accept `lang`. The default is `zh`. Common values: `zh`, `zh-hant`, `en`, `ja`, `ko`. See [QWeather languages](https://dev.qweather.com/docs/resource/language/) for the full list. An unsupported code returns `ok: false`.

***

### Response format

Every call returns `{ok, data}`. `data` contains only the fields for that query.

```json
{
  "meta": { "provider": "qweather", "city": "广州", "lat": "23.12", "lon": "113.28" },
  "current": { "weather": "小雨", "temp": 27.01 },
  "air_quality": { "index_code": "cn-mee", "aqi_display": "45" }
}
```

- `get_current_weather` returns `current` and includes `air_quality` when that request succeeds. If air quality fails, the field is empty and the weather result is unchanged
- `get_current_air_quality` returns `air_quality`
- `get_hourly_weather` returns `hourly_weather`
- `get_daily_weather` returns `daily_weather`
- `get_hourly_airquality` returns `hourly_airquality`
- `get_daily_airquality` returns `daily_airquality`
- `get_weather_indices` returns `indices`
- `get_historical_weather` returns `historical_weather`
- `get_tide` returns `tide`

`attributions` on air-quality results come from QWeather and must be shown together with the data. Data is provided by QWeather. Follow the [attribution requirements](https://dev.qweather.com/docs/terms/attribution/).

***

### MCP Tool: `get_current_weather`

#### Input

| Parameter | Type | Description |
|---|---|---|
| `city` | string? | City name. Use this or lat/lon |
| `lat` | number? | Latitude. Must be sent with `lon` |
| `lon` | number? | Longitude. Must be sent with `lat` |

#### Output

```json
{
  "ok": true,
  "data": {
    "meta": { "provider": "qweather", "city": "广州", "lat": "23.12", "lon": "113.28" },
    "current": {
      "weather": "小雨",
      "weather_code": "305",
      "temp": 27.01,
      "temp_unit": "°C",
      "feels_like": 29.82,
      "humidity": 0.84,
      "wind": { "speed": 2.4, "speed_unit": "m/s", "scale": 2 },
      "pressure": 1012.79,
      "visibility": 29210.0,
      "uv_index": 0
    },
    "air_quality": {
      "index_name": "AQI (CN)",
      "index_code": "cn-mee",
      "aqi": 45,
      "aqi_display": "45",
      "level": "2",
      "category": "良",
      "effect": "空气质量可接受。",
      "advice": "除少数对污染物特别敏感的人以外，可以正常进行室外活动。",
      "primary_pollutant": {
        "code": "pm2p5",
        "name": "PM 2.5",
        "full_name": "细颗粒物"
      },
      "pollutants": [
        {
          "code": "pm2p5",
          "name": "PM 2.5",
          "value": 31.0,
          "unit": "μg/m3"
        }
      ]
    }
  }
}
```

On failure:

```json
{ "ok": false, "error": "错误说明" }
```

If the air-quality request fails, `ok` stays `true` and `data.air_quality` is empty.

***

### MCP Tool: `get_current_air_quality`

Input matches `get_current_weather`. The result is `data.air_quality`. If this request fails, the whole call returns `ok: false`.

***

### MCP Tool: `get_weather_indices`

#### Input

| Parameter | Type | Description |
|---|---|---|
| `city` | string? | City name. Use this or lat/lon |
| `lat` | number? | Latitude. Must be sent with `lon` |
| `lon` | number? | Longitude. Must be sent with `lat` |
| `days` | string? | `1d` or `3d`. Default `1d` |
| `index_type` | string? | Index type IDs, comma-separated. Default `0` (all). `0` cannot be combined with other types |

Common types: `1` sport, `2` car wash, `3` dressing, `4` fishing, `5` UV. Full list: [weather indices](https://dev.qweather.com/docs/resource/indices-info/).

Returns `data.indices`. A QWeather business code other than `200` makes the whole call `ok: false`.

***

### MCP Tool: `get_hourly_weather`

#### Input

| Parameter | Type | Description |
|---|---|---|
| `city` | string? | City name. Use this or lat/lon |
| `lat` | number? | Latitude. Must be sent with `lon` |
| `lon` | number? | Longitude. Must be sent with `lat` |
| `hours` | number? | Forecast hours, 1 to 240. Default 24 |

Returns `data.hourly_weather`. Times are local to the queried location. Dew point and cloud cover are omitted.

***

### MCP Tool: `get_daily_weather`

#### Input

| Parameter | Type | Description |
|---|---|---|
| `city` | string? | City name. Use this or lat/lon |
| `lat` | number? | Latitude. Must be sent with `lon` |
| `lon` | number? | Longitude. Must be sent with `lat` |
| `days` | number? | Forecast days, 1 to 10. Default 7 |
| `lang` | string? | Language code. Default `zh` |

Returns `data.daily_weather`. Times are local to the queried location. Each day includes high, low, and average temperature, UV index, sunrise and sunset, moon phase, plus daytime and nighttime weather, wind, and precipitation. Cloud cover, twilight, and moon transit are omitted.

***

### MCP Tool: `get_hourly_airquality`

#### Input

| Parameter | Type | Description |
|---|---|---|
| `city` | string? | City name. Use this or lat/lon |
| `lat` | number? | Latitude. Must be sent with `lon` |
| `lon` | number? | Longitude. Must be sent with `lat` |
| `lang` | string? | Language code. Default `zh` |

Returns `data.hourly_airquality`. QWeather returns the next 24 hours. The primary index prefers `cn-mee`, then `qaqi`. Index color and pollutant sub-indices are omitted. Show `attributions` with the data.

***

### MCP Tool: `get_daily_airquality`

#### Input

| Parameter | Type | Description |
|---|---|---|
| `city` | string? | City name. Use this or lat/lon |
| `lat` | number? | Latitude. Must be sent with `lon` |
| `lon` | number? | Longitude. Must be sent with `lat` |
| `lang` | string? | Language code. Default `zh` |

Returns `data.daily_airquality`. QWeather returns the next 3 days. The primary index prefers `cn-mee`, then `qaqi`. Index color and pollutant sub-indices are omitted. Show `attributions` with the data.

***

### MCP Tool: `get_historical_weather`

#### Input

| Parameter | Type | Description |
|---|---|---|
| `city` | string? | City name. Use this or lat/lon |
| `lat` | number? | Latitude. Must be sent with `lon` |
| `lon` | number? | Longitude. Must be sent with `lat` |
| `date` | string | Required. `yyyyMMdd` or `yyyy-MM-dd`. One of the last 10 days, excluding today |
| `unit` | string? | `m` metric (default) or `i` imperial |
| `lang` | string? | Language code. Default `zh` |

Returns `data.historical_weather`. `daily` is the day summary and `hourly` is the hour-by-hour list. Coordinates alone are resolved to a city ID first. In metric units, humidity is a percentage and wind speed is kilometers per hour.

***

### MCP Tool: `get_tide`

#### Input

| Parameter | Type | Description |
|---|---|---|
| `city` | string? | City name. Use city, station, or coordinates |
| `lat` | number? | Latitude. Must be sent with `lon` |
| `lon` | number? | Longitude. Must be sent with `lat` |
| `station` | string? | Tide station LocationID, such as `P66981` |
| `date` | string | Required. `yyyyMMdd` or `yyyy-MM-dd`, from today through the next 10 days |
| `lang` | string? | Language code. Default `zh`. Affects the station name only |

Returns `data.tide`. `table` lists high tide (`H`) and low tide (`L`). `hourly` is the hourly tide height in meters. Without `station`, the nearest tide station is resolved from the city name or coordinates.

# Actor input Schema

## `note` (type: `string`):

Not used. Connect an MCP client to the Standby URL plus /mcp.

## Actor input object example

```json
{
  "note": "unused"
}
```

# Actor output Schema

## `mcp` (type: `string`):

Connect an MCP client here. One successful tool call is billed as weather-query.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "note": "unused"
};

// Run the Actor and wait for it to finish
const run = await client.actor("jason.hu/weather-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "note": "unused" }

# Run the Actor and wait for it to finish
run = client.actor("jason.hu/weather-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "note": "unused"
}' |
apify call jason.hu/weather-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jason.hu/weather-mcp"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/S0s7jqwXogQcinGuh/builds/8M4RGEIdsEQ68QJOC/openapi.json
