Skip to main content
Glama

Leanfare

Latest release Tests License

Leanfare makes your Claude plan last longer. Claude keeps the hard parts of a task and hands the simple ones, like reading files, searching and drafting, to free or cheaper models. You keep working in Claude as before.

A plan in Cowork, sample data: Leanfare runs the reading parts on cheaper models while Claude Opus keeps the fix, then Claude checks every answer

Leanfare is early and changes every week. If something breaks, report a bug; Settings, Report a problem, fills in your version. Questions and ideas go to Discussions.

How it works

  1. You ask Claude for something, in Claude Desktop, Cowork or Claude Code.

  2. Claude asks Leanfare for a plan. Leanfare splits the task into parts and picks a model for each: free or cheap models for reading and drafting, Claude's own models for the hard parts.

  3. Leanfare sends its parts to those models and hands the answers back. Claude does the rest, checks every answer, and answers you.

  4. Leanfare's report shows what each prompt used and what it saved.

Related MCP server: mcp-local-llm

Get started

On macOS or Linux, paste this in Terminal:

curl -fsSL https://raw.githubusercontent.com/pouriaetab/leanfare/main/install.sh | sh

On Windows, paste this in PowerShell:

powershell -ExecutionPolicy Bypass -c "irm https://raw.githubusercontent.com/pouriaetab/leanfare/main/install.ps1 | iex"

Then type leanfare in the same window. In the page that opens, press Turn on Leanfare, then restart Claude. That's all.

Leanfare needs at least one model to hand work to. It uses the API keys and Ollama models already on your computer, and Settings connects free ones with one press each: ChatGPT (a free account works), Gemini, Groq, OpenRouter, Mistral and Cloudflare.

Other ways in: the Claude Code plugin (/plugin marketplace add pouriaetab/leanfare, then /plugin install leanfare@leanfare), or a one click .mcpb file for Claude Desktop from the latest release.

What you see

The report. Every prompt with its main model, Claude's helpers and the outside models, and what was saved. By prompt or by model, over any days.

The Usage report, by prompt: each prompt's main model, Claude's helpers, the outside models, and what was saved

Claude's own models. Leanfare picks the Claude model for each helper Claude starts, from llmledger's ratings and prices. As the ratings stand: Fable 5.1 for the hardest parts, Opus 5.5 for high effort, Sonnet 5.5 for medium and Haiku 5.5 for light code. Cowork can ask you to approve each helper, so you choose how many a prompt starts: one per part, one per prompt, or none.

Settings, Claude's own models: the order, each kind's pick, and how many helpers

Three settings

  1. Level, from 1 (Off) to 5 (All it can): how much Claude hands to Leanfare first.

  2. Helpers: one per part, one per prompt (the default), or none.

  3. Where work may go: only this computer, or the providers you ticked.

In Cowork and Claude Desktop, a row just above the message box sets the level (or Off), the speed, the quality and the models for the chat you are in. Leanfare picks the rest for you. The guide explains every part.

What's inside

Leanfare is an MCP server with a small web app, both on your computer. Claude connects to it over stdio, like any MCP server. It is TypeScript on Bun, with no runtime dependencies.

File

What it is

src/mcp.ts

The MCP server and its tools

src/cli.ts

The leanfare command

src/server.ts

The app and its API, at http://127.0.0.1:4747

src/planner.ts

Plans: the parts, a model for each, the runs

src/delegate.ts

Hand offs to outside models, each with a receipt

src/claudeladder.ts

Claude's own models, in order

ui/

The app's screens

The MCP tools: plan, plan_run, plan_status, plan_stop, delegate, ask, grade, level, report, spend, models, estimate, trial, local_model, live and helper.

To build and run it from source:

git clone https://github.com/pouriaetab/leanfare.git
cd leanfare
bun install
bun test             # against fake providers; nothing leaves your computer
bun src/cli.ts       # the app
bun src/cli.ts mcp   # the MCP server, over stdio

In any MCP host

Leanfare is a standard MCP server over stdio: the command is leanfare mcp, with no environment variables. When the Leanfare app is not running, the server starts it.

{
  "mcpServers": {
    "leanfare": {
      "command": "/Users/you/.leanfare/bin/leanfare",
      "args": ["mcp"]
    }
  }
}

The install line puts the program in ~/.leanfare/bin/leanfare on macOS and Linux, and in %LOCALAPPDATA%\Leanfare\bin\leanfare.exe on Windows. Use its full path: an app opened from the Dock or the Start menu may not see your shell's PATH. VS Code takes the same command and args in .vscode/mcp.json, under servers with "type": "stdio".

Hosts. Leanfare is built and tested for Claude Desktop, Cowork and Claude Code. There Turn on Leanfare sets it up in one press, and the level, the hooks and the per-prompt report work. Other MCP hosts that run local stdio servers, such as VS Code with GitHub Copilot's agent mode, can run the same tools with the configuration above: the host's model plans with Leanfare, hands it reading and drafting, grades the answers, and the report counts those hand offs. The one-press setup, the level hooks and the main model's own token counts are for Claude's apps only, and other hosts are not tested.

In the MCP Registry. io.github.pouriaetab/leanfare lists an MCPB bundle (registry type mcpb, transport stdio) for each computer Claude Desktop runs on: macOS on Apple silicon, macOS on Intel, and Windows. Each comes from the release with its SHA-256, holds the compiled program, and starts leanfare mcp. For Linux, or a host that does not take MCPB bundles, use the install line and the configuration above.

Privacy

Leanfare reads usage numbers, never your words, unless you choose in Settings to keep a hand off's words on your computer to read later. Your keys stay on your computer, and requests go from your computer straight to the AI company you use. No telemetry. The guide has the details.

Update, stop or take it out

  1. Update: run the install line again. Leanfare says when a new version is out.

  2. Stop: type leanfare stop.

  3. Off for a while: the switch at the top of the app.

  4. Take it out of an app: Settings, In your apps, then Remove next to the app.

Data and credits

Prices come from llmledger (MIT), built from LiteLLM's public price list (MIT). Quality ratings come from the Arena leaderboard (CC BY 4.0). The guide lists the rest. Leanfare is not affiliated with any AI provider.

Licence

MIT

Available Tools

16 tools
askAsk a modelA

Sends one question to a model through Leanfare and returns the answer with the model and its cost. Auto picks the cheapest model the user ticked that rates well for the task unless model names one (ids from models). Use it for a short question or a second opinion where nothing needs reading from files. For work that reads files or needs a checked answer, use delegate; for a task in parts, plan; to price a prompt without sending it, estimate. The cost counts toward the user's monthly budget; nothing is changed on the computer.

Inputs: prompt (required), model, system, max_tokens.

delegateHand a task to a cheaper modelA

Hand a piece of work to a cheaper model through Leanfare, to save your own context and usage. Best for work that reads a lot and answers briefly: search or summarize big files, logs or many documents, review a file, draft a section. Name the files in files: Leanfare reads them itself, so their text never enters your context. Leanfare picks the cheapest model the user ticked that rates well enough for the kind and effort, and returns a short answer with a receipt (the model, the cost, the tokens kept out of your context). Every high effort answer, and a sample of the others, is checked by a stronger model, blind and from another company when one can take it; a failed check is asked again one tier up. One that takes more than about 40 seconds answers with an id instead and keeps working: call delegate again with only that id to get the answer, or with that id and stop true to stop it (what its model did so far may have been charged). Costs count toward the user's Leanfare budget.

Inputs: id, kind, stop, task, +10 more.

estimateEstimate a cost and a timeA
Read-only

Estimate what a prompt would cost and how long it would take before sending it: the model Auto would pick, why, and at the same quality the cheapest and the fastest choice. Nothing is sent to a model.

Inputs: prompt (required), model, speed.

gradeGrade an answerA

Review every answer Leanfare brings back (delegate, or a plan's part from plan_status) before you use it, then say how good it was: good, partly or wrong. Grade a delegate answer with handoff (the number in its receipt); a plan's part with id and part. If it is partly or wrong, fix it before you answer the user: yourself (fix myself), or with fix leanfare and why, and Leanfare asks again one tier up and returns the new answer, a new hand off to review and grade too. Leanfare keeps only the grade, with the model that answered and the kind of part, never the words; why goes only to the model asked again. A model graded below good too often for a kind is moved down, so plans and delegate stop picking it for that kind. At the end of a prompt that handed work off, grade its whole result too, your work and the hand offs together: whole true and the verdict. Several answers of one plan go in one call: the plan's id and grades (each part's number and verdict), with whole and verdict for the whole result in the same call.

Inputs: id, fix, why, kind, +7 more.

helperThe Claude model for a helperA

Returns the Claude model a Claude helper (subagent) should run on, and records what helpers and main turns used. Called by Leanfare's own leanfare-level mod and Claude Code hook, never by the model in a chat. Use: before a helper starts, pass task (and description, agent, asked); Leanfare answers with the model as the Agent tool names it (haiku, sonnet, opus or fable), its full id and why, or says to keep the model. After it ends, pass done; for the main model's own turn, pass turn. It writes token counts to Leanfare's local report and keeps no words. To hand work to an outside model use delegate or plan.

Inputs: done, task, turn, agent, +3 more.

levelLeanfare's levelA
Idempotent

How much to hand to Leanfare first, from 1 to 5: 1 Off (only when the user asks), 2 Light (big reads and tasks with several parts), 3 More (also reads over about 10 KB you will not change, project wide searches, summaries, reviews and first drafts), 4 Most (plan every prompt that is more than a quick question with Leanfare first), 5 All it can (every part a model can do; you review, decide and answer). Where the leanfare-level mod puts the level in the system prompt (Cowork and Claude Desktop), do not call it to read the level; elsewhere call it with nothing once at the start of a chat to learn the level, and follow it. Level 1, or Leanfare switched off: do not call Leanfare's tools unless the user asks. When the user sets one ("Leanfare 4", "use Leanfare less"), call it with set, and scope: chat (this chat only, the default), app (this app from now on) or default (every app). Pass the level to delegate and plan.

Inputs: set, scope.

liveLive tokensA
Read-only

The model calls Leanfare is running right now, and those that ended in the last minute, as numbers only: the model, what it is for (a hand off, its check, a plan's part, an app through Leanfare's address), how long it has run, and its tokens so far by kind (new input, cached, thinking, written), with tokens a second. Use it when the user asks what Leanfare is doing now, or to watch a plan's parts run. It takes no input and changes nothing. For one plan's answers use plan_status; for totals over time, report. Apps that show MCP Apps draw it as a live card that keeps moving.

Inputs: no named parameters.

local_modelLocal models on this computerA
Idempotent

The models on this computer (Ollama): where Ollama keeps them (the drive and its free space; downloads go there too), one suggested for each kind of work (reading, drafting, working things out) with its size in GB, and a test of a model the user has. Arena rates few small models, so the test asks one of them 8 questions with known answers about made up files, on this computer (free, a few minutes, nothing leaves it); one that passes then takes reading work first in plans and the delegate. suggest (the default) says all this; test, with model, starts the test; status says how a test or a download goes; download asks the user, then has Ollama download a suggested model (model names which; the default is the best rated one). Nothing is downloaded without the user's yes.

Inputs: yes, model, action.

modelsModels and pricesA
Read-only

Returns the models Leanfare can send work to now: each one's id, name, provider, price per 1M input and output tokens (or free) and Arena rating, plus ticked models that cannot take work now with the reason (retired, no credit, free allowance used). Use it to name a model in ask or estimate, or to tell the user what Leanfare can use. Not needed for plan or delegate, which pick models themselves; for models on this computer and downloads, use local_model. Read only: calls no model and changes nothing (the user ticks models in Leanfare's Settings).

Inputs: provider.

planSplit a task across modelsA

Before a task with several parts (a feature, a fix across files, a refactor, research across many files, reverse engineering a project), ask Leanfare how to split it. It answers with a short table: each part, its kind, where it runs (you, or Leanfare on a local, free or pay per use model), the model, about how long, the tokens it keeps out of the user's plan, and the cost; then what to do next. Leanfare starts its own parts at once by itself (local and free ones, paid ones within the user's cap) and this answers with those that finish within about 25 seconds: do not run them again with delegate. Do the parts it leaves to you, then call plan_status with the plan's id (wait 50) for the rest of Leanfare's answers, and review and grade each. Name the files or folders the task is about in files: here Leanfare only measures them, it reads them when delegate runs a part. A model the user ticked does the split (a few cents or less, $0 on free models; one that takes more than 40 seconds is let go, and the rules split it); split rules makes it by rules, with no model.

Inputs: task (required), run, only, files, +10 more.

plan_runRun Leanfare's parts of a planA
Idempotent

Start the parts of a plan that Leanfare runs (local, free and pay per use models), in the background: at once where they can, each as soon as the parts it needs are done, with their answers handed on. Returns at once; read the progress and the answers with plan_status. Parts on local or free models run without asking. Paid parts run only within the cap the user set in Leanfare, or when the user said yes: Leanfare asks them itself where this app can show a question; otherwise ask the user, and call again with paid yes only after they agree. The user's monthly budget in Leanfare always holds.

Inputs: id (required), paid, yours_done.

plan_statusProgress of a planA
Idempotent

