Swiss Weather

io.github.cuolm由 GitHub 帳號 cuolm 發布v0.4.0更新於 Nov 5, 2026

Weather forecasts, measurements and sun and moon times for places in Switzerland, from MeteoSwiss

已驗證STDIO僅桌面位置與生活資料與分析

概覽

AI 產生的概覽

讓助理取得瑞士各地的 MeteoSwiss 天氣預報、測站即時觀測,以及日出日落與月相時間。

可以做什麼
  • 查詢瑞士某地的預報:每日最高最低溫、以 3 小時為一段的降雨、逐時氣溫、日照時數、風、雲量與零度層高度
  • 讀取鄰近 SwissMetNet 測站的目前觀測,並查看此刻瑞士哪裡最暖、最冷、風最大、雨最多或日照最強
  • 查詢某日的日出、日落、民用曙光與暮光、月出、月落、月相與受照比例
  • 依瑞士國家地圖解析地名,名稱有歧義時列出候選並提示 near 參數
  • 取得目前瑞士的星期與當地時間,供「明天」「今晚」這類相對問法使用
適用情境
適合回答與瑞士天氣、目前天氣狀況或日照時間有關的問題,例如安排出遊、判斷今天下午會不會下雨,或詢問幾點天黑。它並非全球通用的天氣服務。
執行需求
以 Python 套件在本機執行(uvx 或 uv tool install),使用 stdio 傳輸,也可用 Docker 以 streamable-http 執行。不需要帳號、API 金鑰或設定。需要連線至 MeteoSwiss 與 swisstopo 的開放資料;首次啟動會下載約 70 MB 的地名與邊界資料到本機快取。
安裝前請注意
預報數值是多種模式結果的中位數,跨時段不能相加,因此分段雨量可能與整日數值不同。觀測來自最近且合適的測站,可能距離較遠或海拔不同,回答中會說明。本專案並非 MeteoSwiss 官方產品。它會寫入磁碟快取,可用 SWISS_WEATHER_MCP_CACHE_DIR 更改位置。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Swiss Weather,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Swiss Weather MCP Server

[Logo] [PyPI] [License] [Release] [Tests]

A Model Context Protocol (MCP) server that provides AI applications with weather information for any place in Switzerland.

  • Forecasts for today and the next 8 days from the MeteoSwiss local forecasts, updated every hour
  • Measurements from about 160 SwissMetNet weather stations, updated every 10 minutes
  • Places on the Swiss national map, such as towns, districts, lakes and peaks, from swissNAMES3D
  • When the Sun and the Moon rise and set at a place, the civil twilight, the Moon's phase and how much of it is lit, calculated for any day
  • A bundled MCP client for testing

Data sources. This project is not an official MeteoSwiss product.

  • Weather forecasts and measurements: MeteoSwiss Open Data. Source: MeteoSwiss
  • Place names: swissNAMES3D. Source: Federal Office of Topography swisstopo
  • Municipalities and cantons: swissBOUNDARIES3D. Source: Federal Office of Topography swisstopo

Table of Contents

Project Structure

text
swiss-weather-mcp/├── src/swiss_weather_mcp/│   ├── server.py           # MCP server and its tools│   ├── places/             # swisstopo place lookup│   ├── forecast/           # MeteoSwiss local forecasts│   ├── measurements/       # MeteoSwiss SwissMetNet measurements│   ├── astronomy/          # Sunrise, sunset, moonrise, moonset and phase│   ├── opendata.py         # Downloads from data.geo.admin.ch│   ├── formatting.py       # Times, wind directions and height differences in the answers│   ├── errors.py           # The error for questions the data cannot answer│   ├── log.py              # Logging setup│   └── client.py           # MCP client├── tests/swiss_weather_mcp/  # Tests└── .github/workflows/      # CI and release pipelines

Installation

bash
# As a command line tooluv tool install swiss-weather-mcp
# With the optional MCP client, which pulls in the OpenAI SDKuv tool install 'swiss-weather-mcp[client]'
# As a library dependencyuv add swiss-weather-mcp  # or: pip install swiss-weather-mcp

From source:

bash
git clone https://github.com/cuolm/swiss-weather-mcp.gitcd swiss-weather-mcpuv sync --extra client  # or, in a virtual environment: pip install -e ".[client]"

No configuration is needed, the server reads everything it requires from MeteoSwiss and swisstopo.

Usage

Running the Server

bash
# stdio (default)swiss-weather-mcp-server
# streamable-httpswiss-weather-mcp-server --transport=streamable-http --host=localhost --port=8050

From a source checkout, put uv run in front. --help lists all flags.

Where the server keeps its files, and --cache-all-forecast-points: see Cache and Downloads.

Running the Server with Docker

Images are built and published automatically by GitHub Actions to the project's GitHub Container Registry, tagged :latest (newest release) and by version.

bash
# Published imagedocker run -p 8050:8050 ghcr.io/cuolm/swiss-weather-mcp:latest
# Built from a source checkoutdocker build -t swiss-weather-mcp .docker run -p 8050:8050 swiss-weather-mcp

The server is then at http://localhost:8050/mcp/.

Each docker run starts a new container with an empty cache. Mount a volume to keep it, for example -v swiss-weather-cache:/root/.cache/swiss-weather-mcp.

Running the MCP Client

The bundled MCP client tests the server over stdio. It needs the client extra (see Installation) and starts the MCP server itself, but not the LLM, which has to be running first, for example in llama-server.

bash
# Install llama.cpp, which provides llama-server, here with Homebrew on macOS or Linuxbrew install llama.cpp
# Start llama-server with a model in its own terminal; it downloads the model on first usellama-server --jinja --no-mmproj -hf unsloth/Qwen3.5-4B-GGUF --port 8080
# Run the client against it in a second terminalswiss-weather-mcp-client --model=unsloth/Qwen3.5-4B-GGUF --base-url=http://localhost:8080/v1

From a source checkout, put uv run --extra client in front of the client. Other ways to install llama.cpp are in its installation guide.

--jinja uses the model's chat template, which tool calling needs (the default in current llama.cpp), and --no-mmproj skips the vision projector. --base-url is the server's OpenAI compatible API, and --model the name it lists under /v1/models.

Available Tools

Times are Swiss local time (see Times). Every tool with a location also takes an optional near, needed only when several places share the name (see Locations). Answers name the forecast point when it is not next to the place (see Forecast Points).

ToolAnswer
forecast_daily(location, start_date, days)1 to 9 days: lowest and highest temperature, rain, weather with an emoji
forecast_rain(location, start, end)Chance and amount of rain in 3-hour blocks
forecast_temperature(location, start, end)Temperature hour by hour, or for one hour
forecast_sunshine(location, start, end)Hours of sunshine over a period, or in one hour
forecast_wind(location, when)Mean speed, gusts and direction
forecast_cloud_cover(location, when)Total cloud cover and its low, medium and high layers
forecast_freezing_level(location, when)Height of the 0 °C line
measurements_current(location)What a station near the place measures now (see Measurements)
measurements_extremes(extreme)Where it is warmest, coldest, windiest, wettest or sunniest now
astronomy_sun(location, date)Sunrise, sunset and civil twilight
astronomy_moon(location, date)Moonrise, moonset, phase and how much is lit
current_date_and_time()Today's weekday and the Swiss time now

Good to Know

Times

  • Times are Swiss clock time in ISO 8601, such as "2026-09-23T14:00". The server applies summer or winter time.
  • Answers give times with their UTC offset, such as 2026-09-23T13:00+02:00.
  • An hourly value stamped 14:00 covers 13:00 to 14:00. Cloud cover and the freezing level are values at that moment.
  • The forecast covers today and the next 8 days. current_date_and_time() gives today's date, which questions such as "tomorrow" or "tonight" need.

Locations

  • A location is a place name from swissNAMES3D: a town, village, city district, peak, pass, lake, glacier, valley or railway station, such as Zürich, Oerlikon, Titlis or Zürichsee.
  • Case and accents don't matter, and a few English names such as Geneva work too.
  • A name of several places, such as Blausee, needs near: a village next to the one the user means, such as near="Riederalp". Without it, the tool lists all places of the name, the biggest first, each with the call that chooses it and the municipality and canton it lies in:
    'Blausee' is the name of 6 places. [...] The biggest first:  location="Blausee", near="Blausee-Mitholz": district and lake, fewer than 20 people, 887 m, municipality Kandergrund, canton Bern  location="Blausee", near="Ramiswil": settlement, fewer than 20 people, 683 m, municipality Mümliswil-Ramiswil, canton Solothurn  ...
  • The municipalities and cantons carry swisstopo's names, in the local language, such as Genève or Graubünden. They appear once the swissBOUNDARIES3D GeoPackage is downloaded in the background at start.
  • An unknown name gets up to 10 suggestions, such as Davos Dorf and Davos Platz for Davos.

