LocaLLamaBLOCK
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.
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
[](https://github.com/Heratiki/locallama-mcp/releases) [](https://github.com/Heratiki/locallama-mcp/releases)
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.
Node.js: >=22
⚠️ Early / experimental — not yet a stable release. This project is under active, rapid development and has not been fully verified end-to-end. MCP tool signatures, configuration, and behavior may change between releases without notice. Version numbers follow SemVer mechanically (they're derived from Conventional Commit messages, not hand-picked), so a1.xnumber signals only "a public surface exists" — it is not a promise of stability or completeness. If you depend on this server, pin to an exact version. - Tagged releases on `main` are the relatively safer builds. - The `testing` channel publishes bleeding-edge pre-releases (x.y.z-testing.n) for trying unproven changes early.
Overview
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.
Supported MCP clients: Codex, Claude Code, Claw Code, Cursor, GitHub Copilot Agent mode, and any generic MCP stdio client.
Requirements
- Node.js 22+
- npm
- At least one of: Ollama, LM Studio, llama.cpp server, or an OpenRouter API key
9c03639448efOBSERVED · 2026-10-08Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control. Replace the environment placeholders with a token scoped to the least it needs.
claude mcp add locallama-mcp --env OPENROUTER_API_KEY=${OPENROUTER_API_KEY} --env TOKEN_THRESHOLD=${TOKEN_THRESHOLD} -- npx -y [email protected]{
"mcpServers": {
"locallama-mcp": {
"command": "npx",
"args": [
"-y",
"[email protected]"
],
"env": {
"OPENROUTER_API_KEY": "${OPENROUTER_API_KEY}",
"TOKEN_THRESHOLD": "${TOKEN_THRESHOLD}"
}
}
}
}Exposed tools (20)
16 read · 3 write · 1 destructive. Blast radius: 1 tool can delete or overwrite — an agent that can be talked into calling a tool can be talked into calling this one.
| Tool | Risk | Description |
|---|---|---|
benchmark_free_models | read | Benchmark the performance of free models from OpenRouter |
benchmark_model | write | Run built-in benchmark suites against a specific model identified by its model id. |
benchmark_task | read | Benchmark the performance of local LLMs vs paid APIs for a specific task. When live job monitoring is available, the response includes monitoring.websocketUrl and MCP job resource URIs. |
benchmark_tasks | read | Benchmark the performance of local LLMs vs paid APIs for multiple tasks. When live job monitoring is available, the response includes monitoring.websocketUrl and MCP job resource URIs. |
cancel_job | read | Cancel a running background job. Returns the job id, whether cancellation succeeded, and the final status. |
cancel_task | read | Cancel all queued or in-progress jobs belonging to a non-blocking route_task submission. |
check_for_updates | read | Check whether the running locallama-mcp server is up to date with the latest commit on the future-testing branch on GitHub. Returns upToDate status, local SHA, remote SHA, and any error. |
clear_openrouter_tracking | destructive | Clear OpenRouter tracking data and force an update |
get_cost_estimate | read | Returns a structured JSON cost estimate for running a given number of tokens through the router. |
get_free_models | read | Get a list of free models available from OpenRouter |
get_system_state | read | Return a structured snapshot of current runtime health: local slot occupancy (inference vs benchmark vs idle), |
get_task_status | read | Poll a non-blocking route_task submission. Returns aggregate task status, progress, retry hint, and per-job summaries including inline result content when completed. |
get_telemetry_summary | read | Return an analytics summary of LLM call telemetry recorded across all runs. |
preemptive_route_task | read | Cheap model-selection check that returns a routing recommendation WITHOUT executing the task. |
rate_model | read | Provide explicit human or orchestrator feedback on generator or validator model performance for a completed task/job. Updates capability scores and enqueues fixture candidates for negative outcomes. |
reload_config | write | Reload runtime configuration from the project .env file and apply only hot-reloadable fields. |
retriv_init | read | Initialize and configure Retriv for code search and indexing |
retriv_search | read | Search code using native BM25 engine |
route_task | read | Queue a coding task for execution by the most cost-effective LLM available and return immediately with a task_id. |
set_model_prompting_strategy | write | Update the prompting strategy used for a specific OpenRouter model. Allows callers to supply a custom system prompt, user prompt template, and assistant prompt template that will be used on subsequent task executions for that model. |
Trust audit
BLOCKgrade F · trust 53/100 Do not install this without reading the findings. The audit found something that could harm you or your machine.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | FAIL |
| L2 | Instruction surface (what it tells the agent) | FAIL |
| L3 | Class-specific surface | WARN |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- declared (6 observation(s))
- Network
- declared (2 observation(s))
- Shell
- declared (5 observation(s))
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (20)
const containsDangerousPatterns = code.includes('eval(') ||code.includes('new Function(') ||exec(cmd, (error, stdout) => {- Attempt to override system-prompt instructions in the local model (jailbreak attempts).
clear_openrouter_tracking
.releaserc.json
.rooignore
const testHash = crypto.createHash('md5')import { costMonitor } from '../../cost-monitor/index.js';import { openRouterModule } from '../../openrouter/index.js';import { config } from '../../../config/index.js';import { logger } from '../../../utils/logger.js';import { config } from '../../../config/index.js';"monitoringUrl": "http://127.0.0.1:3001",
LLAMA_CPP_ENDPOINT=http://127.0.0.1:8080
curl http://127.0.0.1:8080/v1/models
url: 'http://127.0.0.1:8081/',
expect(mockGetCachedMonitoringReachability).toHaveBeenCalledWith('http://127.0.0.1:8081/');@modelcontextprotocol/sdk, @opentelemetry/api, @opentelemetry/exporter-trace-otlp-http, @opentelemetry/resources, @opentelemetry/sdk-trace-base, @opentelemetry/sdk-trace-node, @opentelemetry/semantic-
Gates applied: instruction_override, no_behavioural_pass, no_license.
9c03639448effull audit observations/trust-audit/mcp-server/heratiki__locallama.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-08 | 9c03639448ef | BLOCK | F | 53 | first audit |
Questions
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.
What tools does LocaLLama expose?
20 in total: 16 read-only, 3 that write, and 1 that can delete or overwrite (clear_openrouter_tracking). Every one is listed on this page with its risk.
Is LocaLLama safe to connect to an agent?
No — not without reading the findings first. The audit graded it F (53/100) and found 4 critical or high issues in the source. Each one is listed on this page with the file and line it is on. Separately from the audit: 1 of its tools can destroy data, so scope the token you give it to what you actually need.
What credentials does LocaLLama need?
It reads OPENROUTER_API_KEY and TOKEN_THRESHOLD from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How does LocaLLama run?
It speaks stdio, so it runs as a local process your client starts. It is published on npm as locallama-mcp at 1.31.4.
How current is this page?
The grade is for one exact copy of the source (9c03639448ef), read on 2026-10-08. The repository is watched and re-audited when it changes.