Returns where each part of a plan stands (waiting, running, done, failed, yours, after yours, waiting for a yes) and the answers of the parts Leanfare finished. Use it after plan or plan_run to collect answers: wait up to 50 seconds for running parts (it returns as soon as none runs). Each answer is also saved in the project's .leanfare/plans// (git ignores it). With no id it lists the plans Leanfare keeps (the last 20 and any still running, newest first: id, task, when made, parts done or running), to find a lost id; wait, peek and folder then do nothing. It marks the answers as taken unless peek is true. To stop parts use plan_stop.

Inputs: id, peek, wait, folder.

plan_stopStop a plan's partsA
DestructiveIdempotent

Stops the parts of a plan that Leanfare is running, started by plan or plan_run. What was done stays and plan_status still shows it; a part stopped half way may have been charged for what its model did. With forget true it also puts the plan away for good: the plan, its answers and its rounds are forgotten in Leanfare and its id stops working (answers already saved in the project's .leanfare/plans// stay). Use forget for a plan the user dropped or one made by mistake: it cannot be undone, and forgetting the same plan again is an error. To stop a single delegate hand off, call delegate with its id and stop true.

Inputs: id (required), forget.

reportLeanfare's reportA
Read-only

Returns what Leanfare did for the user's apps over a span: tokens its models read so the apps did not, the apps' own use where known, cost, quality (grades and blind checks), tokens over time, work by model, and recent prompts with their hand offs. Each prompt has a lasting id (PRM-41); pass prompt for one prompt and its parts. Use it when the user asks what Leanfare saved or how the models did. Not for money and budget now (use spend) or calls running now (use live). Read only. Apps that show MCP Apps draw it as a card with spans to pick.

Inputs: app, range, prompt.

spendWhat was spentA
Read-only

Returns money and limits now: spend today and this month, the budget left, what Auto saved, the top models by cost, this month's hand off totals and grades, and each platform's room before its nearest limit. Use it before paid work, or when the user asks what they spent or how much budget is left. Not for tokens kept out over time or one prompt's parts (use report), calls running now (use live) or a price before sending (use estimate). Read only: takes no input, calls no model, changes nothing.

Inputs: no named parameters.

trialTry the delegate firstA

Measure how well delegate answers on the user's models before relying on it: 10 questions with known answers about files Leanfare makes up, each asked at low, medium and high effort (30 answers, a few minutes; it costs what those answers cost, $0 on free plans). start begins it and returns at once; status gives the progress or the report, with the lowest effort that passed and the line for CLAUDE.md; stop ends it. Nothing of the user's is sent.

Inputs: action.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 16 tools

    Disambiguation3/5

    The descriptions go out of their way to cross-reference ("not for X, use Y"), which salvages a lot, but the set still contains several closely related clusters: live/report/spend all report activity, ask/delegate/plan all send work to models, and plan/plan_run/plan_status/plan_stop require reading four descriptions to separate. The inclusion of helper, which explicitly says it is never called by the model in chat, adds noise an agent must learn to ignore.

    Naming Consistency3/5

    Names are readable but follow no single convention: a plan_* prefixed family (plan, plan_run, plan_status, plan_stop) alongside bare single words that mix nouns (live, spend, report, models, level, trial) and verbs (ask, delegate, estimate, grade), plus one snake_case outlier (local_model). The plan_* cluster is good; the rest is ad hoc.

    Tool Count4/5

    16 tools is at the upper end but each of the main capabilities (query spend/report/live, plan lifecycle, delegate+grade, model selection, local models, level config) has a distinct role. Only helper feels like it does not belong in the model-facing surface.

    Completeness4/5

    The domain is covered end to end: estimate cost, run work (ask/delegate/plan), track progress (live/plan_status), grade results, and report spend and savings, plus local-model and trial workflows. Minor gaps: spend is read-only with no tool to set budget or caps, and model ticking is pushed to Settings, so some user configuration is unreachable from the tool surface.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      An MCP server that allows Claude Code to offload mechanical tasks such as summarization, classification, and drafting to a local LLM, reducing API costs while keeping Claude in control of complex reasoning and quality review.
      7
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      MCP server that delegates mechanical tasks like summarization, classification, extraction, and drafting to a local Llama.cpp LLM, serving as a cost-optimization layer while Claude handles reasoning and quality control.
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      This MCP server enables Claude or any MCP client to offload bounded coding and documentation tasks to local or cloud OpenAI-compatible LLMs, reducing token usage and providing an extra model for review. It supports code review, boilerplate generation, commit messages, format conversion, mock data, and embeddings.
      -