llm-cost-ledger-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LEDGER_FILE | No | Where events are appended as JSON lines. Default `data/ledger.jsonl`. Data survives restarts. | data/ledger.jsonl |
| PRICING_FILE | No | Path to a JSON price table (see `pricing.example.json`). Prices are US dollars per million tokens. The built-in prices are placeholders (`example-small`, `example-large`), so point this at your provider's real, current prices before trusting any number. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| resources | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| record_usageA | Record token usage of one LLM call against a session. Returns the cost of this call in US dollars. |
| session_costB | Total cost in US dollars of every recorded call in a session, split by token type. |
| cost_reportA | Spend grouped by session, model or day, biggest first. Optionally only events since a date. |
| list_modelsB | Models the ledger knows a price for, with prices per million tokens. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| pricing | The price table in use, US dollars per million tokens |
TDQS
Scored across 4 tools
record_usage and list_models are clearly distinct actions, and session_cost vs cost_report are separated by scope (single session, token-type breakdown) versus multi-group reporting with date filtering. The two reporting tools still overlap enough that an agent may occasionally pick the wrong one for a simple spend question.
All names use consistent snake_case and are readable. There is a minor deviation in verb ordering (record_usage/list_models are verb-first, session_cost/cost_report are noun-first), but the pattern remains predictable within each pair.
Four tools is a tight, well-scoped surface for a cost ledger: one write path, two query paths, and one reference lookup. Each tool earns its place with no redundant entries.
The core lifecycle of recording usage and reporting cost is covered, including price reference via list_models. However, there is no way to correct or delete a mis-recorded call, and no explicit session enumeration outside of cost_report grouping.