Forecast Points

  • The forecast comes from a MeteoSwiss forecast point near the place. An answer names it in data_from when it is more than 1 km away or more than 50 m higher or lower.
  • Temperature changes faster with height than with distance: in the standard atmosphere (ISO 2533), air cools by 0.65 °C per 100 m.
  • So among the points within 5 km, the server takes the one with the smallest distance plus 20 times the height gap: 100 m of height gap counts like 2 km of distance. Without a point within 5 km, it takes the nearest one.
  • The factor 20 was tested on the real data: up to 20, the height gaps of lakes and peaks shrink a lot, and every town of 1,000 people or more still gets a point within 3 km.

Measurements

  • measurements_current uses one of the about 160 SwissMetNet stations: of the 3 with the smallest distance plus 20 times the height gap, the first that published a temperature in the last hour. Stations are far fewer than forecast points, so the station can still be far from the place and higher or lower.
  • Every answer starts with a sentence that says so, such as "The measurements for Braunwald (1290 m) are those of the MeteoSwiss station Elm (958 m), 13.5 km away and 332 m lower."
  • It gives the temperature, humidity, dew point, rain and sunshine in the last 10 minutes, wind, gust, direction and sea-level pressure, plus the temperature and pressure change over the last 3 hours and the rain, sunshine and strongest gust of the last hour.
  • measurements_extremes lists the first 5 stations by temperature or gust. For the wettest, it lists the first 5 rainy stations and counts the rainy stations in Switzerland and in each canton.
  • For the sunniest it groups the stations by their sun in the last 10 minutes with the sunshine terms of MeteoSwiss: mostly sunny (8 to 10 minutes, 80 to 100 %), rather sunny (5 to 7), partly sunny (2 to 4), only a little sunshine (1) and hardly any sunshine (0). MeteoSwiss's ranges meet at 20, 50 and 80 %; a station exactly there counts for the sunnier term, so 2 minutes (20 %) is partly sunny. The cantons come in the order of their stations' average sun.

Forecast Values Are Medians

  • Temperature and rain are the median of the many possible outcomes MeteoSwiss calculates, not the most likely value.
  • Medians do not add up: when showers are possible but unlikely in any 3-hour block, every block shows 0 mm while the day's median is above 0.
  • forecast_daily gives the rain of a day, and forecast_rain the chance and how much a wet hour may bring.

Cache and Downloads

  • The cache lives in your OS cache directory, such as ~/Library/Caches/swiss-weather-mcp on macOS or ~/.cache/swiss-weather-mcp on Linux. SWISS_WEATHER_MCP_CACHE_DIR moves it elsewhere.
  • The first start downloads the swissNAMES3D archive (about 33 MB) and the swissBOUNDARIES3D GeoPackage (about 37 MB, kept unpacked at about 74 MB).
  • MeteoSwiss publishes a new forecast run every hour, each hourly parameter as one file of about 30 to 34 MB for all forecast points. By default the server downloads such a file for every new forecast point and keeps only that point's rows.
  • With --cache-all-forecast-points it keeps the whole files, so further places in the same run need no new download. This helps when many places are asked within the hour, at the cost of disk space.

Example Usage with LMStudio

Using the streamable-http transport layer

Configure the mcp.json file in LMStudio:

json
{  "mcpServers": {    "swiss_weather_mcp_server": {      "url": "http://localhost:8050/mcp/"    }  }}

Run the MCP server with the streamable-http transport, as in Running the Server.

Using the stdio transport layer

Configure the mcp.json file in LMStudio. Replace <path-to> so the command is the full path that which swiss-weather-mcp-server prints:

json
{  "mcpServers": {    "swiss_weather_mcp_server": {      "command": "<path-to>/swiss-weather-mcp-server"    }  }}

[LMStudioMCPServer]

Resources

License

Licensed under the Apache License 2.0.

來源:README.md,提交 3468956

工具

12

forecast_daily

Get the whole-day forecast at a place, for one day or several days in a row. Use this for "how is the weather tomorrow" or "how is the weather at the weekend", and for the total rain of a day. Each day covers a Swiss calendar day, 00:00 to 24:00 local time. The minimum and maximum are the lowest and highest hourly mean temperature of that day, and the weather words describe the daytime. Args: location (str): Name of a place in Switzerland, e.g. "Zürich". start_date (str): The first day, e.g. "2026-09-23". Today or up to 8 days ahead. days (int): How many days in a row, from 1 to 9. Default 1. Returns: dict: data_from when the forecast point is far away or at a significantly different height, the place, one row per day and the model run. In 8 of 10 possible outcomes, the day's rain lies between its 10th and 90th percentile. A value is None when MeteoSwiss does not publish it for the place. Examples: forecast_daily("Zürich", "2026-09-23") forecast_daily("Zürich", "2026-09-26", 2) # a weekend

