
A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

LocalLama is a local-first, provider-neutral Model Context Protocol server for coding-agent workflows that routes tasks across local models, free models, and paid frontier models using cost, latency, context capacity, and benchmark history.
LocalLama MCP Server is cataloged as an MCP server attributed to heratiki. LocalLama is a local-first, provider-neutral Model Context Protocol server for coding-agent workflows that routes tasks across local models, free models, and paid frontier models using cost, latency, context capacity, and benchmark history. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: ISC. Check the source repository's current license and terms before using, modifying or distributing this software.
能力定义尚未审核。未核验的采集内容不会作为可信接口展示。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
暂无可展示的已审核记录。这不表示上游不支持此能力。
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for LocalLama MCP Server are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
get_cost_estimate estimates USD cost before calling route_task; local and free-tier models return 0.
No. Code search uses a native TypeScript BM25 engine and does not require Python or external dependencies.
route_task returns a task_id immediately, and callers poll get_task_status for status, progress, and the inline result when complete.
README.md · af037711fa38 · 采集于 2026-11-13 06:53:31 UTC
保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。
当前显示最后一次成功采集的文档快照,请以来源页面为准。
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 a
1.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
mainare the relatively safer builds.- The
testingchannel publishes bleeding-edge pre-releases (x.y.z-testing.n) for trying unproven changes early.
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.
git clone https://github.com/Heratiki/locallama-mcp.git
cd locallama-mcp
npm install
npm run build
Copy .env.example to .env and edit with your values. The server resolves .env from its own root directory (or LOCALLAMA_ROOT_DIR when set), not from the MCP host's CWD.
# Local LLM Endpoints
LM_STUDIO_ENDPOINT=http://localhost:1234/v1
OLLAMA_ENDPOINT=http://localhost:11434/api
# LLAMA_CPP_ENDPOINT=http://localhost:8080 # leave unset to disable
# Routing thresholds
DEFAULT_LOCAL_MODEL=qwen2.5-coder-3b-instruct
TOKEN_THRESHOLD=1500
COST_THRESHOLD=0.02
QUALITY_THRESHOLD=0.7
# Provider concurrency
PROVIDER_HEALTH_PROBE_INTERVAL_MS=60000
PROVIDER_MAX_CONCURRENT_LOCAL=1
PROVIDER_MAX_CONCURRENT_REMOTE=5
PROVIDER_TIMEOUT_MS=120000
OLLAMA_TIMEOUT=120
# Code search (native BM25, no Python required)
CODE_SEARCH_ENABLED=true
CODE_SEARCH_EXCLUDE_PATTERNS=["node_modules/**","dist/**",".git/**"]
CODE_SEARCH_INDEX_ON_START=true
CODE_SEARCH_REINDEX_INTERVAL=3600
# Benchmarks
BENCHMARK_RUNS_PER_TASK=3
BENCHMARK_PARALLEL=false
BENCHMARK_MAX_PARALLEL_TASKS=2
BENCHMARK_TASK_TIMEOUT=60000
BENCHMARK_SAVE_RESULTS=true
BENCHMARK_RESULTS_PATH=./benchmark-results
RELIABLE_BENCHMARK_COUNT=3
MIN_VALIDATOR_SCORE=0.6
VALIDATION_RETRY_BUDGET=1
# Lock file
LOCK_FILE_CHECK_ACTIVE_PROCESS=true
REMOVE_STALE_LOCK_FILES=true
# OpenRouter (optional)
OPENROUTER_API_KEY=your_openrouter_api_key_here
OPENROUTER_FREE_ONLY=false
# Logging
LOG_LEVEL=debug
# Operational testing
# EXPECT_LOCAL_PROVIDER_DOWN=true
| Variable | Default | Description |
|---|---|---|
LM_STUDIO_ENDPOINT | — | LM Studio API base URL |
OLLAMA_ENDPOINT | — | Ollama API base URL |
LLAMA_CPP_ENDPOINT | — | llama-server URL; leave unset to disable provider |
DEFAULT_LOCAL_MODEL | — | Model name used when offloading to local provider |
TOKEN_THRESHOLD | 1500 | Token count above which local offload is considered |
COST_THRESHOLD | 0.02 | USD cost above which local offload is preferred |
QUALITY_THRESHOLD | 0.7 | Quality score below which paid API is always used |
RELIABLE_BENCHMARK_COUNT | 3 | Benchmark runs required before empirical scores are treated as fully reliable |
MIN_VALIDATOR_SCORE | 0.6 | Minimum validation score required before a model is eligible for external validation |
VALIDATION_RETRY_BUDGET | 1 | Validation retry attempts allowed after an initial failed validation |
PROVIDER_MAX_CONCURRENT_LOCAL | 1 | Shared local execution slot count |
PROVIDER_MAX_CONCURRENT_REMOTE | 5 | Per-remote-provider slot count |
OPENROUTER_API_KEY | — | Enables OpenRouter provider and related tools |
OPENROUTER_FREE_ONLY | false | Restrict OpenRouter to free-tier models only |
EXPECT_LOCAL_PROVIDER_DOWN | — | Set true in test-operational.mjs to assert no local suggestion |
Build the server, then point your MCP client at node dist/index.js:
{
"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"
}
}
}
}
Claude Code users can place this in .mcp.json (project-scoped) or ~/.claude/settings.json (global).
| Tool | Inputs | Description |
|---|---|---|
route_task | task, context_length, expected_output_length?, complexity?, priority?, preemptive? | Queue a task asynchronously. Returns task_id immediately. Poll get_task_status for results. |
get_task_status | task_id | Poll a non-blocking route_task submission. Returns status, progress, and inline result when complete. |
cancel_task | task_id | Cancel all queued or in-progress jobs for a task. |
cancel_job | job_id | Cancel a single background job. |
preemptive_route_task | task, context_length, expected_output_length?, complexity?, priority? | Heuristic routing check with no LLM calls. Returns model/provider recommendation without executing the task. |
get_cost_estimate | context_length, expected_output_length?, model? | Estimate USD cost before calling route_task. Local and free-tier models return 0. |
benchmark_task | task_id, task, context_length, expected_output_length?, complexity?, local_model?, paid_model?, runs_per_task? | Benchmark one task across local vs paid models. |
benchmark_tasks | tasks[], runs_per_task?, parallel?, max_parallel_tasks? | Benchmark multiple tasks in one call. |
benchmark_model | model_id, provider_id?, task_categories? | Run built-in benchmark suites against a specific model. Persists results to benchmarks.db and updates ModelRegistry capability scores. |
retriv_init | directories[], exclude_patterns?, chunk_size?, force_reindex?, bm25_options? | Index code with the native BM25 engine (no Python required). |
retriv_search | query, limit? | Search indexed code using native BM25. |
reload_config | — | Reload .env at runtime. Atomic: invalid config is rejected. |
check_for_updates | — | Check whether the server is up to date with the latest GitHub commit. |
update_server | — | Pull latest changes from GitHub, run npm install and npm run build. Restart the server manually after. |
OPENROUTER_API_KEY)| Tool | Inputs | Description |
|---|---|---|
get_free_models | — | List free models available from OpenRouter. |
clear_openrouter_tracking | — | Clear cached model list and force a fresh fetch. |
benchmark_free_models | tasks[], runs_per_task?, parallel?, max_parallel_tasks? | Benchmark free OpenRouter models. Results written to benchmarks.db. |
set_model_prompting_strategy | model_id, system_prompt, user_prompt, use_chat, assistant_prompt?, success_rate?, quality_score? | Set a custom prompting strategy for an OpenRouter model. |
route_task → { task_id }
↓ poll
get_task_status → { status: "pending" | "in_progress" | "completed" | "failed", result? }
When local providers are contended by benchmark workloads, route_task surfaces contention metadata:
{
"task_id": "...",
"status": "queued",
"queue_position": 2,
"benchmark_contention": {
"local_slot_contended": true,
"active_benchmark_runs": 1,
"queued_benchmark_runs": 2,
"message": "Local execution slot currently contended by benchmark workloads."
}
}
| URI | Description |
|---|---|
locallama://status | Server status |
locallama://models | Available local models |
locallama://jobs/active | Currently active jobs |
locallama://memory-bank | Memory bank file list (if directory exists) |
locallama://openrouter/models | All OpenRouter models (requires API key) |
locallama://openrouter/free-models | Free OpenRouter models (requires API key) |
locallama://openrouter/status | OpenRouter integration status (requires API key) |
| URI template | Description |
|---|---|
locallama://usage/{api} | Token usage and costs for a specific API (e.g. openrouter) |
locallama://jobs/progress/{jobId} | Progress for a specific job |
locallama://openrouter/model/{modelId} | Details for an OpenRouter model (requires API key) |
locallama://openrouter/prompting-strategy/{modelId} | Prompting strategy for an OpenRouter model (requires API key) |
npm start
A lock file prevents multiple instances. Stale locks from crashed processes are detected and cleaned up automatically.
npm run benchmark
npm run benchmark:comprehensive
Results are stored in benchmark-results/ as JSON and Markdown summaries.
When the server is running, a web dashboard is available at http://localhost:3001 (server-local).
Features:
route_task submission formREST API endpoints:
| Method | Path | Description |
|---|---|---|
GET | /api/queue | Queue summary and jobs. Filters: status, provider, model, task_id, q, page, page_size |
GET | /api/tasks | Recent tasks. Filters: status, provider, model, q, page, page_size |
GET | /api/tasks/:taskId | Detailed task status |
POST | /api/tasks | Submit a task (route_task) |
POST | /api/tasks/:taskId/cancel | Cancel a task |
POST | /api/jobs/:jobId/cancel | Cancel a job |
Example submission:
curl -X POST http://localhost:3001/api/tasks \
-H "Content-Type: application/json" \
-d '{"task": "Refactor parser for readability", "context_length": 4096, "complexity": 0.6, "priority": "quality"}'
When the JobTracker WebSocket server is running, task-executing tools include:
{
"task_id": "task-123",
"monitoring": {
"websocketUrl": "ws://127.0.0.1:8081",
"activeJobsUri": "locallama://jobs/active",
"jobProgressUriTemplate": "locallama://jobs/progress/{jobId}",
"note": "Connect to websocketUrl for live updates, or use MCP resources."
}
}
websocketUrl is scope: server-local — in SSH/container/Codespaces/WSL setups, forward the port before connecting.
_server_reminder ambient metadataTools attach a _server_reminder field at most once every 30 minutes to surface monitoring info:
{
"_server_reminder": {
"schemaVersion": 1,
"kind": "monitoring-reminder",
"status": "reachable",
"scope": "server-local",
"message": "Optional monitoring available from MCP server host.",
"monitoringUrl": "http://127.0.0.1:3001",
"lastCheckedAt": 1747699200000
}
}
If your MCP client is not on the same machine as the server:
# SSH
ssh -L 8081:127.0.0.1:8081 -L 3001:127.0.0.1:3001 user@host
Set OLLAMA_ENDPOINT in .env. The server probes for available models on startup.
Set LM_STUDIO_ENDPOINT in .env. Exposes an OpenAI-compatible API.
llama-server)# Single model
llama-server -m /path/to/model.gguf --port 8080
# Router mode (multiple models)
llama-server --model /path/model1.gguf --model /path/model2.gguf --port 8080
Set LLAMA_CPP_ENDPOINT=http://localhost:8080 in .env. If the endpoint is unset or unreachable, the provider initialises silently — other providers are unaffected. The server does not manage the llama-server process lifecycle.
Set OPENROUTER_API_KEY. The server fetches ~240 available models on startup (30+ free). Use clear_openrouter_tracking to force a refresh. Set OPENROUTER_FREE_ONLY=true to restrict to free-tier models.
Code search uses a native TypeScript BM25 engine — no Python or external dependencies required.
# Via MCP tool
retriv_init { "directories": ["/path/to/repo"], "force_reindex": true }
retriv_search { "query": "pagination logic" }
npm run build # compile TypeScript + copy assets
npm start # run compiled server
npm run dev # TypeScript watch mode
npm test # build + run Jest (23 suites, 186 tests)
npm run lint # ESLint (note: eslint-plugin-import not installed — lint currently fails)
npm run lint:fix # ESLint with auto-fix
All test files mock server state to prevent multiple real instances during test runs.
src/
index.ts entry point, lock file, MCP lifecycle
modules/
api-integration/ tool definitions, resources, routing adapters
decision-engine/ task analysis, model selection, coordination
cost-monitor/ token accounting, cost estimation
benchmark/ execution, scoring, summaries, DB storage
lm-studio/ LM Studio provider
ollama/ Ollama provider
llama-cpp/ llama-server provider
openrouter/ OpenRouter provider
core/provider/ shared provider registry and execution queue
updater/ self-update logic (check_for_updates, update_server)
job-store/ persistent Task/Job store
websocket-server/ live monitoring side channel
Decision engine uses two model data stores:
ModelRegistry + CapabilityDetector: benchmark-derived capability scores (authoritative for full routing)modelsDbService: heuristic performance data seeded from ModelRegistry at startup; used by preemptiveRouting()| File | Purpose |
|---|---|
docs/AGENTS.md | Shared operating guide for all coding agents |
docs/PROJECT_STATE.md | Current snapshot of completed and in-progress work |
docs/ROADMAP.md | Long-form modernization backdrop |
docs/ROADMAP_ACTIVE.md | Active roadmap tasks |
docs/PLAN.md | Branch implementation plan |
docs/OPERATIONAL_TEST_PLAN.md | Live test record and verified behavior |
docs/LIVE_TESTING.md | Real-world MCP test results and known open bugs |
docs/audits/ARCHITECTURAL_TRUTHS.md | Core design principles and constraints |
docs/history/memory-bank/ | Historical append-only project memory |
Server won't start — lock file detected
ps aux | grep locallama).REMOVE_STALE_LOCK_FILES=true).locallama.lock from the project root.OpenRouter models not appearing
Use clear_openrouter_tracking through the MCP interface to force a fresh fetch.
npm run lint fails
eslint-plugin-import is referenced in the config but not installed. Known issue. Build and tests are unaffected.
.env, which is excluded from version control.stderr; stdout is reserved for MCP JSON-RPC. Never write non-JSON to stdout.ISC
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for LocalLama MCP Server from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/locallama-mcp)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。
尚无已审核的包 / 镜像标识,暂不展示下载统计。
Alternative and complementary servers in the same category

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.