Studio: clearer MCP server validation when stdio is disabled#5928
Merged
danielhanchen merged 2 commits intoJun 1, 2026
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the MCP server URL validation logic by introducing a helper function _looks_like_command to check for whitespace, which helps distinguish between URLs and local commands. The validation error message has been improved to clearly state when local commands are disabled on the server. Corresponding unit tests have been added and updated to verify these changes and ensure backward compatibility for ambiguous lone tokens. There are no review comments, and I have no feedback to provide.
for more information, see https://pre-commit.ci
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.
Follow-up to #5863 (stdio MCP server support), after @Datta0's comment: #5863 (comment)
Problem
The "URL or command" field accepts an http(s):// URL or, where stdio is enabled, a local command (e.g.
npx -y @modelcontextprotocol/server-filesystem /tmp). On a host where stdio is off, typing a command was rejected with "url must start with http:// or https://". For a command that reads as "your command is a malformed URL" and doesn't explain the real reason.Changes
This only changes the rejection message. What gets accepted is unchanged.
example.commay just be a URL missing its scheme, so the message doesn't assume it was a command.Notes
Backend only. Tests added.