微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🚇

慕尼黑公交终端神器 · 实时 S-Bahn 追踪

Mvg · v0.1.0
专业技能 安全 A 级 作者 lars147 公开目录收录
1.3k 下载 0 安装 6.2k 收藏 6 浏览

简介

慕尼黑公共交通 CLI 工具,支持实时 S-Bahn 追踪、路线规划、站点查询与延误提醒,无需认证即可使用 MVG 非官方 API。

原始描述

Munich public transport (MVG) CLI and S-Bahn live tracking. Use for departure times, route planning, nearby stations, service alerts, and real-time S-Bahn po...

通过你的 Agent 添加

点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。

或者手动安装

Claude Codeunzip -o skill.zip -d ~/.claude/skills/mvg/
其它 Agent解压到它自己的 skills 目录,目录名用 mvg

包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。 技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。

中文使用说明 来自收录源

核心用法

MVG CLI 是一款面向慕尼黑公共交通的命令行工具,覆盖 MVG(Münchner Verkehrsgesellschaft)运营的 S-Bahn、U-Bahn、公交及有轨电车系统。核心功能包括:

  • 站点与路线查询:支持模糊搜索站点、地址解析(如 "Hauptstr. 1, München"),并提供多模式路线规划(最快、少换乘、少步行)
  • 实时出发信息:带步行时间偏移(--offset)、交通工具过滤(--type/--exclude)及 JSON 机器输出
  • S-Bahn 实时追踪:通过 geOps WebSocket 获取列车实时位置,支持全线路或单线(如 S3)监控
  • 无障碍与辅助功能:轮椅无障碍路线筛选、步行速度调节(慢/正常/快)
  • 服务预警:站点级或全网延误、施工信息推送

显著优点

  1. 零认证门槛:直接调用 MVG 公开 API(bgw-pt/v3),无需注册或 API Key
  2. 纯标准库依赖:核心功能仅依赖 Python 3 与 urllib,轻量无负担
  3. 实时性强:S-Bahn 位置追踪基于 WebSocket 流式数据,延迟以毫秒级同步
  4. 输出灵活:--json 标志支持脚本集成与自动化工作流
  5. 地址级精度:支持街道门牌号输入,优于纯站点名搜索

潜在局限

  • 非官方 API 风险:依赖 mvg.de 内部端点,存在接口变更或限流可能,无 SLA 保障
  • 地理限制:仅覆盖慕尼黑大区(MVV 范围),无法用于其他德国城市
  • S-Bahn 实时依赖 Node:WebSocket 功能需额外 Node.js 环境与 ws 模块,增加部署复杂度
  • 数据精度:实时位置基于 geOps 第三方服务,极端情况下可能出现列车显示与实际位置偏差
  • 无历史数据:仅提供当前与未来时刻表,不支持过去行程回溯

适合人群

  • 慕尼黑通勤者:需快速查询 U/S-Bahn 出发时间、规划日常通勤路线
  • 开发者与极客:偏好命令行交互、希望将公交数据集成至脚本或终端工作流
  • 无障碍出行用户:轮椅路线筛选功能对 mobility-impaired 用户友好
  • 铁路爱好者:S-Bahn 实时追踪功能满足对列车位置可视化的兴趣

常规风险

  • 服务中断:非官方 API 可能因 MVG 后端调整而失效,需关注项目维护状态
  • 隐私暴露:nearby 功能默认使用坐标,建议确认默认位置是否泄露敏感信息
  • WebSocket 稳定性:实时追踪依赖外部 geOps 服务,网络波动时可能断连
  • 路线规划误差:plannedDeparture 与 plannedArrival 字段易混淆,开发集成时需注意文档提示

技能正文


name: mvg description: Munich public transport (MVG) CLI and S-Bahn live tracking. Use for departure times, route planning, nearby stations, service alerts, and real-time S-Bahn positions. Trigger when the user mentions MVG, S-Bahn, U-Bahn, Munich transit, departures, connections, Abfahrten, Verbindungen, or specific line names like S8, U3, etc.

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

# 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

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

public-transportmunichmvgclireal-timetransit-apis-bahnu-bahnroute-planningwebsocket

同类 Skill