Skip to content

Studio: make the claude mcp add command work in every project - #16839

Merged
Lyxot merged 1 commit into
unslothai:mainfrom
NilayYadav:claude-mcp-snippet-user-scope
Nov 6, 2026
Merged

Lyxot merged 1 commit into
unslothai:mainfrom
NilayYadav:claude-mcp-snippet-user-scope

Conversation

@NilayYadav

@NilayYadav NilayYadav commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

The claude mcp add command shown under Settings > API > Allow agent connections added the Unsloth Studio server only to the folder it was pasted in, so the agent did not see it in any other project. When no new key was on screen, the command also put $UNSLOTH_API_KEY in double quotes, so the shell filled in the key at paste time. Pasting the command before setting the variable, which the hint under it allows, saved an empty Authorization: Bearer header and every Studio tool call failed with a missing API key error.

The command now adds the server with --scope user and passes the header as a single-quoted ${UNSLOTH_API_KEY}, so the agent reads the key from the environment each time it starts. This matches the command in studio/MCP.md and what unsloth mcp add writes. The command shown with a newly created key also gets --scope user.

Screenshots

Settings > API > Allow agent connections, Claude Code selected, no new key on screen.

Before After
before after

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 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-06T06:53:23.774135Z 395bc67 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 395bc674a9

ℹ️ 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".

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".

danielhanchen added a commit that referenced this pull request Nov 6, 2026
…s are added (#16856)

## Summary

From 21:00 UTC yesterday until #16809 merged, `Frontend unit tests
(Windows)` and `Frontend build + bundle sanity` failed on every frontend
PR (#16826, #16829, #16831, #16839, #16854 and others) with the same
test:

```
not ok 4712 - family options follow the backend registry, deduplicated, and every backend family has a label
  location: 'studio/frontend/tests/family-override.test.ts:54:1'
+ [ [ 'chroma', 'chroma' ], [ 'anima', 'anima' ] ]
- []
```

#16710 added the `chroma` and `anima` image families to the backend
registry. That part is fine, and #16809 added the missing picker labels.
The test caught it correctly, but on the wrong PR: it reads
`diffusion_families.py` and `video_families.py`, yet only Frontend CI
runs it, and Frontend CI only triggers on `studio/frontend/**`. So the
backend-only PR that added the families never ran it and merged green,
and the next frontend PR inherited the failure.

## Change

`studio/backend/tests/test_family_override_labels.py`, a new test only.
It takes every family name from `diffusion_families._FAMILIES` and
`video_families._FAMILIES`, reads the keys of `LABELS` in
`family-override.ts`, and fails if a family has no label, naming the
missing ones. Backend CI triggers on `studio/**`, so the PR that adds a
family now has to add its label too.

A second small test pins the `LABELS` parser on quoted (`"flux.1":`) and
bare (`sdxl:`) keys, so a reformatted table cannot quietly read as
empty.

Running Frontend CI on every family registry change would also work, but
those files change many times a day and the frontend jobs include
Windows and macOS legs. One backend test costs under a second. No
product code changes, and the frontend test stays as it is.

## Testing

- On main (with #16809): 2 passed.
- Deleting `chroma: "Chroma"` from `LABELS` again: fails with `add these
families to LABELS in family-override.ts: ['chroma']`.
- The file sorts into the existing `a-f` backend shard by glob.
`tests/test_ci_backend_pytest_shards.py`: 26 passed.
@Lyxot Lyxot self-assigned this Nov 6, 2026
@Lyxot

Lyxot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 395bc674a9

ℹ️ 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".

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".

@Lyxot

Lyxot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Review done, no changes made to the branch.

  • Codex: Didn't find any major issues on 395bc674a9.
  • CI: all 45 checks pass in a staging run of the same head against current main. The earlier failures here were family-override.test.ts, which was broken on main at the time and fixed by Studio: label the Chroma and Anima families in the family picker #16809, plus CPU jobs cancelled at the runner timeout. Neither is related to this PR.
  • Verified the generated command with the real claude CLI in zsh/bash and PowerShell: the server is added to user config, the header is stored as Bearer ${UNSLOTH_API_KEY}, and the key is read from the environment when Claude Code starts, in any project.
  • Note for users who ran the old command: their project-local unsloth-studio entry (with an empty Bearer) still takes precedence in that one project, so they should run claude mcp remove --scope local unsloth-studio there.

@Lyxot Lyxot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Lyxot
Lyxot merged commit 1f5b335 into unslothai:main Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants