Skip to main content
Glama

Etuki AI FinOps MCP Server & Offline .jsonl / CSV Prompt-Cache Auditor (etuki-finops-mcp)

Open-source local stdio Model Context Protocol (MCP) server and CLI calculator for checking LLM API rate cards (452 verified OpenRouter & LiteLLM production models), 10-turn prompt-cache breakeven turns, two-bucket retry cost attribution, and local .jsonl/CSV cache-break diagnostics.

Included Local Stdio MCP Tools (6 Tools)

  1. list_supported_models: Search the 452 live-synced OpenRouter/LiteLLM model rate cards (input, output, cache read, and cache write rates per 1M tokens).

  2. pin_single_model_prefix_cache: Compute 10-turn warm prompt-cache breakeven turns, enterprise contracted rate discounts (contract_discount_multiplier), and two-bucket retry cost attribution (provider_infra_retry_rate vs. model_prompt_retry_rate).

  3. auto_route_task_by_quality_tier: Estimate 6-turn coding task savings when offloading 4 initial repository scan turns to a fast model while keeping 2 synthesis turns on a flagship model with warm cache.

  4. compress_and_fold_context: Fold repetitive middle lines of terminal/compiler logs while preserving head, tail, and error/exception lines.

  5. reconcile_usage_receipt: Compare an actual billed dollar amount against official 1x model rate cards.

  6. audit_local_usage_log: Parse JSONL usage objects in memory to flag mid-session prompt-cache breaks (>5m TTL expirations or prefix shifts).

Related MCP server: ai-cost-calculator-api

Local Stdio MCP Configuration

{
  "mcpServers": {
    "etuki-finops": {
      "command": "npx",
      "args": ["-y", "etuki-finops-mcp"]
    }
  }
}

Offline CLI Usage

# Audit a local .jsonl or .csv usage log offline:
node etuki-saver.mjs ./sample-usage.jsonl --model anthropic/claude-3.7-sonnet

# Run CI/CD Pull Request cost-regression check:
node etuki-saver.mjs --ci-gate --baseline baseline.json --current current.json

License

MIT

Available Tools

9 tools
auto_route_task_by_quality_tierA
Read-onlyIdempotent
Inspect

Simulates a 6-turn coding workflow cost projection comparing unrouted flagship execution against tiered routing across grant pools and warm-cached GA models. Stateless in-memory calculation requiring no authentication and mutating no router settings. Scales per-turn cost linearly with context_tokens relative to current_model; when has_custom_router_config is true, reports a non-intrusive shadow comparison rather than active target IDs. Returns JSON with custom_router_mutex_check, six_turn_cost_breakdown (1 cold write turn + 5 warm read turns), and net_saved_usd (positive USD saved vs unrouted baseline). Use this tool when planning multi-turn task allocation; use check_context_cliff for single-turn length checks or reconcile_usage_receipt for post-hoc invoice auditing.

Inputs: current_model, context_tokens, task_instruction, has_custom_router_config.

check_context_cliffA
Read-onlyIdempotent
Inspect

Evaluates whether a prompt token count crosses vendor long-context surcharge thresholds (100K on Claude Haiku 5.5, 128K on GPT-4o, 200K on Gemini 2.5 Pro, or 272K on GPT-6.1 Sol) and returns the surcharge multiplier and recommended flat-context alternative. Deterministic threshold lookup against the embedded 563-entity UMCE registry requiring no API keys. Returns JSON with crosses_cliff_boolean, active_surcharge_multiplier (1.0x below cliff vs 2.0x-5.0x above cliff), and recommended_flat_context_model. Compares prompt_tokens directly against model's specific cliff boundary in the UMCE catalog. Use this tool before sending large prompts (>90K tokens) to avoid 2x-5x cliff surcharges; use compress_and_fold_context instead to shrink the prompt below the cliff.

Inputs: model, prompt_tokens.

compress_and_fold_contextA
Read-onlyIdempotent
Inspect

