Repository navigation
Parse JSON array string for MCP stdio connection args - #74500
Closed
pankajkoti wants to merge 1 commit into
Closed
pankajkoti wants to merge 1 commit into
pankajkoti wants to merge 1 commit into
Conversation
The mcp connection form stores the Arguments field as a string, and its description tells users to enter a JSON array. get_conn wrapped any string into a one-item list, so a value like ["-m", "my_server"] reached the stdio transport as a single bogus argv entry. A string starting with "[" is now parsed as a JSON array of strings, and a malformed array or non-string items raise a ValueError naming the connection. Any other string is still treated as a single argument. The connection docs describe both forms. Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
|
Looks like #74451 already includes this fix. Closing this one! |
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.
The
mcpconnection form stores the Arguments field as a string, and its description tells users to enter a JSON array.MCPHook.get_connwrapped any string into a one-item list, so a value like["-m", "my_server"]reached the stdio transport as a single bogus argv entry and the server failed to start.A string starting with
[is now parsed as a JSON array of strings. A malformed array or non-string items raise aValueErrornaming the connection, without echoing the value since args can carry tokens. Any other string is still treated as a single argument, so existing connections that use a bare string keep working. The connection docs describe both forms.A single literal argument that starts with
[must now be written as a one-item array, for example["[::1]"].This touches the same lines as #74451, which validates
argsandtimeout. The parsing lives in a small helper so the two should merge cleanly. After both land, the list-of-strings check from #74451 still applies to non-string, non-list values.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines