# Weather MCP Server (`jiri.spilka/weather-mcp-server`) Actor

A Model Context Protocol (MCP) server that provides weather information using the Open-Meteo API

- **URL**: https://apify.com/jiri.spilka/weather-mcp-server.md
- **Developed by:** [Jiří Spilka](https://apify.com/jiri.spilka) (community)
- **Categories:** Developer tools, MCP servers
- **Stats:** 734 total users, 23 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.00 / 1,000 tool calls

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 Server

A Model Context Protocol (MCP) server that provides weather information using the Open-Meteo API.

**About this MCP Server:** To understand how to connect to and utilize this MCP server, please refer to the official Model Context Protocol documentation at [mcp.apify.com](https://mcp.apify.com).

### Connection URL

MCP clients can connect to this server at:

```text
https://jiri-spilka--weather-mcp-server.apify.actor/mcp
```

### Client Configuration

To connect to this MCP server, use the following configuration in your MCP client:

```json
{
  "mcpServers": {
    "weather": {
      "url": "https://jiri-spilka--weather-mcp-server.apify.actor/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

**Note:** Replace `YOUR_APIFY_TOKEN` with your actual Apify API token. You can find your token in the [Apify Console](https://console.apify.com/account/integrations).

### Links

- **GitHub Repository**: https://github.com/isdaniel/mcp_weather_server
- **Actor Repository**: https://github.com/apify/mcp-servers
- **Apify MCP Documentation**: https://mcp.apify.com

### 🚩 Claim this MCP server

All credits to the original authors of https://github.com/isdaniel/mcp_weather_server
To claim this server, please write to <ai@apify.com>.

***

## Weather MCP Server

A Model Context Protocol (MCP) server that provides weather information using the Open-Meteo API.

### Features

- Get current weather information for a specified city.

### Installation

Pip Installation and Usage, This package can be installed using pip:

```bash
pip install mcp_weather_server
```

This server is designed to be installed manually by adding its configuration to the `cline_mcp_settings.json` file.

1. Add the following entry to the `mcpServers` object in your `cline_mcp_settings.json` file:

```json
{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": [
        "-m",
        "mcp_weather_server"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}
```

2. Save the `cline_mcp_settings.json` file.

### Configuration

This server does not require an API key. It uses the Open-Meteo API, which is free and open-source.

### Usage

This server provides several tools: `get_weather`, `get_weather_by_datetime_range`, and `get_current_datetime`.

#### `get_weather`

Retrieves the current weather information for a given city.

**Parameters:**

- `city` (string, required): The name of the city.

**Example:**

To get the weather in Taipei, you would use the tool like this:

```
<use_mcp_tool>
<server_name>weather</server_name>
<tool_name>get_weather</tool_name>
<arguments>
{
  "city": "Taipei"
}
</arguments>
</use_mcp_tool>
```

#### `get_weather_by_datetime_range`

Retrieves weather information for a specified city between start and end dates.

**Parameters:**

- `city` (string, required): The name of the city.
- `start_date` (string, required): Start date in format YYYY-MM-DD (ISO 8601).
- `end_date` (string, required): End date in format YYYY-MM-DD (ISO 8601).

**Example:**

To get the weather in London between 2024-01-01 and 2024-01-07, you would use the tool like this:

```
<use_mcp_tool>
<server_name>weather</server_name>
<tool_name>get_weather_by_datetime_range</tool_name>
<arguments>
{
  "city": "London",
  "start_date": "2024-01-01",
  "end_date": "2024-01-07"
}
</arguments>
</use_mcp_tool>
```

#### `get_current_datetime`

Retrieves the current time in a specified timezone.

**Parameters:**

- `timezone_name` (string, required): IANA timezone name (e.g., 'America/New_York', 'Europe/London'). Use UTC timezone if no timezone provided by the user.

**Example:**

To get the current time in New York, you would use the tool like this:

```
<use_mcp_tool>
<server_name>weather</server_name>
<tool_name>get_current_datetime</tool_name>
<arguments>
{
  "timezone_name": "America/New_York"
}
</arguments>
</use_mcp_tool>
```

### Available Tools

This MCP server provides the following tools:

1. **get_weather** - Get current weather information for a specified city
2. **get_weather_by_datetime_range** - Get weather information for a city within a date range
3. **get_current_datetime** - Get current time in a specified timezone

### For developers

Change Working Directory Before Running Python

```
python -m mcp_weather_server
```

Or if you want Python to find your package no matter where you run from, you can set PYTHONPATH:

```
set PYTHONPATH=C:\xxx\mcp_weather_server\src
python -m mcp_weather_server
```

### References

To learn more about Apify and Actors, take a look at the following resources:

- [Apify SDK for JavaScript documentation](https://docs.apify.com/sdk/js)
- [Apify SDK for Python documentation](https://docs.apify.com/sdk/python)
- [Apify Platform documentation](https://docs.apify.com/platform)
- [Apify MCP Server](https://docs.apify.com/platform/integrations/mcp)
- [Webinar: Building and Monetizing MCP Servers on Apify](https://www.youtube.com/watch?v=w3AH3jIrXXo)
- [Join our developer community on Discord](https://discord.com/invite/jyEM2PRvMU)

# Actor input Schema

## Actor input object example

```json
{}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("jiri.spilka/weather-mcp-server").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("jiri.spilka/weather-mcp-server").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 '{}' |
apify call jiri.spilka/weather-mcp-server --silent --output-dataset

```

## MCP server setup

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

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/J3RfhVsm4cNFK9Jih/builds/PGjcEJa0logxqZdIz/openapi.json
