Skip to content

Parse JSON array string for MCP stdio connection args - #74500

Closed
pankajkoti wants to merge 1 commit into
apache:mainfrom
astronomer:airflow-common-ai-mcp-args-json
Closed

pankajkoti wants to merge 1 commit into
apache:mainfrom
astronomer:airflow-common-ai-mcp-args-json

Conversation

@pankajkoti

Copy link
Copy Markdown
Member

The mcp connection form stores the Arguments field as a string, and its description tells users to enter a JSON array. MCPHook.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 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 a ValueError naming 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 args and timeout. 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?
  • Yes (Claude Code)

Generated-by: Claude Code following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.

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>
@pankajkoti

Copy link
Copy Markdown
Member Author

Looks like #74451 already includes this fix. Closing this one!

@pankajkoti pankajkoti closed this Oct 9, 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.

1 participant