Skip to content

[Feature]: Live Token Tracking Card / Dashboard #83

@askdba

Description

@askdba

Problem Statement

Currently, token tracking data is only available via structured logs or audit files. While useful for post-hoc analysis, users often want a live, visual way to monitor their token consumption and estimated costs in real-time while using the MCP server or REST API.

Proposed Solution

Implement a "Token Tracking Card"—a live monitoring interface accessible via the HTTP server.

1. Real-time Metrics Aggregator

  • Implement an internal aggregator that tracks cumulative input/output tokens and costs since server startup.
  • Add a new API endpoint GET /api/metrics/tokens that returns:
    • Current session totals (Input, Output, Total).
    • Estimated cost in USD.
    • Efficiency metrics (Tokens per row, IO efficiency).
    • Last 5 query token counts.

2. Visual Card / Monitoring UI

  • Add an optional embedded monitoring UI (the "Card") that can be enabled via:
    • CLI: --token-card
    • Config: features.token_card: true
  • When enabled, the REST API root (/api) or a dedicated (/status) page can show a live-updating dashboard with the usage statistics.

3. Live CLI View (Optional)

  • Consider a CLI-based "live view" (similar to top) that can be activated to show usage data in the terminal.

Feature Category

Configuration / Other

Priority

Important

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions