Repository navigation
Studio: per-tool MCP switches at the end of Settings > Agents - #15629
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
Lets the owner choose which of Unsloth Studio's MCP tools agents can see.
The Agent access (MCP) switch and setup snippet move to the end of
Settings > Agents, under an "Unsloth MCP" heading, with a Tools row
("20 of 23 on") that opens a dialog. The dialog groups the tools (Models,
Generate, Training and export, Data and library, Jobs) with one switch per
tool, one per group, and Turn all on. Settings > API keeps a one-line link
to it.
A tool that is off is left out of tools/list and calls to it are refused.
Saves send only the changed tools (tool_states) and the server merges them,
so two windows toggling different tools both keep their change.
Co-authored-by: Daniel Han <[email protected]>
c650b07 to
d285df0
Compare
|
Tested at On a Mac (macOS 26) the backend MCP and settings suites pass with the same 9 unrelated failures as main, and typecheck, build and bundle:check are clean. Settings > API: the MCP section moves out, a status row stays Before After Settings > Agents: the new Unsloth MCP section at the end Before: Agents ends at "Preview without launching". After: the access switch, the new Tools row, the snippet and a link to create a key. Turning a tool off: Choose tools, flip Chat
The Tools row then reads 22 of 23: Two small things, neither blocking:
Nits: the null- |
# Conflicts: # studio/frontend/scripts/check-bundle-budget.ts
…s, and match id/vi tool labels to their files
|
Codex is clean at |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
# Conflicts: # studio/frontend/scripts/check-bundle-budget.ts
A description key per catalog tool, null for a tool this build doesn't know.
The 28 switches read as a wall, and a group switch looked off when only some of its tools were. Tools are now pills like the Hub filter: on is the stronger fill with a tick, off the lighter fill with muted text. Each group and the whole list get one row that reads "7 of 8 on" and ends in Select all or Select none. Three columns fit every group without scrolling, and a rule shows above Done when the list does scroll. Hover says what a tool does above its raw name. Changes flip at once instead of disabling the dialog while each save runs; a late reply can't undo a newer change, and a rejected one still resyncs.
turnAllOn and groupToggle, in every locale.
… reply undoes the other
|
Tested the new tools dialog ( Setup: Colab T4 (15 GB, driver 580.82.07), Ubuntu 24.04.4, headless Chromium 156 driven with Playwright on the VM against localhost.
Before and after were separate frontend builds on separate ports, sharing one Unsloth Studio home. Captured at 2x, light and dark. Settings > Agents: the new Unsloth MCP card at the end The tools dialog: all on, then with Generate video, Start training and Export model off. Groups that are partly on switch their action to Select all. Hovering a tool shows what it does, with the raw tool name under it: Settings > API: the full MCP section becomes one status row that links to Agents. What I checked (in the UI, plus
Not tested:
|
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Replaces #14349, with the same final code as one commit. It is stacked on #15629, so merge that first. Until then this diff also shows #15629's changes, and only the last commit is new. It includes the fixes Daniel and Nilay made on #14349, and both are credited as co-authors. ## Summary This PR adds an **Unsloth** preset at the top of the chat MCP dropdown. Ticking it lets the chat model call Unsloth Studio's own MCP tools in process, with no API key to paste and no network listener.  - **Which tools the chat gets:** only the tools the owner left on in Settings > Agents > Choose tools, minus the ones that would evict or re-enter the chat that calls them: `chat`, `load_model`, `unload_model`, `cancel`, `start_training`, `export_model` and `run_recipe` (`CHAT_DENYLIST` in `mcp_server.py`). The tools dialog names those once, in a note under the groups. - **Toggles apply right away:** the row's tools are re-listed on every send, so a change in Settings applies to the next message. - **External agent access is unaffected:** it works whether or not "Agent access (MCP)" is on, and `/mcp` still returns 404 while that is off.  ## Safety - **Per-call key:** each tool call runs as the chat's own account, with an internal API key minted for that call. The key is deleted when the call ends, including on Stop, timeout and error. - **No host files:** host file paths are refused for these calls, even for the owner. - **Who can turn it on:** only a signed-in UI session can add the row or point another row at it. API keys and keyless callers get 403, and keyless callers never see the row. - **Stop:** a chat Stop also stops the image, audio or video job a tool call started. - **Model switches:** a chat tool call never switches the loaded model. - **Media links:** links open through the user's session, so they work in the desktop app and behind a proxy path prefix. ## Testing ```bash cd studio/backend python -m pytest tests/test_studio_tools_chat.py tests/test_mcp_*.py tests/test_settings*.py tests/test_systemone_connections.py tests/test_research_internal_key_monitor.py tests/test_fine_tuned_model_serving.py tests/test_openai_tool_passthrough.py cd ../frontend npm run typecheck && npm run i18n:check:strict && npm test && npm run build && npm run bundle:check ``` - **Backend:** 2,237 passed, plus 499 in the model-switch and tool-passthrough files. The same 3 `test_mcp_images.py` tests fail here and on main. - **Frontend:** typecheck clean, `i18n:check:strict` passes, and the settings, MCP and chat-composer tests pass (871). - **Bundle:** within budget. The budget grows by +1,363 B raw / +366 B transfer over #15629, from the chat preset and the note. I also ran Unsloth Studio from this branch to check the dropdown and the dialog note. <!-- studio-regress:start --> ### Studio UI regression check Base `81dc73ac4` vs head `fe799ee49`. Functional: **NO_REGRESSION**, UI coverage 83%, 1 visual change(s), 5 text-only change(s). Only steps whose screenshots differ are shown. Note: in this run diffusion_video failed once on head inside the regression harness's own fixture copy (a temp-dir race between the two arms, fixed in the harness), before any request reached Unsloth. A rerun of that journey on both arms at the same head gave 6/6 identical steps; its results are used here. **settings/s06_tab_api**: | reproduced on confirm (VISUAL_DIFF)  | Step | Text / structure change | |---|---| | `settings/s10_tab_agents` | {'removed': [], 'added': ['Unsloth MCP', 'Agent access (MCP)', 'Let coding agents […] use Unsloth over MCP.', '23 of 23 on', 'Choose t | | `parallel/stop_training` | {'removed': ['65/4.1k', 'Three fruits are named:', '#ctrl button:Name three fruits.', '#ctrl button:Context usage: 65 of 4.1k tokens'], 'added': ['Name three an | | `crawl/r_projects` | | | `crawl/r_export` | | | `crawl/r_data_recipes` | | <!-- studio-regress:end --> ### Chat MCP preset: before and after this layer BEFORE is #15629's head (`069a35528`), AFTER is this PR's head (`fe799ee49`), so only this layer's change shows; this is not the PR's own merge base. The chat's MCP menu now offers **Unsloth** first, which answers with Unsloth's own tools in process:  The tools dialog in Settings > Agents ends with the tools a chat never gets ("The chat never gets Load model, Unload model, Plan a load, Chat, Run Data Recipe, Start training, Export model, and Cancel work."):  --------- Co-authored-by: Daniel Han <[email protected]> Co-authored-by: Nilay Yadav <[email protected]> Co-authored-by: Etherl <[email protected]> Co-authored-by: LeoBorcherding <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>















Replaces #14348, with the same final code as one commit on current main. It includes the fixes Daniel made there, and he is credited as co-author.
Summary
Unsloth Studio's MCP server serves 23 tools. With all of them on, an agent spends about 18k tokens on tool definitions before it does anything. This PR lets the owner choose which tools agents can see.
Everything lives at the end of Settings > Agents, under an "Unsloth MCP" heading, so the name "MCP" stays free for a future tab that manages MCP servers:
The tools dialog
The first version had a switch per tool and per group, 28 in all. It read as a wall of switches, and a group switch showed off when only some of its tools were off. The dialog now works like the Hub filter:
Short window and phone width
Behavior
tools/list. A call to it fails with[tool_disabled] <tool> is turned off in Unsloth Studio. The owner can turn it on in Settings > Agents.make_short_filmandbuild_dataset_and_trainprompts are hidden while a tool they read (studio_statusorlist_models) is off.GET /api/settings/mcp-accessaddstools: [{name, area, enabled}].PUTaccepts{tool_states: {"<tool>": true|false}}. The server merges that into the stored list, so two windows toggling different tools both keep their change. The dialog only ever sends the tools that change.{disabled_tools: [...]}still replaces the whole list. An unknown tool name returns 422.UNSLOTH_STUDIO_ENABLE_MCP=1locks only the access switch, not the tool choice.studio/MCP.mddocuments the tool choice, andunsloth doctornow points at Settings > Agents.Testing
test_mcp_images.pyfail here and also fail on main at a595688.test_doctor_mcp.py, 30 passed.i18n:check:strictpasses for every locale, and the MCP, settings, API-key and agents tests pass (175). Each of the four redesign commits typechecks and passes those tests on its own.The tool descriptions and the new dialog strings in the 24 non-English locales were written without a native speaker and would benefit from a native read.
Studio UI regression check
Base
073f6e0ccvs head069a35528. Functional: NO_REGRESSION, UI coverage 82%, 1 visual change(s), 2 text-only change(s). Only steps whose screenshots differ are shown.settings/s06_tab_api: | reproduced on confirm (VISUAL_DIFF)

settings/s10_tab_agentscrawl/r_export