LocaLLama MCP Server

An MCP Server that works with Roo Code/Cline.Bot/Claude Desktop to optimize costs by intelligently routing coding tasks between local LLMs free APIs

Local serverstdioPython

What is the LocaLLama MCP server?

Most planning and project tracking work still happens through a UI a human drives. LocaLLama MCP server moves it into the conversation instead. An MCP Server that works with Roo Code/Cline.Bot/Claude Desktop to optimize costs by intelligently routing coding tasks between local LLMs free APIs and paid APIs.

The short version

Local-first, provider-neutral Model Context Protocol server for coding-agent workflows. Routes tasks across local models (Ollama, LM Studio, llama.cpp), free OpenRouter models, and paid frontier models using cost, latency, context capacity, and benchmark history.

LocalLama MCP reduces token costs without sacrificing quality. Tasks are queued asynchronously — route_task returns a task_id immediately; callers poll get_task_status for results. The decision engine chooses local → free → paid based on measured provider capabilities and configurable thresholds.

Getting it running

npm on npm is all you need. Most clients run it directly, so configuration is a few lines and a restart.

The tools it exposes

The server publishes 14 tools. What each one is for:

  • route_task — task, context_length, expected_output_length?, complexity?, priority?, preemptive?
  • get_task_status — task_id
  • cancel_task — task_id
  • cancel_job — job_id
  • preemptive_route_task — task, context_length, expected_output_length?, complexity?, priority?
  • get_cost_estimate — context_length, expected_output_length?, model?
  • benchmark_task — task_id, task, context_length, expected_output_length?, complexity?, local_model?, paid_model?, runs_per_task?
  • benchmark_tasks — tasks[], runs_per_task?, parallel?, max_parallel_tasks?
  • benchmark_model — model_id, provider_id?, task_categories?
  • retriv_init — directories[], exclude_patterns?, chunk_size?, force_reindex?, bm25_options?
  • retriv_search — query, limit?
  • reload_config — —

What it needs from you

Configuration is passed through the environment: LM_STUDIO_ENDPOINT, OLLAMA_ENDPOINT, DEFAULT_LOCAL_MODEL, TOKEN_THRESHOLD, COST_THRESHOLD, QUALITY_THRESHOLD, OPENROUTER_API_KEY, BENCHMARK_RESULTS_PATH. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

  • Node.js 22+ - npm - At least one of: Ollama, LM Studio, llama.cpp server, or an OpenRouter API key

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch LocaLLama.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

How it compares

Plenty of planning and project tracking servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. LocaLLama's toolset — route_task, get_task_status, cancel_task and 11 more — is a fair guide to whether it matches your workflow. It is maintained by Heratiki; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Available tools

ToolWhat it does
route_tasktask, context_length, expected_output_length?, complexity?, priority?, preemptive?
get_task_statustask_id
cancel_tasktask_id
cancel_jobjob_id
preemptive_route_tasktask, context_length, expected_output_length?, complexity?, priority?
get_cost_estimatecontext_length, expected_output_length?, model?
benchmark_tasktask_id, task, context_length, expected_output_length?, complexity?, local_model?, paid_model?, runs_per_task?
benchmark_taskstasks[], runs_per_task?, parallel?, max_parallel_tasks?
benchmark_modelmodel_id, provider_id?, task_categories?
retriv_initdirectories[], exclude_patterns?, chunk_size?, force_reindex?, bm25_options?
retriv_searchquery, limit?
reload_config
check_for_updates
update_server

How to install the LocaLLama MCP server

{
  "mcpServers": {
    "locallama": {
      "command": "node",
      "args": ["/path/to/locallama-mcp/dist/index.js"],
      "env": {
        "LM_STUDIO_ENDPOINT": "http://localhost:1234/v1",
        "OLLAMA_ENDPOINT": "http://localhost:11434/api",
        "DEFAULT_LOCAL_MODEL": "qwen2.5-coder-3b-instruct",
        "TOKEN_THRESHOLD": "1500",
        "COST_THRESHOLD": "0.02",
        "QUALITY_THRESHOLD": "0.07",
        "OPENROUTER_API_KEY": "your_openrouter_api_key_here"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Node.js 22+ - npm - At least one of: Ollama, LM Studio, llama.cpp server, or an OpenRouter API key
VariableDescriptionRequired
LM_STUDIO_ENDPOINTConfiguration value read at startup.Optional
OLLAMA_ENDPOINTConfiguration value read at startup.Optional
DEFAULT_LOCAL_MODELConfiguration value read at startup.Optional
TOKEN_THRESHOLDCredential the server authenticates with.Yes
COST_THRESHOLDConfiguration value read at startup.Optional
QUALITY_THRESHOLDConfiguration value read at startup.Optional
OPENROUTER_API_KEYCredential the server authenticates with.Yes
BENCHMARK_RESULTS_PATHFilesystem location the server is allowed to use.Optional

Example prompts to try

  • Use LocaLLama to route task.
  • Use LocaLLama to get task status.
  • Use LocaLLama to cancel task.

Frequently asked questions

It connects LocaLLama to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (route_task, get_task_status, cancel_task, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with LocaLLama directly.