weather-mcp
A minimal Model Context Protocol server in a
single file. It speaks JSON-RPC 2.0 over stdio and exposes two tools,
get_weather and get_hourly_forecast, backed by the free
Open-Meteo API.
No third-party dependencies — standard library only. Requires Python 3.7+.
The tools
| Tool | Arguments | Returns |
|---|---|---|
get_weather |
location (string, required) — a place name like "Seattle" or "Paris, France" |
Current conditions, temperature (°F), and wind (mph) as a text block. Unknown place names come back as a result with isError: true. |
get_hourly_forecast |
location (string, required); hours (integer, optional, 1–48, default 12) |
Hour-by-hour temperature (°F), precipitation probability, and conditions, one line per hour. Timestamps are local to the location. Out-of-range hours is clamped. |
Usage
Once the server is wired into a client (see below), just ask in natural language — the model picks the tool and fills in the arguments:
You: What's the weather in Seattle right now?
Claude: (calls
get_weatherwithlocation: "Seattle") Current weather in Seattle, United States: overcast, 54.2 °F, wind 1.1 mph.
You: Will it rain in Tokyo over the next 6 hours?
Claude: (calls
get_hourly_forecastwithlocation: "Tokyo",hours: 6) Yes — drizzle every hour, precipitation probability climbing from 76 % to 89 %.
Try it without a client
Drive the server directly over stdio with a hand-written JSON-RPC exchange:
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"cli"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_weather","arguments":{"location":"Seattle"}}}' \
'{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_hourly_forecast","arguments":{"location":"Tokyo","hours":6}}}' \
| openmeteo-mcp # or: python3 weather_mcp/server.py
The tools/call responses look like:
{"jsonrpc": "2.0", "id": 2, "result": {"content": [{"type": "text",
"text": "Current weather in Seattle, United States:\n Conditions: overcast\n Temperature: 54.2°F\n Wind: 1.1 mph"}]}}
Hourly forecast for Tokyo, Japan (next 6 hours):
2026-09-04 18:00 73.0°F precip 76% dense drizzle
2026-09-04 19:00 72.5°F precip 76% dense drizzle
2026-09-04 20:00 72.2°F precip 78% dense drizzle
2026-09-04 21:00 71.8°F precip 80% slight rain
2026-09-04 22:00 71.7°F precip 84% dense drizzle
2026-09-04 23:00 71.3°F precip 89% moderate drizzle
An unknown place name comes back as a normal result with "isError": true:
{"jsonrpc": "2.0", "id": 4, "result": {"content": [{"type": "text",
"text": "Could not find any location named 'Zzzxqq'."}], "isError": true}}
Install
Pick whichever fits your setup. All of them give you an openmeteo-mcp
command (or an equivalent) that clients can launch.
The distribution is named myai-weather-mcp; both myai-weather-mcp and
openmeteo-mcp launch the server.
From PyPI (after the first successful release):
pipx install myai-weather-mcp # or: pip install myai-weather-mcp
With uv — no install step at all:
uvx myai-weather-mcp
# or straight from GitHub:
uvx --from git+https://github.com/myAI-2025/weather-mcp openmeteo-mcp
With pipx or pip:
pipx install git+https://github.com/myAI-2025/weather-mcp
# or
pip install git+https://github.com/myAI-2025/weather-mcp
From a clone (no install):
git clone https://github.com/myAI-2025/weather-mcp
python3 weather-mcp/weather_mcp/server.py # runs the server directly
Configure a client
Claude Code
claude mcp add --scope user weather -- openmeteo-mcp
If you cloned instead of installing, point at the file:
claude mcp add --scope user weather -- python3 /path/to/weather-mcp/weather_mcp/server.py
Restart Claude Code (or reconnect via /mcp). Both tools then appear as
mcp__weather__get_weather and mcp__weather__get_hourly_forecast.
Claude Desktop
Edit claude_desktop_config.json
(macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\)
and add:
{
"mcpServers": {
"weather": {
"command": "openmeteo-mcp"
}
}
}
Using uvx instead, so nothing needs installing first:
{
"mcpServers": {
"weather": {
"command": "uvx",
"args": ["myai-weather-mcp"]
}
}
}
Restart Claude Desktop. The tools appear under the connectors (plug) menu.
Any other MCP client
It's a standard stdio server: launch openmeteo-mcp (or
python3 -m weather_mcp) as a subprocess and speak JSON-RPC 2.0 over its
stdin/stdout. See How it works below.
Development
git clone https://github.com/myAI-2025/weather-mcp
cd weather-mcp
pip install -e ".[dev]"
python3 test_server.py # one line per check
pytest # same checks, pytest-style
The suite monkeypatches the network functions, so it runs offline.
How it works
weather_mcp/server.py reads newline-delimited JSON-RPC messages from stdin
and writes responses to stdout:
| Method | Behavior |
|---|---|
initialize |
Echoes the client's protocolVersion, advertises the tools capability, returns serverInfo. |
notifications/initialized |
Notification — no response. |
tools/list |
Returns the get_weather and get_hourly_forecast tools and their input schemas. |
tools/call |
Dispatches to the named tool: geocodes the location, fetches weather from Open-Meteo, formats a text block. Lookup/network failures return isError: true rather than a JSON-RPC error. |
anything else (with an id) |
JSON-RPC error -32601, method not found. |
Upstream calls: Open-Meteo geocoding (geocoding-api.open-meteo.com) then the
forecast endpoint (api.open-meteo.com) with current=temperature_2m,wind_speed_10m,weather_code.
License
MIT — see LICENSE.
Release files for myai-weather-mcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| myai_weather_mcp-0.1.1.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| myai_weather_mcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.5 kB
Release files / myai_weather_mcp-0.1.1.tar.gz
| Download URL | myai_weather_mcp-0.1.1.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0c65603a59e3018e8947b9e8875d2472bb3d996feca33080b93f4da9e2c22e9
|
|
BLAKE2b-256 checksum How to use checksums |
264ba882d58ed491d60970fb3aee2c51d179987b297ccfd27340f58c08df7915
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logRelease files / myai_weather_mcp-0.1.1-py3-none-any.whl
| Download URL | myai_weather_mcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d0bc77b12236a9ced9e9851e048f23b8c525b5f74374fcb38ad317544f5d826
|
|
BLAKE2b-256 checksum How to use checksums |
19099a800b8100241257b889cf9a0b3a4422e8e444119b52f4960e2adf1712da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency log