Skip to content

Studio: enable stdio MCP servers on a loopback bind#6295

Merged
Imagineer99 merged 10 commits into
unslothai:mainfrom
oobabooga:studio/stdio-mcp-loopback-default
Jun 15, 2026
Merged

Studio: enable stdio MCP servers on a loopback bind#6295
Imagineer99 merged 10 commits into
unslothai:mainfrom
oobabooga:studio/stdio-mcp-loopback-default

Conversation

@oobabooga

Copy link
Copy Markdown
Member

stdio MCP servers (local commands like npx -y @modelcontextprotocol/server-filesystem /tmp) only worked in the desktop app. Everywhere else they were off unless you set UNSLOTH_STUDIO_ALLOW_STDIO_MCP=1 before launch, which a lot of users can't reasonably do (see #5863 (comment)).

The gate treated a localhost webui the same as a 0.0.0.0 network bind, but those aren't the same risk. A loopback bind is the user's own machine, which is why the desktop app enables stdio there already.

Fix

run_server now sets UNSLOTH_STUDIO_ALLOW_STDIO_MCP=1 on a loopback host (127.0.0.1, localhost, ::1) via setdefault, the same thing main.py does for the desktop app. 0.0.0.0 and Colab are unchanged, still off unless you opt in, and an explicit =0 still force-disables. The loopback check lives in a new studio/backend/utils/host_policy.py mirroring the CLI's unsloth_cli/_tool_policy.py.

@oobabooga oobabooga requested a review from danielhanchen as a code owner June 13, 2026 07:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a host trust policy utility (host_policy.py) for the Studio backend to automatically enable local stdio MCP servers by default when bound to a loopback address. This aligns local installations with the security model of the desktop app. The changes also update the startup banner to use this new utility, adjust the frontend dialog text to reflect support for local installs, and add comprehensive unit tests to verify the loopback detection and environment variable preservation logic. I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6bc37fcd47

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/run.py Outdated
Comment thread studio/backend/run.py Outdated
Comment thread studio/backend/utils/host_policy.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22e70ab7d5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/startup_banner.py Outdated
Comment thread studio/backend/core/inference/mcp_client.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b7fe5d53f4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread unsloth_cli/_tool_policy.py Outdated
Comment thread studio/backend/utils/host_policy.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5078ebc9a5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/run.py Outdated
@Imagineer99

Copy link
Copy Markdown
Collaborator
image

CI passes except 3 test failures that are currently inherited from main, fix is valid and works as expected. Merging.

@Imagineer99 Imagineer99 merged commit 4176448 into unslothai:main Jun 15, 2026
29 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants