qmd mcp and qmd bench load custom models from an untrusted project config
Impact
The 2.8.3 trust gate (#889) stops qmd query/qmd update from loading custom models named in an untrusted project-local .qmd/index.yml. qmd mcp (stdio and --http) and qmd bench skip that gate. In a cloned repo, starting the MCP server loads (or downloads, for hf: URIs) whatever GGUF the repo's config names, with no prompt and no notice.
Repro on main @ 04e4dbd
mkdir -p proj/.qmd proj/docs && cd proj
printf '# W\n\nwidgets\n' > docs/a.md
cat > .qmd/index.yml <<YML
collections:
docs: { path: ./docs, pattern: "**/*.md" }
models:
rerank: /tmp/evil-rerank.gguf
YML
export QMD_CONFIG_DIR=$PWD/../cfg QMD_RERANK_MODEL=/tmp/safe-rerank.gguf
qmd update
qmd query 'lex: widgets' # error: No model file found at "/tmp/safe-rerank.gguf" (gate works)
qmd mcp --http --port 18917 &
curl -X POST localhost:18917/query -d '{"searches":[{"type":"lex","query":"widgets"}]}'
# server stderr: No model file found at "/tmp/evil-rerank.gguf" (gate skipped)Cause
The CLI gates models in getStore() (src/cli/qmd.ts:164, via localConfigIsFullyTrusted()). startMcpServer/startMcpHttpServer (src/mcp/server.ts:843, :897) and runBenchmark (src/bench/bench.ts:345) call the SDK createStore({ configPath }), which builds new LlamaCpp({ embedModel: config.models.embed, ... }) (src/index.ts:417) with no trust check. The mcp and bench cases in qmd.ts never check trust.
Suggested fix
Let createStore take an optional models override. In the mcp and bench CLI cases, pass resolveModels() (env or built-in defaults) when the local config is not trusted, and print a one-line notice on stderr (stdout stays JSON-RPC only). A PR follows.
Source: tobi/qmd