llama-mcp-bridge

v1.7.0
io.github.OakHell/llama-mcp-bridge Checked 4 days ago Published 13 hours ago

Hardware-aware local LLM MCP bridge for llama.cpp (7 GGUF models, 9 presets).

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_bridge_status Get Bridge Status

Return live JSON server health, hardware profile, and active preset catalogue. When to use: Discover available presets before calling ask_preset/ask_batch, check warm models, or diagnose OOM/timeout issues. When NOT to use: Not needed as a pre-flight check before routine queries (inference tools start the server automatically when offline). Behavior: Performs an uncached HTTP probe of llama-server (falling back to standby/offline) without spawning or loading models.

ask_preset Ask Preset

Run a single prompt (with optional workspace files, images, JSON schema, or SSE streaming) against any configured [preset]. When to use: Any single-prompt inference task—file-grounded analysis (file_paths + overflow_strategy), vision queries (image_path/image_paths), structured JSON (json_schema), or custom [preset] calls. When NOT to use: Running 2+ independent prompts against the same preset in parallel (use ask_batch), or preloading/unloading without inference (use warmup_model / unload_model). Behavior: Ranks file_paths by BM25 relevance against prompt, budgets context via POST /tokeniz…

ParameterTypeDescription
preset *stringTarget [preset] section name from models.ini.
prompt *stringUser prompt to send to the preset.
audio_pathOptional single audio file path for audio-capable presets.
audio_pathsOptional list of audio file paths for audio-capable presets.
file_pathsOptional files, directories, or globs to attach.
file_slicesOptional 'path:line' or 'path:start-end' slices prepended ahead of file_paths.
gitignore_pathsExtra .gitignore file paths.
ignoreAdditional glob patterns to ignore.
image_pathOptional single image path for vision presets.
image_pathsOptional list of image paths for vision presets.
includeGlob patterns overriding .gitignore and ignore.
json_schemaOptional JSON Schema dict for structured output.
max_tokensintegerMaximum tokens to generate.
output_pathOptional workspace-bounded output file path (used for TTS audio or saving text output).
overflow_strategystringContext overflow handling: truncate (default), chunk, or error.
render_pathsOptional .pdf/.svg/.mmd paths rendered ephemerally to PNGs for vision presets.
search_queryOptional keyword query to locate matching code/doc slices via adaptive_window expansion.
show_thinkingOptional override to preserve <think> reasoning in output (forced False when json_schema is set).
streambooleanAccumulate SSE stream chunks if true.
system_promptOptional system prompt override (defaults to models.ini or built-in persona).
timeout_sPer-call HTTP timeout override in seconds.
use_embeddingsbooleanOptional flag to fuse /v1/embeddings semantic ranks with BM25 via RRF.
use_gitignorebooleanRespect .gitignore rules when expanding directories.

ask_batch Ask Batch

Execute N independent prompts concurrently against a single models.ini preset, bounded by its parallel slot count. When to use: Fanning out 2+ independent prompts (classifications, per-item extractions, parallel checks) to the same preset in one round-trip. When NOT to use: Single prompts or queries requiring file_paths or images (use ask_preset). Behavior: Preserves the exact input order of prompts (results[i] maps to prompts[i]) and returns individual item failures inline as Error: entries without aborting sibling prompts. Optional audio_paths and output_paths align positionally 1-to-1 by i…

ParameterTypeDescription
preset *stringTarget [preset] section name from models.ini.
prompts *arrayList of prompts to execute in parallel.
audio_pathsOptional per-item audio file path(s) matching prompts.
file_slicesOptional per-item 'path:line' / 'path:start-end' slice lists matching prompts.
json_schemastringOptional JSON Schema string for structured output.
output_pathsOptional per-item workspace-bounded output file paths matching prompts.
show_thinkingOptional override to preserve <think> reasoning in output (forced False when json_schema is set).
system_promptOptional shared system prompt override.
timeout_sPer-call HTTP timeout override in seconds.

warmup_model Warmup Model

Preload a preset into VRAM/RAM via POST /models/load and acquire or extend an in-memory idle lease (idle_timeout_seconds). When to use: Before latency-sensitive interactive turns or multi-step loops where cold-load latency should be paid upfront. When NOT to use: One-off queries or stingy residency setups where models unload immediately. Behavior: Enforces models_max; skips reload and extends the active lease if already warm, evicts the oldest unleased idle model when full, or returns {"ok": false, "error": ...} if all slots hold unexpired leases.

ParameterTypeDescription
preset *stringPreset name from models.ini to warm up.
idle_timeout_secondsOptional in-memory idle lease override in seconds for this session.

unload_model Unload Model

Cancel any active idle lease on a preset and evict it from VRAM/RAM via POST /models/unload. When to use: Reclaiming GPU memory immediately for external workloads or before loading a larger model under tight models_max. When NOT to use: Routine post-query cleanup (idle models unload automatically after sleep_idle_seconds). Behavior: Idempotent; cancels the lease immediately and evicts the model slot via POST /models/unload once active generation completes or aborts (succeeding cleanly in standby/stopped states).

ParameterTypeDescription
preset *stringTarget [preset] section name from models.ini to evict from VRAM/RAM (e.g. 'digest', 'coder', 'vision').