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?

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.

What it needs from you

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

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

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

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. Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.