Repository navigation
feat(setup): register LM Studio during setup - #8611
Merged
Merged
Conversation
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.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The PR appears safe to merge; the earlier documentation mismatch is fixed and no new blocking issue was found. SummaryAdds LM Studio to setup, doctor, and uninstall through the existing client configuration workflow.
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
Reviews (2) · Last reviewed commit: "fix(doctor): resolve provider budgets fo..." · Reviewed by Greptile |
This comment has been minimized.
This comment has been minimized.
3 tasks done
4 of 22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rea setupcan 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 newlm_studioclient in the same way as the other clients registered during setup (WorkBuddy, Kimi Code, Qwen Code and others).LM Studio registrations pin the
compactinput-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_studiowritesmcpServers.reainto LM Studio'smcp.jsonwithenv.REA_MCP_INPUT_SCHEMA_PROFILE=compact, keeps sibling servers, and backs up the file.rea doctor --client lm_studioreports the registration state.rea uninstallremoves only REA's entry.Measured model-facing tool list from this branch's built CLI (
tools/listover stdio; 234 tools; name, description and input schema serialized as JSON):fullprofile 971,817 bytes,compactprofile 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: anlm_studioclient with a read-onlylocationresolver that follows LM Studio's ownfindLMStudioHome(lmstudio-jspackages/lms-common-server/src/findLMStudioHome.ts): the trimmed contents of~/.lmstudio-home-pointerif 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: anlm_studioformat on the existing strictJSON.parsepath (as for Pi and Kimi Code). The LM Studio app parsesmcp.jsonwithJSON.parseand then a zod schema, so comments, trailing commas and a BOM are refused before any backup or write.compactInputSchemaByDefaultinSupportedClients.tsnow 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.{ command, args, env }. LM Studio's stdio schema iscommand,args,cwd,envandtimeout.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 iscurrentClientRegistrationCommand(), 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_studiois a new accepted--clientvalue 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.jsonand its.rea.backup, never the pointer file.Generated metadata: the generated product catalog gains an
lm_studiosetup client (regenerated, not committed).npm run docs:checkpasses.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/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 explicitfullprofile is kept and an omitted profile is reported stale; comment, trailing-comma, truncated and BOM files are refused before backup or write.clientLifecycle.test.tslists the new client.clientRegistrationStatus.test.tsadds 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.293db94dd),rea setup --client lm_studio --yesexits 1 withInvalid optionforclient.0, and the new test file fails 14 of 14 (no LM Studio client). With the change, all pass.rea setup --client lm_studio --yesagainst a temporary pointer home with a sibling server, the file passes the app's rule (JSON.parse, then everymcpServersentry has a stringcommand, a string arrayargsand a string recordenv) for both entries, the pointer file is unchanged, and doctor reportsaligned.rea setup --client lm_studiowrote the entry into my LM Studiomcp.json(configured, doctoraligned). Through the LM Studio API with themcp/reaintegration, LM Studio started the registered command andqwen3.8-27b@8bit(MLX, 131072-token context, 66,582 input tokens for the first turn) calledbinary_sessionfrom the compact tool list. Its provider report matchedrea doctoron the same machine. Setup refused to overwrite an existingreaentry it did not write, as intended.mcp.json(setup initializes it, as for Kimi Code).Validation performed
lmStudioClientConfiguration.test.tsandclientLifecycle.test.ts: 76 passed (14 new, 62 lifecycle). On base: the new file fails 14 of 14.src/applicationplus 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.Compatibility, safety, and release
mcp.jsonand its backup in the resolved home.Author readiness
Human owner: @cpruijsen
Before merge
type(scope): outcome.