-
Start the server:
./start_server.sh
-
Or manually:
source venv/bin/activate python3 mvg_mcp_server.py
{
"name": "get_mvg_incidents",
"arguments": {
"force_refresh": false
}
}Response:
{
"incidents": [...],
"count": 5,
"cache_info": {
"status": "valid",
"cached_items": 5,
"cached_at": "2024-01-15T10:30:00",
"expires_at": "2024-01-15T10:40:00",
"cache_duration_minutes": 10
}
}{
"name": "search_incidents",
"arguments": {
"query": "verspätung",
"line": "U6"
}
}{
"name": "get_cache_status",
"arguments": {}
}- URI:
mvg://incidents - Type: JSON
- Description: All current MVG incidents
- URI:
mvg://cache-info - Type: JSON
- Description: Current cache status and statistics
{
"title": "Verspätungen nach einer bereits behobenen Störung",
"description": "Liebe Fahrgäste,<br>nach einer bereits behobenen Störung...",
"publication": 1751525520000,
"publication_readable": "03.01.2025 10:32",
"validFrom": 1751525520000,
"validFrom_readable": "03.01.2025 10:32",
"validTo": 1751529120000,
"validTo_readable": "03.01.2025 11:32",
"type": "INCIDENT",
"provider": "MVG",
"lines": [
{
"label": "U6",
"transportType": "UBAHN",
"network": "swm",
"divaId": "010U6",
"sev": false
}
]
}- Duration: 10 minutes minimum
- Auto-refresh: When cache expires
- Force refresh: Use
force_refresh: trueparameter - Status tracking: Available via cache status tool
UBAHN: U-Bahn (Subway)SBAHN: S-Bahn (Suburban train)BUS: BusTRAM: Tram/Streetcar
The server handles:
- Network timeouts
- API unavailability
- Invalid responses
- Cache expiration
- Missing data
Add to your MCP configuration:
{
"mcpServers": {
"mvg-stoerung": {
"command": "python3",
"args": ["mvg_mcp_server.py"],
"cwd": "/path/to/mvg_stoerung_mcp"
}
}
}See example_client.py for a complete example of how to interact with the server programmatically.
This usage guide is for informational purposes only. The data is provided by MVG and is subject to change.
This project is not an official MVG project, not endorsed or recommended. Please ask MVG for permission prior to using it.