Compresses verbose terminal or build logs by folding repetitive middle progress lines while preserving 100% of head lines, tail lines, compiler errors, stack traces, and file paths. Deterministic in-memory string transformation that mutates no files and requires no authentication. Returns JSON containing line_accounting_reconciliation (where raw_total_lines equals kept_original_lines_total plus omitted_repetitive_lines), byte_and_token_reconciliation (pricing saved tokens against model's input rate), and folded_context_payload. When raw_text is empty or under 50 lines, returns the diagnostic benchmark or unmodified input without truncation. Use this tool when build or test output exceeds 50 lines before appending to agent context; use pin_single_model_prefix_cache instead when optimizing static system prompt prefixes.

Inputs: model, raw_text.

detect_model_downgrade_and_substitutionA
Read-onlyIdempotent
Inspect

Evaluates LLM rate-card tiers to quantify relay downgrade risk, cost ratios, and remaining coding session turns. Deterministic in-memory calculation requiring no API keys; unknown model IDs safely fall back to the flagship baseline without error. Sums burned_usd and remaining_usd into the total session pool and projects remaining turns against a $137.45 reference budget, returning cost ratios, an endurance matrix, and a recommended production model ID. Use this tool when comparing session burn rates or suspected relay throttling; use reconcile_usage_receipt for single invoice lines, check_context_cliff for prompt-length surcharges, or optimize_prompt_cache_layout for mid-prompt cache breakpoint fixes.

Inputs: model, burned_usd, remaining_usd.

discover_and_probe_account_modelsA
Read-onlyIdempotent
Inspect

Retrieves verified production GA models and eligible zero-cost grant tiers (Google Cloud Tier 1, AWS Activate Bedrock, OpenRouter :free) from the embedded UMCE registry. Deterministic local snapshot lookup that issues zero network probes, requires no API keys, and consumes zero user quota. Returns JSON listing zero-cost workhorse models, flagship reasoning models, and recommended role assignments benchmarked against current_model (formatted as 'vendor/model-slug', defaulting to 'openai/gpt-6.1-sol'). Use this tool at session startup to inspect available model tiers before calling auto_route_task_by_quality_tier; use list_supported_models instead when filtering the full 563-entity Merkle registry by vendor.

Inputs: current_model.

list_supported_modelsA
Read-onlyIdempotent
Inspect

Queries the embedded UMCE rate-card registry by vendor namespace to retrieve canonical model IDs, input/output/cache USD prices per 1M tokens, context windows, and Merkle leaf hashes. Deterministic local lookup requiring no API keys; unknown vendor slugs safely return total_matched_entities: 0 and an empty models array without error. Passing provider='all' returns the multi-vendor catalog summary, while a specific vendor slug filters strictly by namespace prefix. Use this tool when filtering the full rate-card catalog by vendor; use discover_and_probe_account_models instead at session startup to select zero-cost grant pools and flagship routing tiers.

Inputs: provider.

optimize_prompt_cache_layoutA
Read-onlyIdempotent
Inspect

Reorders a single prompt's dynamic mid-turn tokens after static prefix tokens to prevent 1.25x cold-cache invalidation and restore 0.1x warm cache reads. Advisory in-memory simulation that mutates no live prompts and requires no authentication; zero-token inputs return 0 USD cost without error. Sums static_prefix_tokens and dynamic_mid_tokens to compare before_layout_cost_usd against after_layout_cost_usd and net_savings_pct (0-100). Use this tool when diagnosing mid-prompt timestamps or tool outputs that break cache breakpoints; use pin_single_model_prefix_cache instead to project 10-turn session economics for a target model ID.

Inputs: completion_tokens, dynamic_mid_tokens, static_prefix_tokens.

pin_single_model_prefix_cacheA
Read-onlyIdempotent
Inspect

Projects 10-turn session caching costs for a target model under Case A (100% static prefix) and Case B (90% static prefix + 10% dynamic tail) and outputs provider cache-control templates. In-memory actuarial lookup requiring no API keys; unknown model IDs default to 'openai/gpt-6.1-sol' and prompts under 1,024 tokens bypass warm discounts. Resolves model's warm multiplier (0.05x-0.25x) from the UMCE registry to return provider_cache_protocol_mechanism, ten_turn_cost_comparison_on_same_model, and two_vector_actuarial_reference_table (benchmarking 150K and 200K token reference vectors). Use this tool to quantify 10-turn caching ROI on a specific model; use optimize_prompt_cache_layout instead when fixing mid-prompt token ordering.

Inputs: model, prompt_tokens.

reconcile_usage_receiptA
Read-onlyIdempotent
Inspect

Audits a single API usage receipt against official 1x manufacturer rate cards from the 563-entity UMCE registry to quantify relay multiplier markups and unutilized prefix cache waste. Deterministic mathematical audit in memory requiring no authentication. Returns JSON with expected_theoretical_cost_usd, billing_variance_usd, variance_status ('OVERCHARGED_BY_RELAY_OR_MARKUP' when variance > $0.001 else 'EXACT_RATE_CARD_MATCH'), same_model_unutilized_cache_waste_usd, and net_recoverable_savings_usd. Enforces cached_tokens <= prompt_tokens, pricing (prompt_tokens - cached_tokens) at uncached input rates and cached_tokens at warm cache rates before comparing against actual_billed_usd. Use this tool when verifying an invoice line item; use detect_model_downgrade_and_substitution instead for session-level budget endurance projections.

Inputs: model, cached_tokens, prompt_tokens, actual_billed_usd, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.6/5.0

    Scored across 9 tools

    Disambiguation4/5

    Each tool has a genuinely distinct analytical purpose and the descriptions proactively name sibling tools to steer away from misselection (e.g. 'use check_context_cliff instead'). The main residual risk is the two registry lookups (discover_and_probe_account_models vs list_supported_models) and the three cache-related tools, which an agent can only separate by reading the long descriptions rather than from the names alone.

    Naming Consistency4/5

    All nine names are snake_case and verb-first imperative (list_, compress_, reconcile_, optimize_, check_, pin_, auto_route_), giving a predictable pattern. Minor deviations: two names are compound 'and' phrases (discover_and_probe_, detect_model_downgrade_and_substitution) and name lengths vary from two to five words, making a few names hard to scan.

    Tool Count5/5

    Nine tools is well within the ideal range and each maps to a distinct finops workflow: catalog discovery, routing simulation, session endurance, receipt audit, prefix caching, cache layout, context cliffs, and log compression. No tool feels like filler or a duplicate of another.

    Completeness4/5

    The advisory surface is broad: model/rate-card lookup, routing ROI, budget endurance, invoice reconciliation, cache strategy, and context surcharges are all covered. Gaps remain in write/apply operations (everything is simulation-only, so an agent cannot persist a routing or cache config) and in aggregate reporting across multiple receipts or sessions.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI cost calculation, comparison, and optimization across major providers like Anthropic, OpenAI, Google, Meta, and Mistral. Supports cost estimation, budget-aware model finding, and token estimation through a simple API and MCP integration.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to fetch live, dated prices for LLM models and cloud compute instances across providers, compare and recommend models, and estimate monthly costs based on workload-specific token shapes and constraints.
      MIT