Skip to content

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

Merged
morluto merged 2 commits into
morluto:mainfrom
cpruijsen:feat/lm-studio-client
Nov 4, 2026
Merged

morluto merged 2 commits into
morluto:mainfrom
cpruijsen:feat/lm-studio-client

Conversation

@cpruijsen

@cpruijsen cpruijsen commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

rea setup can now register REA with LM Studio, so REA's tools are available to models that run locally in LM Studio. Setup, doctor and uninstall support the new lm_studio client in the same way as the other clients registered during setup (WorkBuddy, Kimi Code, Qwen Code and others).

LM Studio registrations pin the compact input-schema profile, the same mechanism Kimi Code uses. Compact is already REA's default, but the pinned value keeps it if the default changes. Local models have small context windows, and the size of REA's tool list matters more for them than for hosted clients.

No issue is linked. This is a new client in the existing setup boundary, following the earlier client-registration PRs.

Problem and expected behavior

LM Studio (0.4.x) runs MCP servers from <LM Studio home>/mcp.json. REA had no LM Studio client, so users had to write the entry by hand, with no doctor check and no uninstall.

Expected after this change:

  • rea setup --client lm_studio writes mcpServers.rea into LM Studio's mcp.json with env.REA_MCP_INPUT_SCHEMA_PROFILE=compact, keeps sibling servers, and backs up the file.
  • rea doctor --client lm_studio reports the registration state.
  • rea uninstall removes only REA's entry.

Measured model-facing tool list from this branch's built CLI (tools/list over stdio; 234 tools; name, description and input schema serialized as JSON): full profile 971,817 bytes, compact profile 299,236 bytes. At about 4 bytes per token, that is roughly 243k versus 75k tokens before the first tool call.

Change and scope

  • SupportedClients.ts: an lm_studio client with a read-only location resolver that follows LM Studio's own findLMStudioHome (lmstudio-js packages/lms-common-server/src/findLMStudioHome.ts): the trimmed contents of ~/.lmstudio-home-pointer if that file exists, else an existing ~/.cache/lm-studio, else ~/.lmstudio. Setup never writes the pointer file (the SDK does). An unreadable pointer, or one that does not hold an absolute path, is reported as a path error instead of a guessed home.
  • ClientConfigurationDocument.ts: an lm_studio format on the existing strict JSON.parse path (as for Pi and Kimi Code). The LM Studio app parses mcp.json with JSON.parse and then a zod schema, so comments, trailing commas and a BOM are refused before any backup or write.
  • compactInputSchemaByDefault in SupportedClients.ts now owns the compact default for Kimi Code and LM Studio, in setup (SetupClientConfiguration.ts) and doctor (ClientRegistrationStatus.ts). Doctor resolves provider request budgets only for Kimi Code and Codex, as setup does, so an LM Studio entry that selects IDA is not marked invalid over an IDA deadline it never uses. Kimi Code behavior is unchanged.
  • The entry is { command, args, env }. LM Studio's stdio schema is command, args, cwd, env and timeout.

What I chose and the alternative: I left out timeout, because I could not establish its unit from the app. Doctor reports an LM Studio entry without the profile as stale, as it does for Kimi Code. An advisory instead of stale is a reasonable alternative, because for LM Studio a missing profile is a context-size cost, not a failure. I kept the existing Kimi Code rule for consistency. In the tests, the registered launcher is currentClientRegistrationCommand(), as in the Kimi Code tests, because doctor compares against the installation that setup binds; a fixed command constant would not match it.

Not included: SSE and remote entries, cwd, a client-specific skill path, and any tool subset for small-context models.

