AI Integration

Model Context Protocol

MobilityTwin.Brussels exposes an MCP server that lets AI assistants — like Claude or ChatGPT — directly discover and query Brussels' mobility datasets through a standardized protocol.

Sign in once, in your browser

Add the server URL to your assistant. The first time it connects, it opens a MobilityTwin.Brussels page where you sign in (or create an account) and click Allow access. No token to copy: the assistant renews its own access, its requests show up in your account usage, and you can disconnect it there at any time.

Available Tools

list_datasets

Every group and endpoint with its format, refresh interval and a one-line description.

No parameters
get_dataset_info

One endpoint in detail: history range, freshness of the latest snapshot, typical size, REST paths.

groupendpoint
preview_data

What a snapshot looks like — record count, fields with types and examples, two samples — without pulling it into the chat.

groupendpointtimestamp?
get_data

A whole snapshot when it is small (weather, one Villo snapshot). Bigger ones come back summarised, with the way to fetch them in code.

groupendpointtimestamp?
plan_download

For a time range: how many snapshots, MB and minutes, and the exact Python or CLI commands to fetch them.

groupendpointstartend?every_seconds?
get_api_token

A token for the scripts the assistant runs for you, named after it on your account page; revoke it there any time.

No parameters

Big downloads: data never goes through the chat

A network-wide snapshot is often megabytes and a day holds thousands of them. The MCP tools only describe and preview data; when an assistant can run code (Claude Code, Cursor, notebooks) it downloads the range itself with a single-file Python client, then reports results. You can use the same client without any AI.

curl -O https://mobilitytwin.brussels/client/mobilitytwin.py
echo "MOBILITYTWIN_TOKEN=<your token>" >> .env

# one STIB snapshot per minute for a morning, resumable
python mobilitytwin.py download stib/vehicle-position \
    --start 2026-09-01T05:00Z --end 2026-09-01T09:00Z \
    --every 60 --out data
from mobilitytwin import MobilityTwin

mt = MobilityTwin()                      # token from .env
when, weather = mt.latest("environment/weather")

# every daily GTFS of a week, one zip per day
mt.download("sncb/gtfs-parquet", "2026-09-01", "2026-09-08")

# stream without files
for snap, data in mt.iter_snapshots("villo/stations", "-6h", every=300):
    gdf = mt.to_geodataframe(data)

Under the hood: GET /<group>/<endpoint>/index?start_timestamp=…&end_timestamp=… lists every snapshot in the range with a public download URL (10,000 per page); the client fetches them in parallel and skips files it already has.

Connect

Claude Code

Run once in a terminal, then type /mcp in Claude Code to sign in:

claude mcp add --transport http mobilitytwin https://mobilitytwin.brussels/mcp

Claude.ai & Claude Desktop

Open Settings → Connectors → Add custom connector, paste the URL and click Connect:

https://mobilitytwin.brussels/mcp

Any MCP Client

Point any MCP-compatible client to the endpoint:

https://mobilitytwin.brussels/mcp

Streamable HTTP transport with OAuth 2.1 sign-in. Clients without OAuth can send an API token as Authorization: Bearer <token>.

Example Workflow

1

Discover available data

The AI agent calls list_datasets to see all groups and endpoints, then get_dataset_info for details on a specific one.

2

Approve access once

On first use the assistant opens a sign-in page in your browser. You approve it once; your password never goes through the chat.

3

Preview, then fetch in code

The agent looks at a snapshot with preview_data. For a time range or a large snapshot it calls plan_download and runs the script it gets, so the data lands on disk rather than in the chat.

4

Analyze & respond

The agent analyses the files in code — GeoJSON, GTFS, GTFS-RT, Parquet — and answers with tables, figures and numbers, citing the snapshot times it used.