mvg

TotalClaw 作者 totalclaw

慕尼黑公共交通 (MVG) CLI 和 S-Bahn 实时跟踪。用于出发时间、路线规划、附近车站、服务警报和实时 S-Bahn 位置。当用户提及 MVG、S-Bahn、U-Bahn、慕尼黑公交、出发、转乘、Abfahrten、Verbindungen 或特定线路名称(如 S8、U3 等)时触发。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~lars147-mvg-cli
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~lars147-mvg-cli/file -o lars147-mvg-cli.md
## 概述(中文)

慕尼黑公共交通 (MVG) CLI 和 S-Bahn 实时跟踪。用于出发时间、路线规划、附近车站、服务警报和实时 S-Bahn 位置。当用户提及 MVG、S-Bahn、U-Bahn、慕尼黑公交、出发、转乘、Abfahrten、Verbindungen 或特定线路名称(如 S8、U3 等)时触发。

## 原文

# MVG CLI

Munich public transport from the terminal. Uses the unofficial MVG API (`bgw-pt/v3`) — no auth needed.

## Setup

- **CLI**: `python3 <skill_dir>/mvg_cli.py`
- **Dependencies**: Python 3, `urllib` (stdlib only)
- **S-Bahn Live**: Requires `node` + `ws` module for WebSocket connection

## Commands

```bash
# Station search
mvg search "Marienplatz"

# Departures
mvg departures "Marienplatz"
mvg departures "Marienplatz" --type ubahn --limit 20
mvg departures "Daglfing" --offset 5          # +5min walking time

# Route planning (stations or addresses)
mvg route "Marienplatz" "Garching"
mvg route "Hauptstr. 1, München" "Flughafen"  # address support
mvg route "Pasing" "Ostbahnhof" --time "08:30" --mode less-changes

# Nearby stations
mvg nearby                                     # default coords
mvg nearby 48.1351 11.5820

# Service alerts
mvg alerts
mvg alerts --station "Marienplatz"

# Lines
mvg lines --type sbahn

# S-Bahn live tracking (real-time via geOps WebSocket)
mvg live                                       # all S-Bahn lines
mvg live --line S3                             # specific line
```

All commands support `--json` for machine-readable output.

## Transport Type Filters

Use with `--type` or `--exclude`: `ubahn`, `sbahn`, `bus`, `tram`, `bahn` (RE/RB), `regionalbus`, `ruftaxi`

## Route Options

- `--mode`: `fast` (default), `less-changes`, `less-walking`
- `--walk-speed`: `slow`, `normal` (default), `fast`
- `--accessible`: wheelchair-accessible routes only
- `--via "Station"`: route via intermediate stop
- `--arrive`: interpret `--time` as arrival time

## API Notes

- Base URL: `https://www.mvg.de/api/bgw-pt/v3/`
- Endpoints: `/locations`, `/departures`, `/routes`, `/stations/nearby`, `/lines`, `/messages`
- Arrival time in route responses: use `to.plannedDeparture` (not `plannedArrival`)
- S-Bahn live: `wss://api.geops.io/realtime-ws/v1/` with `GET sbm_full` + `SUB sbm_full` + `BBOX`
- Delays from geOps are in milliseconds