feat(setup): register LM Studio during setup (#8611)

* feat(setup): register LM Studio during setup

Register rea in mcp.json in the LM Studio home through a new lm_studio
client. The home follows LM Studio's own lookup, read-only: the path in
~/.lmstudio-home-pointer, else an existing ~/.cache/lm-studio, else
~/.lmstudio. An unreadable or relative pointer reports a path error
instead of a guessed home.

LM Studio parses mcp.json with strict JSON.parse, so comments, trailing
commas and a BOM are rejected before any backup or write. The entry
carries command, args and env with no type or timeout. Local models have
small context windows, so the registration selects
REA_MCP_INPUT_SCHEMA_PROFILE=compact unless a profile is set explicitly,
and doctor reports an entry without a profile as stale. One predicate now
owns that default for Kimi Code and LM Studio.

* fix(doctor): resolve provider budgets for LM Studio as setup does
This commit is contained in:
Christopher Pruijsen authored and GitHub committed 2026-11-04 19:52:16 +08:00
1 parent 103684bce1
commit 398eb0d1f1
9 files changed
+295 -16

No files matched your search

@@ -152,9 +152,10 @@ const parseDocument = (
// Pi loads `mcp.json` with a strict `JSON.parse` and no BOM tolerance, so
// comments, trailing commas, a BOM, or an empty existing file must be
// rejected instead of registering into a document the client cannot load.
// Kimi also reads mcp.json with JSON.parse and an empty-file fallback.
if (format === "pi" || format === "kimi") {
if (format === "kimi" && text.trim().length === 0) return {};
// Kimi and LM Studio also read mcp.json with JSON.parse; an empty file holds
// nothing to preserve.
if (format === "pi" || format === "kimi" || format === "lm_studio") {
if (format !== "pi" && text.trim().length === 0) return {};
return requireObject(JSON.parse(text), "The configuration root");
}
// An empty file, which some clients create before any server is added,
@@ -1748,7 +1749,8 @@ export const clientRegistrationEntry = (
: { environment: { ...environment } }),
};
case "kimi":
// Kimi infers stdio from command; it uses `transport`, not `type`.
case "lm_studio":
// Both infer stdio from command; Kimi uses `transport`, not `type`.
return {
command: executable,
args,