輸入參數daysnearlocation必填start_date必填

forecast_rain

Get when and how much it may rain at a place, and the weather in words, in 3-hour blocks over a period. Use this for "will it rain at 15:00" or "how is the weather this afternoon". Each block covers the 3 hours between its from and to times and gives the chance of rain, the median rainfall, how much the wettest hour may bring (its 90th percentile) and the weather in words. The median is often 0 when showers are possible, so read the chance and the "up to" amount as well. A period up to the end of the forecast ends with its last full 3-hour block. Medians do not add up, so for the total rain of a whole day use forecast_daily. Args: location (str): Name of a place in Switzerland, e.g. "Zürich". start (str): Start of the period, a full hour, e.g. "2026-09-23T12:00". Today or up to 8 days ahead. end (str): End of the period, a full hour after start, e.g. "2026-09-23T18:00". Returns: dict: data_from when the forecast point is far away or at a significantly different height, the place, one row per 3-hour block and the model run. Examples: forecast_rain("Zürich", "2026-09-23T15:00", "2026-09-23T18:00") # 15:00 forecast_rain("Zürich", "2026-09-23T12:00", "2026-09-23T18:00") # the afternoon

輸入參數end必填nearstart必填location必填

forecast_temperature

Get the temperature hour by hour at a place, with its likely range. Use this for "how warm is it at 15:00" or "how warm is it this afternoon". Without end it returns the one hour starting at start. Each row gives the mean temperature of one hour, between its from and to times. Args: location (str): Name of a place in Switzerland, e.g. "Zürich". start (str): Start of the period, a full hour, e.g. "2026-09-23T15:00". Today or up to 8 days ahead. end (str): Optional. End of the period, a full hour after start, e.g. "2026-09-23T18:00". Returns: dict: data_from when the forecast point is far away or at a significantly different height, the place, one row per hour and the model run. In 8 of 10 possible outcomes, the temperature lies between its 10th and 90th percentile. Examples: forecast_temperature("Zürich", "2026-09-23T15:00") # one hour forecast_temperature("Zürich", "2026-09-23T12:00", "2026-09-23T18:00") # the afternoon

輸入參數endnearstart必填location必填

forecast_sunshine

Get the sunshine hours at a place over a period. Use this for "how sunny is it at 15:00" or "how sunny is it this afternoon". Without end it returns the one hour starting at start. Args: location (str): Name of a place in Switzerland, e.g. "Zürich". start (str): Start of the period, a full hour, e.g. "2026-09-23T06:00". Today or up to 8 days ahead. end (str): Optional. End of the period, a full hour after start, e.g. "2026-09-23T18:00". Returns: dict: data_from when the forecast point is far away or at a significantly different height, the place, the sunshine in hours, the period and the model run. Examples: forecast_sunshine("Zürich", "2026-09-23T15:00") # one hour forecast_sunshine("Zürich", "2026-09-23T12:00", "2026-09-23T18:00") # the afternoon

輸入參數endnearstart必填location必填

forecast_wind

Get the wind at a place at a specific time: mean speed, strongest gust and direction. Use this for "how windy is it at 14:00". The speed is the mean over the hour up to that time, and the gust the strongest one-second gust in that hour. In 9 of 10 possible outcomes the gust stays below its 90th percentile, so the percentile is a cautious high estimate, not the highest gust possible. The direction is where the wind blows from, in degrees clockwise from north (0 is a north wind, 180 a south wind) and as a compass point. Args: location (str): Name of a place in Switzerland, e.g. "Zürich". when (str): A full hour, e.g. "2026-09-23T14:00". Today or up to 8 days ahead. Returns: dict: data_from when the forecast point is far away or at a significantly different height, the place, the wind, the time it is valid for and the model run. Examples: forecast_wind("Zürich", "2026-09-23T14:00")

輸入參數nearwhen必填location必填

forecast_cloud_cover

Get how cloudy it is at a place at a specific time. Use this for "how cloudy is it at 14:00". MeteoSwiss publishes low, medium and high cloud separately, and they overlap, so the total is an estimate that assumes the layers are independent. All three layers are returned as well, so low cloud such as fog can be told apart from high cloud. Args: location (str): Name of a place in Switzerland, e.g. "Zürich". when (str): A full hour, e.g. "2026-09-23T14:00". Today or up to 8 days ahead. Returns: dict: data_from when the forecast point is far away or at a significantly different height, the place, the total cloud cover and its low, medium and high layers in percent, the time it is valid for and the model run. Examples: forecast_cloud_cover("Zürich", "2026-09-23T14:00")

輸入參數nearwhen必填location必填

forecast_freezing_level

Get the freezing level, the height of the 0 °C line, at a place at a specific time. Use this for "how high is the freezing level at 14:00". Args: location (str): Name of a place in Switzerland, e.g. "Zürich". when (str): A full hour, e.g. "2026-09-23T14:00". Today or up to 8 days ahead. Returns: dict: data_from when the forecast point is far away or at a significantly different height, the place, the freezing level in metres above sea level, the time it is valid for and the model run. Examples: forecast_freezing_level("Zürich", "2026-09-23T14:00")

輸入參數nearwhen必填location必填

measurements_current

Get the latest measurements of a MeteoSwiss station near a place. Use this for "how warm is it now" or "is it raining now". The values are those of the station named in data_from. MeteoSwiss publishes new values about every 10 minutes. Args: location (str): Name of a place in Switzerland, e.g. "Zürich". Returns: dict: data_from, the place, the time of the measurements and the measured values. A value is None when the station has not published it. Examples: measurements_current("Zürich")

輸入參數nearlocation必填

measurements_extremes

Get where in Switzerland it is warmest, coldest, windiest, wettest or sunniest now. Use this for "where is it warmest now" or "where is it sunny now". The values are those of about 160 MeteoSwiss stations, so give the altitude with each station. For the sunniest, the stations are grouped by their sun in the last 10 minutes with MeteoSwiss's sunshine terms: mostly sunny (8 to 10 minutes), rather sunny (5 to 7), partly sunny (2 to 4), only a little sunshine (1) and hardly any sunshine (0). The cantons come in order of their stations' average sun, sunniest first. A station is rainy when it had rain in the last 10 minutes. Args: extreme (str): One of "warmest", "coldest", "windiest", "wettest" or "sunniest". Returns: dict: The time of the measurements and the first 5 stations. For the sunniest instead the number of stations in each sunshine group, in Switzerland and in each canton, the sunniest canton first. For the wettest also the number of rainy stations out of those that measure rain, in Switzerland and in each canton. Examples: measurements_extremes("warmest")

輸入參數extreme必填

astronomy_sun

Get when the Sun rises and sets at a place on a day, and when civil twilight begins and ends. Use this for "when does the sun rise tomorrow" or "until when is it light tonight". Civil twilight is the light before sunrise and after sunset; outside it, artificial light is normally needed outdoors. The times are for a level horizon, so in a valley the Sun appears later behind the mountains. Args: location (str): Name of a place in Switzerland, e.g. "Zürich". date (str): The day, e.g. "2026-09-23". Returns: dict: The place, the date, the begin of civil twilight, sunrise, sunset and the end of civil twilight. Examples: astronomy_sun("Zürich", "2026-09-23")

輸入參數date必填nearlocation必填

astronomy_moon

Get when the Moon rises and sets at a place on a day, its phase and how much of it is lit. Use this for "when does the moon rise tonight" or "how full is the moon tonight". The times are for a level horizon, so in a valley the Moon appears later behind the mountains. The day has a moon_phase_time when New Moon, First Quarter, Full Moon or Last Quarter happens on it. The lit percent is the one at 12:00. Args: location (str): Name of a place in Switzerland, e.g. "Zürich". date (str): The day, e.g. "2026-09-23". Returns: dict: The place, the date, the moonrise and moonset, None when the Moon does not rise or set that day, the phase with its emoji and time, and the lit percent. Examples: astronomy_moon("Zürich", "2026-09-23")

輸入參數date必填nearlocation必填

current_date_and_time

Get the current weekday and Swiss local time. Call this first when the question is relative, such as "tomorrow" or "tonight", because the forecast tools take a real date rather than an offset. The time is written the way the tools read it, ISO 8601 without an offset, so it can be sent back to them as it is. Returns: str: For example "Today is Wednesday, 2026-09-23T13:02 (Swiss time)".

無需輸入參數。

版本歷史

1
  1. v0.4.0最新Nov 4, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分