Scope: a new client inside the existing setup boundary. A maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: client definition and location resolution (SupportedClients.ts), then configuration parsing.

  • Contribution scope fit and linked maintainer decision: not applicable (new setup client, same pattern as feat(setup): add WorkBuddy client support #3041 and feat(setup): add Kimi Code client support #2744).

  • CLI and MCP/tool-catalog contract: lm_studio is a new accepted --client value in setup, doctor and uninstall output. No tool catalog changes.

  • Provider, bridge, target-format, or platform compatibility: LM Studio on macOS, Linux and Windows (one home resolver; the pointer file and fallbacks are the SDK's on every platform).

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: setup writes only LM Studio's mcp.json and its .rea.backup, never the pointer file.

  • Generated metadata: the generated product catalog gains an lm_studio setup client (regenerated, not committed). npm run docs:check passes.

  • Read existing files or captured data.

  • Change process memory, registers, files, or configuration. (Setup writes LM Studio's mcp.json.)

Evidence and regression coverage

  • Tests added: tests/boundary/filesystem/lmStudioClientConfiguration.test.ts (14 cases): configure into the default, pointer and cache homes; the pointer wins over an existing cache directory; a relative pointer is reported, not guessed; doctor is aligned after setup in each home; sibling servers are preserved, the backup is written, a second run is unchanged and uninstall removes only REA; an explicit full profile is kept and an omitted profile is reported stale; comment, trailing-comma, truncated and BOM files are refused before backup or write. clientLifecycle.test.ts lists the new client. clientRegistrationStatus.test.ts adds LM Studio and Kimi Code to the provider-budget case: a failing budget resolver leaves LM Studio valid and still invalidates Kimi Code and Codex.
  • Base reproduction: on base (293db94dd), rea setup --client lm_studio --yes exits 1 with Invalid option for client.0, and the new test file fails 14 of 14 (no LM Studio client). With the change, all pass.
  • Written file check: after rea setup --client lm_studio --yes against a temporary pointer home with a sibling server, the file passes the app's rule (JSON.parse, then every mcpServers entry has a string command, a string array args and a string record env) for both entries, the pointer file is unchanged, and doctor reports aligned.
  • Live check on this head in LM Studio 0.4.26 on macOS: rea setup --client lm_studio wrote the entry into my LM Studio mcp.json (configured, doctor aligned). Through the LM Studio API with the mcp/rea integration, LM Studio started the registered command and qwen3.8-27b@8bit (MLX, 131072-token context, 66,582 input tokens for the first turn) called binary_session from the compact tool list. Its provider report matched rea doctor on the same machine. Setup refused to overwrite an existing rea entry it did not write, as intended.
  • Remaining proof gaps: I did not check how LM Studio treats an empty mcp.json (setup initializes it, as for Kimi Code).

Validation performed

  • lmStudioClientConfiguration.test.ts and clientLifecycle.test.ts: 76 passed (14 new, 62 lifecycle). On base: the new file fails 14 of 14.
  • src/application plus the client configuration and Kimi Code boundary tests: 3,539 passed, 15 skipped (Kimi Code shares the compact predicate).
  • npm run check:fast: passed.
  • npm run verify:test-discovery: passed.
  • npm run docs:check: passed.
  • npm run verify:package: passed.
  • npm pack --dry-run: passed.
  • Platform: macOS (arm64), Node 24.22.1.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. A new client only.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable. Tests ran on macOS.
  • Package or release metadata impact: the generated product catalog lists the new client (regenerated, not committed).
  • Security, privacy, process, or containment review: setup reads the LM Studio home pointer and writes only mcp.json and its backup in the resolved home.

Author readiness

Human owner: @cpruijsen

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T11:36:14.041641Z 2f53983 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The PR appears safe to merge; the earlier documentation mismatch is fixed and no new blocking issue was found.

Summary

Adds LM Studio to setup, doctor, and uninstall through the existing client configuration workflow.

  • LM Studio can load REA tools from its own settings file.
  • LM Studio registrations use the compact input-schema profile by default.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Kimi, Codex or LM Studio registration"] --> B["Check stored settings"]
  B --> C{"Kimi Code or Codex?"}
  C -->|Yes| D["Read provider deadline"]
  C -->|No: LM Studio| E["Keep checked settings"]
  D --> F["Check launcher, profile and state"]
  E --> F
Loading

Reviews (2) · Last reviewed commit: "fix(doctor): resolve provider budgets fo..." · Reviewed by Greptile

Comment thread docs/client-configuration.md Resolved
@greptile-apps

This comment has been minimized.

@morluto
morluto merged commit 398eb0d into morluto:main Nov 4, 2026
49 checks passed
@morluto morluto mentioned this pull request Nov 11, 2026
3 tasks done
@morluto morluto added area: setup Setup, packaging, upgrade, install, Doctor, and client registration enhancement New feature or request labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: setup Setup, packaging, upgrade, install, Doctor, and client registration enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants