autobahn-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- autobahn_mcp-0.1.0/.github/workflows/publish.yml +20 -0
- autobahn_mcp-0.1.0/.github/workflows/registry.yml +61 -0
- autobahn_mcp-0.1.0/.github/workflows/smoke.yml +21 -0
- autobahn_mcp-0.1.0/LICENSE +21 -0
- autobahn_mcp-0.1.0/PKG-INFO +71 -0
- autobahn_mcp-0.1.0/README-de.md +51 -0
- autobahn_mcp-0.1.0/README-fa.md +51 -0
- autobahn_mcp-0.1.0/README.md +59 -0
- autobahn_mcp-0.1.0/pyproject.toml +25 -0
- autobahn_mcp-0.1.0/server.json +1 -0
- autobahn_mcp-0.1.0/src/autobahn_mcp/__init__.py +7 -0
- autobahn_mcp-0.1.0/src/autobahn_mcp/domain.py +88 -0
- autobahn_mcp-0.1.0/src/autobahn_mcp/http.py +99 -0
- autobahn_mcp-0.1.0/src/autobahn_mcp/server.py +127 -0
- autobahn_mcp-0.1.0/tests/__init__.py +0 -0
- autobahn_mcp-0.1.0/tests/fixtures/closures-a1.json +1 -0
- autobahn_mcp-0.1.0/tests/fixtures/ev-a1.json +1 -0
- autobahn_mcp-0.1.0/tests/fixtures/parking-a1.json +1 -0
- autobahn_mcp-0.1.0/tests/fixtures/roadworks-a1.json +1 -0
- autobahn_mcp-0.1.0/tests/fixtures/traffic-empty.json +1 -0
- autobahn_mcp-0.1.0/tests/fixtures/warnings-a100.json +1 -0
- autobahn_mcp-0.1.0/tests/smoke_live.py +17 -0
- autobahn_mcp-0.1.0/tests/test_domain.py +103 -0
- autobahn_mcp-0.1.0/tests/test_live.py +56 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write # required for PyPI trusted publishing (OIDC)
|
|
12
|
+
contents: read
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- run: pip install build
|
|
19
|
+
- run: python -m build
|
|
20
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Publish to MCP Registry
|
|
2
|
+
|
|
3
|
+
# Official MCP Registry (registry.modelcontextprotocol.io) via GitHub OIDC.
|
|
4
|
+
# No secret, no interactive login: the runner's OIDC token proves ownership
|
|
5
|
+
# of the io.github.mohammad-abbasi-sh/* namespace.
|
|
6
|
+
# Refs: https://github.com/modelcontextprotocol/registry
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
tags: ["v*"]
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
publish:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
id-token: write # required for OIDC -> MCP Registry
|
|
18
|
+
contents: read
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Sync server.json version to tag
|
|
23
|
+
# Only sync when running on a version tag (v*). On workflow_dispatch
|
|
24
|
+
# (ref = refs/heads/main) keep the version committed in server.json.
|
|
25
|
+
run: |
|
|
26
|
+
VER=""
|
|
27
|
+
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
28
|
+
TAG="${GITHUB_REF#refs/tags/}"
|
|
29
|
+
VER="${TAG#v}"
|
|
30
|
+
fi
|
|
31
|
+
if [ -n "$VER" ]; then
|
|
32
|
+
python3 - "$VER" << 'EOF'
|
|
33
|
+
import json, sys
|
|
34
|
+
ver = sys.argv[1]
|
|
35
|
+
d = json.load(open('server.json'))
|
|
36
|
+
d['version'] = ver
|
|
37
|
+
for pkg in d.get('packages', []):
|
|
38
|
+
pkg['version'] = ver
|
|
39
|
+
json.dump(d, open('server.json', 'w'), indent=2, ensure_ascii=False)
|
|
40
|
+
print('server.json version ->', ver)
|
|
41
|
+
EOF
|
|
42
|
+
else
|
|
43
|
+
echo "No version tag ($GITHUB_REF); keeping server.json version as-is"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
- name: Install mcp-publisher
|
|
47
|
+
run: |
|
|
48
|
+
curl -sL "https://github.com/modelcontextprotocol/registry/releases/download/v1.8.7/mcp-publisher_linux_amd64.tar.gz" -o /tmp/mcp-publisher.tar.gz
|
|
49
|
+
tar -xzf /tmp/mcp-publisher.tar.gz -C /tmp
|
|
50
|
+
sudo mv /tmp/mcp-publisher /usr/local/bin/mcp-publisher
|
|
51
|
+
mcp-publisher --version
|
|
52
|
+
|
|
53
|
+
- name: Validate server.json
|
|
54
|
+
run: mcp-publisher validate server.json
|
|
55
|
+
|
|
56
|
+
- name: Publish to MCP Registry (OIDC)
|
|
57
|
+
run: |
|
|
58
|
+
mcp-publisher login github-oidc
|
|
59
|
+
mcp-publisher publish server.json
|
|
60
|
+
# A registry outage must never break the release; re-run from Actions if needed.
|
|
61
|
+
continue-on-error: true
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Daily live smoke
|
|
2
|
+
|
|
3
|
+
# One fixed probe per day: catches fingerprint rot / bot-wall changes
|
|
4
|
+
# before users hit them. Fails visibly on 403/timeout.
|
|
5
|
+
on:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: "0 6 * * *"
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
smoke:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- name: Install
|
|
19
|
+
run: pip install -e .
|
|
20
|
+
- name: Smoke probe
|
|
21
|
+
run: python tests/smoke_live.py
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mohammad Abbasi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: autobahn-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unofficial read-only MCP server for the German Autobahn (verkehr.autobahn.de) — roadworks, closures, warnings, parking & EV charging
|
|
5
|
+
Author: Mohammad Abbasi
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Requires-Dist: httpx>=0.27
|
|
10
|
+
Requires-Dist: mcp<2
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# autobahn-mcp 🛣️
|
|
14
|
+
|
|
15
|
+
mcp-name: io.github.mohammad-abbasi-sh/autobahn-mcp
|
|
16
|
+
|
|
17
|
+
Unofficial **read-only** MCP server for **[verkehr.autobahn.de](https://verkehr.autobahn.de)** — German Autobahn data from the official verkehr.autobahn.de API: roadworks, closures, warnings, truck/car parking and EV charging stations per motorway. No key, no login.
|
|
18
|
+
|
|
19
|
+
> Built by Mohammad Abbasi as part of the "Germany MCP factory". Not affiliated with verkehr.autobahn.de.
|
|
20
|
+
|
|
21
|
+
## For AI agents
|
|
22
|
+
|
|
23
|
+
Add to your MCP client config (stdio):
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"autobahn": {
|
|
29
|
+
"command": "uvx",
|
|
30
|
+
"args": ["autobahn-mcp==0.1.0"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or run locally: `python -m autobahn_mcp.server` (needs `mcp<2`, `httpx`).
|
|
37
|
+
|
|
38
|
+
## Tools
|
|
39
|
+
|
|
40
|
+
| Tool | Description |
|
|
41
|
+
|------|-------------|
|
|
42
|
+
| `autobahn_roadworks` | Roadworks on a motorway — `road` (e.g. "A1"), `limit` 1..50 |
|
|
43
|
+
| `autobahn_closures` | Closures on a motorway — `road` (e.g. "A1"), `limit` 1..50 |
|
|
44
|
+
| `autobahn_warnings` | Warnings on a motorway — `road` (e.g. "A100"), `limit` 1..50 |
|
|
45
|
+
| `autobahn_parking` | Truck/car parking on a motorway — `road` (e.g. "A1"), `limit` 1..50 |
|
|
46
|
+
| `autobahn_ev_charging` | EV charging stations on a motorway — `road` (e.g. "A1"), `limit` 1..50 |
|
|
47
|
+
| `autobahn_health` | Reachability probe (ok / blocked / error) — one polite request |
|
|
48
|
+
|
|
49
|
+
## Notes
|
|
50
|
+
|
|
51
|
+
- All data comes from the **official verkehr.autobahn.de API** (free, no key).
|
|
52
|
+
- The API's `reststop`, `traffic` and `webcam` services return empty arrays on every probed motorway right now (A1/A3/A7/A9/A100, verified 2026-11-10), so they are not exposed as tools; `parking_lorry` covers parking areas instead.
|
|
53
|
+
- Roadworks and closures can be numerous (A1 currently lists 261 roadworks) — use `limit` to cap the output.
|
|
54
|
+
|
|
55
|
+
Tests: 19/19 green (13 offline + 6 live, 2026-11-10).
|
|
56
|
+
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
python3 -m venv .venv && .venv/bin/pip install "mcp<2" httpx pytest
|
|
61
|
+
.venv/bin/pip install -e .
|
|
62
|
+
.venv/bin/python -m pytest tests/ -q
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
Built by [Mohammad Abbasi](https://github.com/mohammad-abbasi-sh) — [Almanibama](https://almanibama.ir) · [mabbasi.ir](https://mabbasi.ir)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# autobahn-mcp 🛣️
|
|
2
|
+
|
|
3
|
+
mcp-name: io.github.mohammad-abbasi-sh/autobahn-mcp
|
|
4
|
+
|
|
5
|
+
Inoffizieller **nur lesender** MCP-Server für **[verkehr.autobahn.de](https://verkehr.autobahn.de)** — Deutsche Autobahn-Daten über die offizielle API verkehr.autobahn.de: Baustellen, Sperrungen, Warnungen, LKW-/PKW-Parkplätze und E-Ladesäulen je Autobahn. Kein Schlüssel, keine Anmeldung.
|
|
6
|
+
|
|
7
|
+
> Gebaut von Mohammad Abbasi als Teil der "Germany MCP factory". Nicht mit verkehr.autobahn.de verbunden.
|
|
8
|
+
|
|
9
|
+
## Für KI-Agenten
|
|
10
|
+
|
|
11
|
+
Zur MCP-Client-Konfiguration hinzufügen (stdio):
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"autobahn": {
|
|
17
|
+
"command": "uvx",
|
|
18
|
+
"args": ["autobahn-mcp==0.1.0"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Oder lokal starten: `python -m autobahn_mcp.server` (benötigt `mcp<2`, `httpx`).
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
| Tool | Beschreibung |
|
|
29
|
+
|------|-------------|
|
|
30
|
+
| `autobahn_roadworks` | Baustellen auf einer Autobahn |
|
|
31
|
+
| `autobahn_closures` | Sperrungen auf einer Autobahn |
|
|
32
|
+
| `autobahn_warnings` | Warnungen auf einer Autobahn |
|
|
33
|
+
| `autobahn_parking` | Parkplätze auf einer Autobahn |
|
|
34
|
+
| `autobahn_ev_charging` | E-Ladesäulen auf einer Autobahn |
|
|
35
|
+
| `autobahn_health` | Erreichbarkeitsprüfung (ok / blocked / error) — eine höfliche Anfrage |
|
|
36
|
+
|
|
37
|
+
## Entwicklung
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
python3 -m venv .venv && .venv/bin/pip install "mcp<2" httpx pytest
|
|
41
|
+
.venv/bin/pip install -e .
|
|
42
|
+
.venv/bin/python -m pytest tests/ -q
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Lizenz
|
|
46
|
+
|
|
47
|
+
MIT
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
Built by [Mohammad Abbasi](https://github.com/mohammad-abbasi-sh) — [Almanibama](https://almanibama.ir) · [mabbasi.ir](https://mabbasi.ir)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# autobahn-mcp 🛣️
|
|
2
|
+
|
|
3
|
+
mcp-name: io.github.mohammad-abbasi-sh/autobahn-mcp
|
|
4
|
+
|
|
5
|
+
سرور MCP غیررسمی و **فقطخواندنی** برای **[verkehr.autobahn.de](https://verkehr.autobahn.de)** — دادههای اتوبان آلمان از API رسمی verkehr.autobahn.de: کارهای جادهای، بستهشدنها، هشدارها، پارکینگ کامیون/خودرو و ایستگاههای شارژ خودروی برقی برای هر اتوبان. بدون کلید، بدون ورود.
|
|
6
|
+
|
|
7
|
+
> ساختهٔ محمد عباسی، بخشی از «کارخانهٔ MCP آلمان». وابسته به verkehr.autobahn.de نیست.
|
|
8
|
+
|
|
9
|
+
## برای ایجنتهای هوش مصنوعی
|
|
10
|
+
|
|
11
|
+
به پیکربندی MCP کلاینت اضافه کنید (stdio):
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"autobahn": {
|
|
17
|
+
"command": "uvx",
|
|
18
|
+
"args": ["autobahn-mcp==0.1.0"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
یا بهصورت محلی اجرا کنید: `python -m autobahn_mcp.server` (نیازمند `mcp<2` و `httpx`).
|
|
25
|
+
|
|
26
|
+
## ابزارها
|
|
27
|
+
|
|
28
|
+
| ابزار | توضیح |
|
|
29
|
+
|------|-------|
|
|
30
|
+
| `autobahn_roadworks` | کارهای جادهای یک اتوبان |
|
|
31
|
+
| `autobahn_closures` | بستهشدنهای یک اتوبان |
|
|
32
|
+
| `autobahn_warnings` | هشدارهای یک اتوبان |
|
|
33
|
+
| `autobahn_parking` | پارکینگهای یک اتوبان |
|
|
34
|
+
| `autobahn_ev_charging` | ایستگاههای شارژ خودروی برقی یک اتوبان |
|
|
35
|
+
| `autobahn_health` | بررسی دسترسپذیری (ok / blocked / error) — یک درخواست مؤدبانه |
|
|
36
|
+
|
|
37
|
+
## توسعه
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
python3 -m venv .venv && .venv/bin/pip install "mcp<2" httpx pytest
|
|
41
|
+
.venv/bin/pip install -e .
|
|
42
|
+
.venv/bin/python -m pytest tests/ -q
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## لایسنس
|
|
46
|
+
|
|
47
|
+
MIT
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
Built by [Mohammad Abbasi](https://github.com/mohammad-abbasi-sh) — [Almanibama](https://almanibama.ir) · [mabbasi.ir](https://mabbasi.ir)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# autobahn-mcp 🛣️
|
|
2
|
+
|
|
3
|
+
mcp-name: io.github.mohammad-abbasi-sh/autobahn-mcp
|
|
4
|
+
|
|
5
|
+
Unofficial **read-only** MCP server for **[verkehr.autobahn.de](https://verkehr.autobahn.de)** — German Autobahn data from the official verkehr.autobahn.de API: roadworks, closures, warnings, truck/car parking and EV charging stations per motorway. No key, no login.
|
|
6
|
+
|
|
7
|
+
> Built by Mohammad Abbasi as part of the "Germany MCP factory". Not affiliated with verkehr.autobahn.de.
|
|
8
|
+
|
|
9
|
+
## For AI agents
|
|
10
|
+
|
|
11
|
+
Add to your MCP client config (stdio):
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"autobahn": {
|
|
17
|
+
"command": "uvx",
|
|
18
|
+
"args": ["autobahn-mcp==0.1.0"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or run locally: `python -m autobahn_mcp.server` (needs `mcp<2`, `httpx`).
|
|
25
|
+
|
|
26
|
+
## Tools
|
|
27
|
+
|
|
28
|
+
| Tool | Description |
|
|
29
|
+
|------|-------------|
|
|
30
|
+
| `autobahn_roadworks` | Roadworks on a motorway — `road` (e.g. "A1"), `limit` 1..50 |
|
|
31
|
+
| `autobahn_closures` | Closures on a motorway — `road` (e.g. "A1"), `limit` 1..50 |
|
|
32
|
+
| `autobahn_warnings` | Warnings on a motorway — `road` (e.g. "A100"), `limit` 1..50 |
|
|
33
|
+
| `autobahn_parking` | Truck/car parking on a motorway — `road` (e.g. "A1"), `limit` 1..50 |
|
|
34
|
+
| `autobahn_ev_charging` | EV charging stations on a motorway — `road` (e.g. "A1"), `limit` 1..50 |
|
|
35
|
+
| `autobahn_health` | Reachability probe (ok / blocked / error) — one polite request |
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
|
|
39
|
+
- All data comes from the **official verkehr.autobahn.de API** (free, no key).
|
|
40
|
+
- The API's `reststop`, `traffic` and `webcam` services return empty arrays on every probed motorway right now (A1/A3/A7/A9/A100, verified 2026-11-10), so they are not exposed as tools; `parking_lorry` covers parking areas instead.
|
|
41
|
+
- Roadworks and closures can be numerous (A1 currently lists 261 roadworks) — use `limit` to cap the output.
|
|
42
|
+
|
|
43
|
+
Tests: 19/19 green (13 offline + 6 live, 2026-11-10).
|
|
44
|
+
|
|
45
|
+
## Development
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
python3 -m venv .venv && .venv/bin/pip install "mcp<2" httpx pytest
|
|
49
|
+
.venv/bin/pip install -e .
|
|
50
|
+
.venv/bin/python -m pytest tests/ -q
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
Built by [Mohammad Abbasi](https://github.com/mohammad-abbasi-sh) — [Almanibama](https://almanibama.ir) · [mabbasi.ir](https://mabbasi.ir)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "autobahn-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Unofficial read-only MCP server for the German Autobahn (verkehr.autobahn.de) — roadworks, closures, warnings, parking & EV charging"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"mcp<2",
|
|
14
|
+
"httpx>=0.27",
|
|
15
|
+
]
|
|
16
|
+
authors = [{ name = "Mohammad Abbasi" }]
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
autobahn-mcp = "autobahn_mcp.server:main"
|
|
20
|
+
|
|
21
|
+
[tool.hatch.build.targets.wheel]
|
|
22
|
+
packages = ["src/autobahn_mcp"]
|
|
23
|
+
|
|
24
|
+
[tool.pytest.ini_options]
|
|
25
|
+
markers = ["live: tests that hit the real https://verkehr.autobahn.de site"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", "description": "Unofficial read-only MCP server for the German Autobahn — roadworks, closures, warnings & charging.", "name": "io.github.mohammad-abbasi-sh/autobahn-mcp", "packages": [{"identifier": "autobahn-mcp", "registryBaseUrl": "https://pypi.org", "registryType": "pypi", "transport": {"type": "stdio"}, "version": "0.1.0"}], "repository": {"source": "github", "url": "https://github.com/mohammad-abbasi-sh/autobahn-mcp"}, "title": "Autobahn — German motorway roadworks, closures, warnings, parking & EV charging", "version": "0.1.0", "websiteUrl": "https://github.com/mohammad-abbasi-sh/autobahn-mcp"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""autobahn_mcp — unofficial read-only MCP server for verkehr.autobahn.de.
|
|
2
|
+
|
|
3
|
+
German Autobahn data from the official verkehr.autobahn.de API: roadworks, closures, warnings, truck/car parking and EV charging stations per motorway.
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""Domain logic: shape verkehr.autobahn.de API responses into compact
|
|
2
|
+
dicts (stdlib only).
|
|
3
|
+
|
|
4
|
+
Data source: the official Autobahn API
|
|
5
|
+
(https://verkehr.autobahn.de/o/autobahn/{road}/services/{service}) —
|
|
6
|
+
free, no key, no login. Services used: roadworks, closure, warning,
|
|
7
|
+
parking_lorry, electric_charging_station.
|
|
8
|
+
|
|
9
|
+
NOT exposed as tools (verified 2026-11-10): the `reststop` and
|
|
10
|
+
`traffic` services return empty arrays on A1/A3/A7/A9/A100 right now,
|
|
11
|
+
and `webcam` is empty on A1 — so they would only ever return nothing.
|
|
12
|
+
"""
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import json
|
|
16
|
+
import re
|
|
17
|
+
|
|
18
|
+
BASE = "https://verkehr.autobahn.de/o/autobahn"
|
|
19
|
+
|
|
20
|
+
SERVICES = {
|
|
21
|
+
"roadworks": "roadworks",
|
|
22
|
+
"closure": "closure",
|
|
23
|
+
"warning": "warning",
|
|
24
|
+
"parking_lorry": "parking_lorry",
|
|
25
|
+
"electric_charging_station": "electric_charging_station",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_ROAD_RE = re.compile(r"^A\d{1,3}$")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def validate_road(road: str) -> str:
|
|
32
|
+
"""Canonical motorway id, e.g. "A1" or "A100" (case-insensitive)."""
|
|
33
|
+
key = (road or "").strip().upper()
|
|
34
|
+
if not _ROAD_RE.match(key):
|
|
35
|
+
raise ValueError(
|
|
36
|
+
f"invalid road: {road!r} (expected a German motorway like \"A1\" or \"A100\")"
|
|
37
|
+
)
|
|
38
|
+
return key
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def validate_limit(limit: int) -> int:
|
|
42
|
+
if not 1 <= limit <= 50:
|
|
43
|
+
raise ValueError(f"limit out of range: {limit} (expected 1..50)")
|
|
44
|
+
return limit
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def service_url(road: str, service: str) -> str:
|
|
48
|
+
return f"{BASE}/{road}/services/{service}"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _compact(item: dict) -> dict:
|
|
52
|
+
desc = item.get("description") or []
|
|
53
|
+
if isinstance(desc, list):
|
|
54
|
+
desc = " | ".join(s.strip() for s in desc if (s or "").strip())
|
|
55
|
+
coord = item.get("coordinate") or {}
|
|
56
|
+
return {
|
|
57
|
+
"identifier": item.get("identifier") or "",
|
|
58
|
+
"title": item.get("title") or "",
|
|
59
|
+
"subtitle": item.get("subtitle") or "",
|
|
60
|
+
"description": desc,
|
|
61
|
+
"display_type": item.get("display_type") or "",
|
|
62
|
+
"is_blocked": item.get("isBlocked") == "true",
|
|
63
|
+
"future": bool(item.get("future")),
|
|
64
|
+
"start": item.get("startTimestamp") or "",
|
|
65
|
+
"coordinate": (
|
|
66
|
+
{"lat": coord.get("lat"), "long": coord.get("long")}
|
|
67
|
+
if coord else None
|
|
68
|
+
),
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def parse_service(text: str, service: str) -> dict:
|
|
73
|
+
"""Parse one Autobahn service response into {count, items}.
|
|
74
|
+
|
|
75
|
+
Empty arrays are valid — the API returns [] when a road currently
|
|
76
|
+
has no entries of that kind.
|
|
77
|
+
"""
|
|
78
|
+
key = SERVICES[service]
|
|
79
|
+
try:
|
|
80
|
+
data = json.loads(text)
|
|
81
|
+
except json.JSONDecodeError as e:
|
|
82
|
+
raise ValueError(f"invalid {service} response: {e}") from e
|
|
83
|
+
items = data.get(key)
|
|
84
|
+
if items is None:
|
|
85
|
+
raise ValueError(f"unexpected {service} shape: no {key!r} list")
|
|
86
|
+
if not isinstance(items, list):
|
|
87
|
+
raise ValueError(f"unexpected {service} shape: {key!r} is not a list")
|
|
88
|
+
return {"count": len(items), "items": [_compact(it) for it in items]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""HTTP layer for autobahn_mcp — plain httpx GETs against verkehr.autobahn.de.
|
|
2
|
+
|
|
3
|
+
No key, no login. One retry on 429/5xx; error taxonomy (403/429/other).
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import ssl
|
|
9
|
+
import time
|
|
10
|
+
|
|
11
|
+
import httpx
|
|
12
|
+
|
|
13
|
+
UA = (
|
|
14
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
|
|
15
|
+
"(KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
|
|
16
|
+
)
|
|
17
|
+
TIMEOUT = 25.0
|
|
18
|
+
PROBE_URL = "https://verkehr.autobahn.de/o/autobahn/A1/services/roadworks"
|
|
19
|
+
SOURCE = "verkehr.autobahn.de"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class AutobahnMcpError(RuntimeError):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _verify():
|
|
27
|
+
"""TLS trust store: the OS bundle when present, else httpx/certifi."""
|
|
28
|
+
for path in (
|
|
29
|
+
"/etc/ssl/certs/ca-certificates.crt",
|
|
30
|
+
ssl.get_default_verify_paths().openssl_cafile,
|
|
31
|
+
):
|
|
32
|
+
if path and os.path.exists(path):
|
|
33
|
+
return ssl.create_default_context(cafile=path)
|
|
34
|
+
return True
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _client() -> httpx.Client:
|
|
38
|
+
# NOTE: we read the proxy URL from the environment but never log it.
|
|
39
|
+
proxy = os.environ.get("https_proxy") or os.environ.get("HTTPS_PROXY")
|
|
40
|
+
return httpx.Client(
|
|
41
|
+
headers={"User-Agent": UA, "Accept": "application/json, application/xml, text/html, */*"},
|
|
42
|
+
timeout=TIMEOUT,
|
|
43
|
+
proxy=proxy or None,
|
|
44
|
+
trust_env=False,
|
|
45
|
+
verify=_verify(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def fetch_text(url: str) -> str:
|
|
50
|
+
"""GET one URL and return its text. One retry on 429/5xx."""
|
|
51
|
+
last_exc: Exception | None = None
|
|
52
|
+
r: httpx.Response | None = None
|
|
53
|
+
for attempt in range(2):
|
|
54
|
+
try:
|
|
55
|
+
with _client() as c:
|
|
56
|
+
r = c.get(url)
|
|
57
|
+
except httpx.HTTPError as e:
|
|
58
|
+
last_exc = e
|
|
59
|
+
if attempt == 0:
|
|
60
|
+
time.sleep(1.0)
|
|
61
|
+
continue
|
|
62
|
+
raise AutobahnMcpError(f"network error fetching {url}: {e}") from e
|
|
63
|
+
if r.status_code in (429, 500, 502, 503):
|
|
64
|
+
if attempt == 0:
|
|
65
|
+
time.sleep(1.0)
|
|
66
|
+
continue
|
|
67
|
+
break
|
|
68
|
+
assert r is not None # loop always assigns r or raises
|
|
69
|
+
if r.status_code == 403:
|
|
70
|
+
raise AutobahnMcpError(
|
|
71
|
+
f"{SOURCE} returned HTTP 403 for {url} (bot wall) — try again later"
|
|
72
|
+
)
|
|
73
|
+
if r.status_code == 429:
|
|
74
|
+
raise AutobahnMcpError(
|
|
75
|
+
f"{SOURCE} rate-limited the request (HTTP 429) — try again later"
|
|
76
|
+
)
|
|
77
|
+
if r.status_code != 200:
|
|
78
|
+
raise AutobahnMcpError(f"{SOURCE} returned HTTP {r.status_code} for {url}")
|
|
79
|
+
return r.text
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def health_check() -> dict:
|
|
83
|
+
"""One polite probe of the source site.
|
|
84
|
+
|
|
85
|
+
Returns {"status": "ok"|"blocked"|"error", "http_status": int|None,
|
|
86
|
+
"url": ..., "detail": ...}. Used by the `<prefix>_health` tool
|
|
87
|
+
and the daily smoke CI.
|
|
88
|
+
"""
|
|
89
|
+
url = PROBE_URL
|
|
90
|
+
try:
|
|
91
|
+
fetch_text(url)
|
|
92
|
+
except AutobahnMcpError as e:
|
|
93
|
+
msg = str(e)
|
|
94
|
+
if "403" in msg:
|
|
95
|
+
return {"status": "blocked", "http_status": 403, "url": url, "detail": msg}
|
|
96
|
+
if "429" in msg:
|
|
97
|
+
return {"status": "blocked", "http_status": 429, "url": url, "detail": msg}
|
|
98
|
+
return {"status": "error", "http_status": None, "url": url, "detail": msg}
|
|
99
|
+
return {"status": "ok", "http_status": 200, "url": url}
|