Metadata-Version: 2.5
Name: transitlab
Version: 0.2.2
Summary: Query open NYC transit data (subway, bus, taxi, Uber and Lyft) from the command line, with DuckDB. Includes an MCP server for AI agents.
Project-URL: Homepage, https://transitlab.nyc/data
Project-URL: Documentation, https://docs.transitlab.nyc/start/cli-and-mcp
Project-URL: Data, https://data.transitlab.nyc/v1/catalog.json
Author-email: Transit Lab <hello@transitlab.nyc>
License-Expression: MIT
License-File: LICENSE
Keywords: bus,duckdb,mcp,nyc,open-data,parquet,subway,taxi,transit
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.10
Requires-Dist: duckdb>=1.3
Requires-Dist: mcp<2,>=1.9
Description-Content-Type: text/markdown

# transitlab

Query open NYC transit data from [Transit Lab](https://transitlab.nyc/data) on your own computer.
Subway run times and slow zones, bus speeds and lanes, taxi trips, Uber and Lyft trips, service alerts.
It reads our public Parquet files with DuckDB, so there is nothing to sign up for and no key.

```sh
uvx transitlab tables
uvx transitlab describe subway_stop_events
uvx transitlab sql "select route_id, count(*) as stops from subway_stop_events group by 1 order by 2 desc limit 5"
uvx transitlab sql "select * from bus_lanes limit 100" --format csv -o lanes.csv
uvx transitlab download subway_segment_times --from 2026-01 --to 2026-03 -o data
```

Big tables are one file a month or a day. `--from` and `--to` pick which files to read (YYYY-MM-DD or
YYYY-MM). They do not trim rows inside those files; add a `WHERE` for that. Filtering on the `year` and
`month` columns in SQL skips files the same way.

## Run it on our servers

With a free key from https://transitlab.nyc/api-keys, `--remote` sends the query to the hosted SQL API
(api.transitlab.nyc) instead of reading the files on your computer. It returns at most 10,000 rows
(`--limit`, default 1,000) and stops after 30 seconds.

```sh
export TRANSITLAB_API_KEY=tl_live_...
uvx transitlab sql --remote "select count(*) from taxi_yellow_trips where year = 2026 and month = 8"
```

## For AI agents

```sh
claude mcp add transitlab -- uvx transitlab mcp
```

`transitlab mcp --config claude-desktop` and `--config cursor` print the settings for those apps.
The server has five tools: `list_tables`, `describe_table`, `run_sql` (read-only, 1,000 rows, 60 seconds),
`example_queries` and `send_feedback`.

## Tell us what is wrong

A query failed and the error did not say why? A doc or a table looks wrong? Something is missing? Send a report.
It needs no key, and a person reads every one. At most 10 an hour.

```sh
uvx transitlab feedback "bus_route_speeds has no rows for the B44 after March" --context "table bus_route_speeds"
uvx transitlab feedback "count(*) on bus_lanes returns a 500, not a number" --context "select count(*) from bus_lanes; error: 500 server"
```

Agents use the `send_feedback` tool instead. It is the same as `POST https://api.transitlab.nyc/v1/feedback`.

Docs: https://docs.transitlab.nyc/start/cli-and-mcp. Data: CC BY 4.0. Credit transitlab.nyc and the
original source (MTA, NYC DOT or NYC TLC).
