Source: michaelhannecke/mlx-model-scout (MIT, Python, FastMCP), a capstone project from an agent-engineering course, surfaced by Paul Iusztin on 2026-11-19. README validation data dated 2026-10-28.
What it is
An MCP server that answers a practical question: which of the thousands of MLX conversions on Hugging Face will fit in this Mac's memory, how fast will it decode, and which suits my use case? It runs a small team of agents (planner, scout, analyst, advisor) on a local LLM served on 127.0.0.1, so prompts and reports never leave the machine. The only outbound traffic is search terms and public repo ids sent to the Hub.
The design point worth studying is the split of responsibilities: agents plan, search, read model cards and write recommendations; a deterministic calculator produces every number; a human approves at two server-enforced checkpoints.
Architecture
Plan. The planner LLM turns a use case ("Python coding assistant in the IDE") into Hub search terms.
Scan. Parallel Hub scans; the scout LLM shortlists candidates.
Compute. A pure-Python calculator estimates memory fit and decode speed per candidate. If nothing fits, it tries smaller quantizations or shorter contexts.
Checkpoint 1. The user keeps, removes or adds candidates, or changes the context length.
Analyze. The analyst LLM extracts a small, flat set of facts from each model card.
Advise. The advisor LLM ranks and explains; code then checks every repo id and number in the draft against the inputs.
Checkpoint 2. The user approves, rejects or asks for a revision.
Save. The approved report and a full audit trail (every LLM call, tool call and decision) go to SQLite, browsable with Datasette.
The checkpoints are state-machine gates in the server, not prompt instructions: a run cannot reach a report without a selection, and nothing is saved as approved without an explicit approval.
How the numbers are produced
| Quantity | Method |
|---|---|
| Weight memory | actual safetensors download size from the Hub API (exact); parameter formula only as fallback |
| KV cache | per layer, 2 x kv_heads x head_dim x tokens x 2 bytes; sliding-window layers cap tokens at the window |
| Available memory | min(GPU wired limit, unified memory minus reserve) |
| Decode tok/s | bandwidth x efficiency / (active weight bytes + KV bytes); efficiency 0.8 dense, 0.6 MoE |
Two details are good practice. Parameter counts come from config.json because the Hub's metadata is wrong for quantized MLX repos (weights are packed into uint32). And per-layer KV accounting matters for hybrid architectures: on a 64-layer model with only 16 full-attention layers, treating every layer as full attention predicts 11.8 tok/s at 24k context against a measured 16.0. The README's estimates land within a few percent of measured speeds on an M5 Pro.
Making small local models reliable
Structured output without constrained decoding. JSON schema in the system prompt, strip a leading think block and code fences, Pydantic validation, retry with the validation error. Schemas are kept small and flat because small local models fail on nested ones.
Limits enforced in code. Local models ignore "max N" in a schema, so caps are applied after validation.
Facts split by source. License, base model and pipeline tag come from YAML front matter; the LLM fills only summary, use cases, strengths and caveats. Benchmark scores survive only if the number appears verbatim in the card.
Graceful degradation. With no local LLM running, scanning, analysis and fit estimation still work and the agent steps fall back to deterministic rules, saying so.
No MCP sampling. The server deliberately avoids handing generation to the client's model, which could be a cloud model, to keep the privacy guarantee.
Tradeoffs and limitations
Efficiency factors were calibrated on one dense and one MoE model on one machine, and the speed table validates against those same models, so it is a fit check, not an independent test.
Prefill time (time to first token) is not estimated, only decode.
Model downloads and benchmarks are mocked in the current version.
Qualitative LLM text (rationales, trade-offs) is grounded and number-checked but not verified.
Vision and audio towers are counted in weight memory, so estimates are slightly conservative for text-only use.
The HTTP transport has no authentication by design and must stay bound to localhost.
Failure modes to watch
Calibration drift. New chips, new MLX releases or new attention variants (sliding window is not yet measured) can move real speeds away from the 0.8/0.6 factors.
Card-derived text is untrusted input. Model cards are attacker-editable; the project length-caps and marks them as untrusted, which is the right posture for any agent that reads third-party documentation.
Agent-mode client answers are free text and can suggest commands that do not exist; only the server workflow's outputs are validated.
Review checklist for similar agent tools
Does any number in the output come from the LLM? If so, can it move to code?
Are human checkpoints enforced by server state, or only requested in a prompt?
Is every LLM output validated against the inputs it was given (no invented ids, no altered numbers)?
Are schemas small enough for the weakest model you will run?
Does the system degrade to deterministic behaviour when the model is down?
Is there an audit log of calls and human decisions, with retention controls?
Are third-party texts the agent reads treated as untrusted?
Related entries
R072 llama.cpp 1.0 and R067 Inkling 2 Small: the local-inference and open-weight side of the same question.
R091 FastMCP 4.2 and R134 CodeGraph: other local MCP servers; R141 on policy-gated approval as a server-side gate.