Llm MCP Server

Local-first, multi-provider tool that captures LLM API spend and exposes it to coding agents via MCP

Remote serverstreamable-http

What is the Llm MCP server?

Local-first, multi-provider tool that captures LLM API spend and exposes it to coding agents via MCP. Exposed over MCP by the llm mcp server, that capability becomes something an assistant can invoke while it works, not something you go and do afterwards.

What it actually does

LLM Usage & Cost Tracker — your local-first spend watchdog

  • Ask your coding agent. — It's an MCP server, so Claude Code, Cursor, or any MCP client can answer "how much did I spend on Claude this week?" or "which provider is cheapest for a 10k-in / 2k-out call?" in plain English
  • Or type a command. — It's also a CLI — llm-usage spend, llm-usage compare, llm-usage recommend — for when you'd rather not round-trip through an agent
  • Local-first. — No SaaS, no signup, no telemetry. Just a SQLite file at ~/.llm-usage/usage.db. Privacy is a feature, not a setting

Its toolset

Everything the assistant can do here goes through one of these:

  • compare — Rank every priced model by projected cost for an n-input / m-output call. Cheapest first, percent against the cheapest. Default view
  • models — Catalog browser. Sibling of compare, but answers "what does this model charge?" rather than "what would my workload cost?". Rates per million tokens
  • recommend — Picks one. Filters by --provider, --model, and --budget, then returns the cheapest match plus two runner-ups. The reasoning string explains what it
  • spend — Read the SQLite. The default view is a usage_summary headline — total dollars, top-3 providers, top-3 models, largest single call. Pass --group-by to
  • status — One screen, four sections: Database, Capture proxy, Providers, Pricing. The "is everything actually working?" command. Read-only — running it on a
  • providers — Per-provider configuration view. Wider than the status Providers block: adds the wire-format flag (openai-compat: yes/no) and an optional --models
  • about — The front-door panel: version, author, license, and the project homepage. The human-facing companion to --version — fields are read from the

Adding it to your client

Being a remote server, there is no local install. You register the endpoint with your client, authorise it once, and the tools appear.

Configuration

You will need 8 environment variables: ANTHROPIC_API_KEY, OPENAI_API_KEY, DEEPSEEK_API_KEY, DASHSCOPE_API_KEY, ANTHROPIC_BASE_URL, OPENAI_BASE_URL, DEEPSEEK_BASE_URL, LLM_USAGE_DB_URL. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

When to reach for it

Among the AI and media services options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. Llm's toolset — compare, models, recommend and 4 more — is a fair guide to whether it matches your workflow. It is maintained by Y.Zhao; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against Llm's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Caveats

  • Your data travels to the provider's service, so the usual questions apply about what you send and what they retain.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the llm mcp server does with a few real requests.

Available tools

ToolWhat it does
compareRank every priced model by projected cost for an n-input / m-output call. Cheapest first, percent against the cheapest. Default view family-deduplicates rows that share both a model family root *and* an identical price —
modelsCatalog browser. Sibling of compare, but answers "what does this model charge?" rather than "what would my workload cost?". Rates per million tokens, sorted alphabetically by provider by default; switch with --sort input
recommendPicks one. Filters by --provider, --model, and --budget, then returns the cheapest match plus two runner-ups. The reasoning string explains what it assumed and what got chosen, so you can sanity-check rather than trust b
spendRead the SQLite. The default view is a usage_summary headline — total dollars, top-3 providers, top-3 models, largest single call. Pass --group-by to switch into rollup mode.
statusOne screen, four sections: Database, Capture proxy, Providers, Pricing. The "is everything actually working?" command. Read-only — running it on a fresh install before you've ever booted the proxy or MCP server prints da
providersPer-provider configuration view. Wider than the status Providers block: adds the wire-format flag (openai-compat: yes/no) and an optional --models expansion that lists every priced model under each provider.
aboutThe front-door panel: version, author, license, and the project homepage. The human-facing companion to --version — fields are read from the installed package metadata, so they match what PyPI shows.

How to install the Llm MCP server

{
  "mcpServers": {
    "llm-usage": {
      "command": "uvx",
      "args": ["llm-usage-mcp"],
      "env": {
        "ANTHROPIC_API_KEY": "your-value",
        "OPENAI_API_KEY": "your-value",
        "DEEPSEEK_API_KEY": "your-value",
        "DASHSCOPE_API_KEY": "your-value",
        "ANTHROPIC_BASE_URL": "your-value",
        "OPENAI_BASE_URL": "your-value",
        "DEEPSEEK_BASE_URL": "your-value",
        "LLM_USAGE_DB_URL": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

VariableDescriptionRequired
ANTHROPIC_API_KEYCredential the server authenticates with.Yes
OPENAI_API_KEYCredential the server authenticates with.Yes
DEEPSEEK_API_KEYCredential the server authenticates with.Yes
DASHSCOPE_API_KEYCredential the server authenticates with.Yes
ANTHROPIC_BASE_URLEndpoint or connection string the server talks to.Yes
OPENAI_BASE_URLEndpoint or connection string the server talks to.Yes
DEEPSEEK_BASE_URLEndpoint or connection string the server talks to.Yes
LLM_USAGE_DB_URLEndpoint or connection string the server talks to.Yes

Example prompts to try

  • Use Llm to compare.
  • Use Llm to models.
  • Use Llm to recommend.

Frequently asked questions

It connects Llm to MCP-compatible AI assistants such as Claude and Cursor, exposing 7 tools (compare, models, recommend, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Llm directly.