stmo-cli
How it works
stmo-cli is a CLI that Claude Code calls on your behalf. Install it, set your API key, and Claude Code can:
- Explore — discover data sources, find existing queries, browse schemas
- Write — create new Redash queries with proper BigQuery SQL
- Deploy — push queries, charts, and dashboards to STMO
- Execute — run queries and inspect results
- Analyze — export data for deeper analysis with other tools
For example, ask Claude Code to:
- "Find queries about Firefox DAU"
- "Write a query to track [metric] over time"
- "Fetch and run query #12345"
- "Explore what telemetry tables are available"
Pair it with the mozdata plugin for telemetry expertise and probe discovery.
Prerequisites
- Redash API key from https://sql.telemetry.mozilla.org
Installation
For people who already have the Firefox source stored locally
cd /path/to/your/firefox/source/folder
./mach bootstrap
For anyone else
Install cargo-binstall.
cargo binstall stmo-cli
Build from source:
# The binary will be at ./target/release/stmo-cli
Setup
-
Get your Redash API key from your user profile
-
Set environment variables:
# optional, this is the default
For Mozilla, the key can be accessed via the following URL: https://sql.telemetry.mozilla.org/users/me
- Create directories:
- Discover available queries:
- Fetch specific queries:
Usage
Fetch Queries from Redash
This creates/updates:
queries/{id}-{slug}.sql- Query SQLqueries/{id}-{slug}.yaml- Query metadata (parameters, visualizations, etc.)
Deploy to Redash
Warning: This force overwrites the queries in Redash. Git is the source of truth.
File Structure
queries/
├── 123-mobile-crashes.sql
└── 123-mobile-crashes.yaml
dashboards/
└── 456-my-dashboard.yaml
Query IDs are embedded in filenames ({id}-{slug}.{ext}), so no separate config file is needed.
Development
Pre-commit Hooks
The project uses clippy in pedantic mode:
Install pre-commit hooks:
Building for Release
Architecture
See CLAUDE.md for detailed architecture documentation.