Llama MCP Bridge
This MCP server bridges clients to a local llama.cpp router for hardware-aware, preset-based local LLM inference.
Check bridge health, hardware tier, and loaded/unloaded model status.
Invoke any configured or custom preset by name with prompts, system prompts, token limits, streaming, timeouts, file context, image context, and
.gitignore-aware discovery.Constrain outputs to structured JSON using schema/grammar options.
Run multiple prompts in parallel against a preset, bounded by configured parallel slots.
Use specialist presets for digest/JSON extraction, coding, long codebase analysis, vision/OCR, reasoning, auditing, and general technical writing.
Allows zero-copy import of GGUF model blobs from an existing Ollama local model store, enabling reuse of already-downloaded Ollama weights.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Llama MCP Bridge extract the key facts from this changelog as JSON"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Llama MCP Bridge
Hardware-aware local LLM MCP bridge powered by llama.cpp router mode.
Docs · Architecture · Contributing · Security · Changelog
Requires Python >= 3.11.
What this is
llama-mcp-bridge is a cross-platform (Linux, macOS, Windows, FreeBSD) Model Context Protocol (MCP) server that connects MCP clients to a single router-mode llama-server process. It is built for Ollama users who've outgrown Ollama's opinionated defaults without wanting to hand-edit llama-server flags.
Related MCP server: llmstudio-mcp
Why I built this
I started out running local models behind Ollama, and it worked—until I wanted to know why a model was spilling into system RAM, or why a coding prompt was eating 30% of its context window on <think> tags. Ollama hides those knobs behind opaque modelfiles. Switching to llama.cpp's native router mode and wrapping it in fastmcp gave me exact control over KV-cache quantisation, GPU layer offloading, and per-preset context budgets—at the cost of a wall of CLI flags.
So I built llama-mcp-bridge to automate the tedious parts while keeping every decision inspectable in plain INI files:
Token savings & output hygiene (
hygiene.py): Strips internal reasoning/monologue tags deterministically while preserving fenced code blocks, LaTeX, and structured JSON..gitignore-brokered file context (discovery.py): Expands files, directories, and globs on the host side within.gitignorecascades,include/ignorerules, binary skipping, and smallest-first character budgets.GGUF-header-derived tuning (
gguf_header.py): Inspects GGUF v2/v3 binary headers directly (MHA/GQA, SWA, hybrid SSM, DeepSeek MLA, KV-shared layers) to size KV caches from actual model geometry.Honest labeling of extras: Core local inference is
v1.0.2-stable; opt-in[enterprise]features (--enterprise) and background service wrappers are clearly marked as provisional until field-validated.
Who this is for / not for
For:
Developers who want local specialist models (
digest,coder,vision,reasoner) wired into Claude Code, Cursor, Cline, Windsurf, Zed, or Antigravity.Workstation users on 6 GB–24 GB+ GPUs (or CPU-only fallback) who want deterministic, inspectable
models.inituning.Teams wanting zero-copy Ollama GGUF blob imports (
--import-ollama) without re-downloading weights.
Not for:
Multi-node distributed inference or high-throughput SaaS serving (use vLLM or TGI).
Agentic tool-calling inside the local model itself (specialists are strictly agency-free).
Zero-config cloud API proxying.
Quick Start
Preview what the installer will do without touching disk or network:
uvx --from git+https://github.com/OakHell/llama-mcp-bridge llama-mcp-install --dry-runInstall and launch the setup wizard:
uv tool install git+https://github.com/OakHell/llama-mcp-bridge
uv tool update-shell
llama-mcp-install # interactive TUI setup (choose "download models" inside)
# or non-interactive:
llama-mcp-install -y --download-modelsFor agent self-bootstrap, run llama-mcp-install --install-skill (see docs/install.md and SKILL.md). See docs/install-wheel.md for pinned/offline release wheels.
Verify your setup and wire it into your MCP client:
llama-mcp-install --doctor # Standby is normal when auto_spawn = true
llama-mcp-install --selftest # Live end-to-end ask_digest('ping') checkAdd to your MCP client's mcpServers config (then reload/restart the client; see docs/config.md for LLAMA_MCP_HOME details):
{
"mcpServers": {
"local-ai": {
"command": "llama-mcp-bridge",
"env": {
"LLAMA_MCP_HOME": "/path/to/workspace"
}
}
}
}Hit an issue? Jump to Troubleshooting.
Specialist Tools
7 GGUF models act as 9 specialist presets: on 8gb–16gb, coder, coder-long, and vision-deep share Qwen3.5-9B-UD-Q4_K_XL.gguf (with mmproj-BF16.gguf attached for vision-deep), while 24gb+ swaps coder-fast, coder, and coder-long to Qwen2.5-Coder-14B.
Tool | Role | Model Family |
| High-speed structured JSON/fact extraction | Liquid LFM3 |
| Rapid boilerplate and targeted edits | Qwen 2.5 Coder |
| Standard code generation and refactoring | Qwen 3.5 |
| Multi-file codebase analysis (16K–128K) | Qwen 3.5 |
| Fast UI inspection, screenshots, and OCR | MiniCPM-V 4.6 |
| Complex visual reasoning and diagrams | Qwen 3.5 (VLM) |
| Mathematical, algorithmic, and logical reasoning | IBM Granite 4.2 |
| Deep technical auditing and edge-case analysis | Mistral / Ministral 3 |
| General technical writing and synthesis | Google Gemma 4 |
See docs/tools.md for dispatcher tools (ask_preset, ask_batch), get_bridge_status, json_schema grammar constraints, and the Reasoning Management stack.
Hardware Tiers
Tier | Typical Hardware | KV Cache ( |
| Parallelism |
| 6 GB GPUs / CPU fallback ( |
| 8K / 16K | 1 |
| 8 GB GPUs (e.g. RTX 3070) |
| 16K / 32K | 1 |
| 12 GB GPUs (e.g. RTX 3060/4070) |
| 24K / 40K | 1 |
| 16 GB GPUs (e.g. RTX 4080 / M2 Pro 32GB) |
| 32K / 64K | 2 |
| 24 GB+ GPUs (e.g. RTX 4090 / M2 Max 64GB) |
| 64K / 128K | 4 |
Note: On
24gb+,coder,coder-fast, andcoder-longswap toQwen 2.5-Coder-14B(qwen2.5-coder-14b-instruct-q4_k_m.gguf);131072context usesq4_0KV cache and can be lowered viallama-mcp-modelsif tight on 24 GB VRAM.
Common Operations
llama-mcp-models add my-model --hf owner/repo:Q4_K_M
llama-mcp-models remove my-model
llama-mcp-install --import-ollama # --ollama-dir to override ~/.ollama/models
llama-mcp-install --doctor
llama-mcp-ps
llama-mcp-install --check-updateSee docs/models.md and docs/cli.md for the full command reference.
Configuration
The bridge reads bridge.ini ([bridge] with schema_version = 1) and models.ini from LLAMA_MCP_HOME (defaulting to ~/.llama-mcp-bridge on POSIX or %LOCALAPPDATA%\llama-mcp-bridge on Windows). See docs/config.md for all keys, residency profiles, and cross-platform path examples.
Security Model
All specialist models run strictly agency-free: they have zero function-calling, subprocess, or network-egress capabilities. File and image context is brokered by the bridge within .gitignore cascades, structural DEFAULT_IGNORES (.git, .venv, node_modules, __pycache__), and character budgets.
llama-server binds to 127.0.0.1 by default, archive extraction enforces Zip Slip / Tar traversal and size bounds, and release downloads support Sigstore/Cosign verification. See SECURITY.md for the full threat model and supported versions.
Enterprise & Stability
Core llama-mcp-bridge (v1.0.2) is covered by Semantic Versioning in STABILITY.md. Opt-in enterprise capabilities (--enterprise, E3 rotating JSONL audit logs, E7 /livez + /readyz + systemd watchdog probes, E11 multi-tenant isolation) are documented in docs/enterprise.md.
Warning:
--enterprise(E3,E7,E11) is verified by automated unit and chaos tests only and has not yet been field-validated in a live multi-tenant production environment.
Troubleshooting FAQ
--doctorshowsStandby: Normal whenauto_spawn = true;llama-serverspawns lazily on the first tool call.New
ask_<name>tool missing in client: Restart/reload your MCP client, or callask_preset(preset="<name>", ...)immediately.VRAM OOM or cold-swap timeout: Set
residency = stingyorfallback_on_oom = trueinbridge.ini, or lowerctx-sizeinmodels.ini.Windows
llama-server.exemissing DLLs (cudart64_*.dll,cublas64_*.dll,cublasLt64_*.dll): Re-runllama-mcp-install --mode prebuilt -yto co-locate companion CUDA runtime DLLs.macOS Gatekeeper /
codesignerrors: Runcodesign --force --deep -s - <workspace>/bin/llama-server(or re-runllama-mcp-install --mode prebuilt -y).
See docs/troubleshooting.md for detailed diagnostics.
Documentation & License
docs/cli.md · docs/config.md · docs/tools.md · docs/models.md
docs/install.md · docs/install-wheel.md · docs/install-bsd.md
docs/advanced.md · docs/services.md · docs/enterprise.md · docs/troubleshooting.md
ARCHITECTURE.md · STABILITY.md · ROADMAP.md · TRACKER.md · SHIPPED.md · SKILL.md · CONTRIBUTING.md · SECURITY.md
MIT License — see LICENSE.
Available Tools
3 toolsask_batchAsk BatchB
Run N prompts in parallel against a preset (bounded by its configured parallel slots).
Inputs: preset (required), prompts (required), timeout_s, json_schema, +1 more. Returns: result
ask_presetAsk PresetD
Invoke any configured or custom [preset] section from models.ini by name.
Inputs: preset (required), prompt (required), ignore, stream, +10 more. Returns: result
get_bridge_statusGet Bridge StatusA
Return server health, hardware tier, and loaded/unloaded model status as JSON.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
get_bridge_status is clearly a diagnostics tool, distinct from the two inference tools. ask_batch and ask_preset both execute prompts against a preset, so an agent could plausibly wonder whether batch is just a parallel wrapper of preset, but the descriptions clarify the distinction (N prompts in parallel vs. one preset invocation).
All three tools use a consistent verb_noun snake_case pattern: get_bridge_status, ask_batch, ask_preset. The shared 'ask_' prefix on the inference tools actually reinforces the grouping rather than creating ambiguity.
Three tools is a tight, focused surface for a model-bridge server; each tool serves a distinct role (diagnostics, single invocation, parallel invocation). It is slightly lean, but nothing feels redundant or padded.
Core inference and status checking are covered, but there is no tool to list or discover available presets from models.ini, nor any way to load/unload models even though status reports load state. These are notable gaps that force agents to guess preset names.
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Hosted MCP server and Agent Skills for specs, engineering threads, and project memory.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceIntegrates local language models (like Qwen3-8B) with MCP clients, providing tools for chat, code analysis, text generation, translation, and content summarization using your own hardware.-
- FlicenseAqualityDmaintenanceMCP server that connects LLM agents to a local LM Studio instance, enabling model management, OpenAI-compatible chat completions, text completions, and embeddings through a set of tools.91-
- AlicenseAqualityCmaintenanceEnables MCP clients to scan local GGUF models, estimate VRAM and suggest GPU offload layers, manage llama-server lifecycle, and proxy OpenAI-format chats with idle auto-unload.9MIT
- AlicenseNot gradedqualityBmaintenanceEnables local AI models to be used through MCP, exposing tools for coding assistance, code review, model listing, status checks, and benchmarking.Apache 2.0