Query and push time-series metrics from your terminal. Works with Trifle App via API or directly against local databases (SQLite, Postgres, MySQL, Redis, MongoDB). Ships an MCP server mode for AI agent integration.
Part of the Trifle ecosystem.
Homebrew (macOS/Linux):
brew install trifle-io/trifle/trifleShell script (macOS/Linux):
curl -sSL https://get.trifle.io | shGo:
go install github.com/trifle-io/trifle-cli@latestBuild locally (Go 1.24+):
go build -o trifle .# Login (stores user token in config)
trifle auth login --url https://app.trifle.io --email user@example.com --password '<password>'
# Create a source and mint a source token
trifle source create project --name "Agent Project"
trifle source list
trifle source token create --source-type project --source-id <PROJECT_ID> --save --activate
# Optional: upload a local SQLite file when creating a database source
trifle source create database --display-name "SQLite Upload" --driver sqlite --sqlite-file ./metrics.sqlitetrifle metrics get \
--key event::signup \
--from 2026-02-10T00:00:00Z \
--to 2026-02-16T00:00:00Z \
--granularity 1h# Set up a local SQLite database
trifle metrics setup --driver sqlite --db ./stats.db
# Push a metric
trifle metrics push --driver sqlite --db ./stats.db \
--key event::signup --values '{"count":1}'
# Query it back
trifle metrics get --driver sqlite --db ./stats.db \
--key event::signup \
--from 2026-02-10T00:00:00Z --to 2026-02-16T00:00:00Z \
--granularity 1h# PostgreSQL
trifle metrics setup --driver postgres --dsn "postgres://user:pass@localhost:5432/myapp"
# MySQL
trifle metrics setup --driver mysql --host 127.0.0.1 --port 3306 --user root --database myapp
# MongoDB
trifle metrics setup --driver mongo --dsn mongodb://127.0.0.1:27017 --database myapp
# Redis
trifle metrics get --driver redis --prefix trifle:metrics --key event::signup \
--from 2026-02-10T00:00:00Z --to 2026-02-16T00:00:00Z --granularity 1hRun Trifle CLI as an MCP server so AI agents (Claude, GPT, etc.) can query and track metrics:
trifle mcp serveThis enables AI agents to read your analytics, track their own token/cost usage, and generate insights through the standard MCP protocol.
Configure write buffering for high-throughput local tracking:
trifle metrics push \
--driver postgres --dsn "postgres://localhost:5432/myapp" \
--key event::signup --values '{"count":1}' \
--buffer-mode auto \
--buffer-duration 2s \
--buffer-size 500 \
--buffer-aggregateFull reference at docs.trifle.io/trifle-cli
| Component | What it does |
|---|---|
| Trifle App | Dashboards, alerts, scheduled reports, AI-powered chat. Cloud or self-hosted. |
| Trifle::Stats (Ruby) | Time-series metrics library for Ruby. |
| Trifle.Stats (Elixir) | Time-series metrics library for Elixir. |
| Trifle Stats (Go) | Time-series metrics library for Go. |
Bug reports and pull requests are welcome on GitHub at https://github.com/trifle-io/trifle-cli.
Available under the Elastic License 2.0. See LICENSE for details.
