CLI & MCP server
The same read-only analytics API, wired up for a terminal or an AI assistant instead of the dashboard UI.
Every dashboard number is also available through a small, read-only, api_key- authenticated API — see the API reference and the machine-readable spec at /openapi.json. Two thin wrappers over that same API ship in this codebase:
- shonylabs-cli — a terminal command (
shonylabs stats,shonylabs live,shonylabs funnels) for you or a coding agent (Cursor, Claude Code, Codex) to pull real numbers into a shell session. - shonylabs-mcp-server — the same three operations exposed as MCP tools (
get_stats,get_live_visitors,get_funnels) for Claude and other MCP-compatible assistants.
Both are not yet published to the npm registry — reach out at [email protected] for early access to the package source in the meantime. Once published, installation will be a single npm install -g shonylabs-cli / npm install -g shonylabs-mcp-server.
Authentication
Both tools authenticate with a site's own API key — the same Authorization: Bearer <api_key> credential documented in the API reference, managed under Settings → API. Credentials are always passed as an environment variable, never a tool argument — an AI assistant using the MCP server can ask "how are visitors today" without ever seeing or being able to set the key itself.
CLI usage
export SHONYLABS_API_KEY=sk_live_...
shonylabs stats --range last7d
shonylabs live
shonylabs funnels --range last30d --jsonPass --json on any command for the raw response shape instead of the formatted summary. --range accepts today, yesterday, last24h, last7d, last30d, last12m, wtd, mtd, ytd, or all (defaults to last7d).
MCP server usage
Add it to your MCP client's server config:
{
"mcpServers": {
"shonylabs-analytics": {
"command": "node",
"args": ["/path/to/mcp-server/index.js"],
"env": { "SHONYLABS_API_KEY": "sk_live_..." }
}
}
}Exposes three tools: get_stats, get_live_visitors, and get_funnels — each takes the same optional range parameter as the CLI.
What these don't do
Both are read-only. Writing data — attaching an identity, recording a transaction, or reporting an error — goes through the ingestion API instead; see Identify users, Transactions, and Error tracking.