Skip to content

Make MCPStdioServerConfig.args optional across all SDKs#1347

Merged
stephentoub merged 1 commit into
mainfrom
optionalargs
May 20, 2026
Merged

Make MCPStdioServerConfig.args optional across all SDKs#1347
stephentoub merged 1 commit into
mainfrom
optionalargs

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

Summary

The runtime schema (@github/copilot 1.0.51-2) now allows args to be omitted from stdio MCP server configurations. This PR updates the user-facing types across all five SDKs to match, and adds E2E test coverage for the omitted-args case.

Changes

Type changes:

SDK Before After
Node.js args: string[] args?: string[]
Go json:"args" json:"args,omitempty"
Python args: list[str] args: NotRequired[list[str]]
Rust #[serde(default)] #[serde(default, skip_serializing_if = "Vec::is_empty")]
.NET IList<string> Args { get => field ??= []; set; } IList<string>? Args { get; set; }

E2E tests: Each SDK now has a test that creates a session with MCPStdioServerConfig omitting args entirely, verifying the session creates and responds successfully.

Validation

  • All SDK builds pass (Node.js, Go, .NET, Rust)
  • TypeScript type-check passes
  • Generated wire types already had args as optional — this aligns user-facing types

Fixes #1231

@stephentoub stephentoub requested a review from a team as a code owner May 20, 2026 16:17
Copilot AI review requested due to automatic review settings May 20, 2026 16:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the public SDK surface area (and accompanying E2E scenarios) to align with the updated runtime schema allowing MCPStdioServerConfig.args to be omitted for stdio/local MCP server configurations.

Changes:

  • Made args optional/omittable in user-facing MCP stdio config types across Node.js, Go, Python, Rust, and .NET.
  • Added cross-SDK E2E tests validating session creation and basic prompting works when args is omitted.
  • Added new replay snapshots supporting the new E2E scenarios.
Show a summary per file
File Description
test/snapshots/mcp_and_agents/should_accept_mcp_server_configuration_without_args.yaml New replay snapshot for “should accept … without args” scenario.
test/snapshots/mcp_and_agents/accept_mcp_server_config_without_args.yaml New replay snapshot for “accept … without args” scenario.
rust/tests/e2e/mcp_and_agents.rs Adds Rust E2E coverage for omitted args.
rust/src/types.rs Omits args from serialization when empty (treats omitted as default empty).
python/e2e/test_mcp_and_agents_e2e.py Adds Python E2E coverage for omitted args.
python/copilot/session.py Updates Python MCP stdio config typing to reflect optional args.
nodejs/test/e2e/mcp_and_agents.e2e.test.ts Adds Node.js E2E coverage for omitted args.
nodejs/src/types.ts Makes MCPStdioServerConfig.args optional in TS types.
go/types.go Adds omitempty to omit args when unset/empty during JSON marshaling.
go/internal/e2e/mcp_and_agents_e2e_test.go Adds Go E2E coverage for omitted args.
dotnet/test/E2E/SessionMcpAndAgentConfigE2ETests.cs Adds .NET E2E coverage for omitted args.
dotnet/src/Types.cs Makes Args nullable so it can be omitted on the wire when unset.

Copilot's findings

  • Files reviewed: 12/12 changed files
  • Comments generated: 1

Comment thread python/copilot/session.py
@github-actions

This comment has been minimized.

@stephentoub stephentoub force-pushed the optionalargs branch 2 times, most recently from 08deeff to f8795d9 Compare May 20, 2026 17:49
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

The runtime schema now allows args to be omitted from stdio MCP server
configs. Update user-facing types to match:

- Node.js: args: string[] -> args?: string[]
- Go: add omitempty to Args json tag (nil/empty not serialized)
- Python: mark args as NotRequired[list[str]]
- Rust: add skip_serializing_if = Vec::is_empty
- .NET: make Args nullable (IList<string>? with no lazy init)

Add an E2E test for each SDK that creates a session with an
MCPStdioServerConfig that omits args entirely, verifying the optional
field works end-to-end.

Fixes #1231

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR does an excellent job maintaining feature parity across all five SDK implementations. Here's a summary of the consistency analysis:

Changes Reviewed

SDK Change Serialization behavior
Node.js args: string[]args?: string[] Field absent when not provided
Go json:"args"json:"args,omitempty" Field omitted when nil/empty
Python args: list[str]args: NotRequired[list[str]] Field absent when not provided
.NET IList<string> Args { get => field ??= []; set; }IList<string>? Args { get; set; } Field omitted when null (via WhenWritingNull in TypesJsonContext and SerializerOptionsForMessageFormatter)
Rust #[serde(default)]#[serde(default, skip_serializing_if = "Vec::is_empty")] Field omitted when empty

All five implementations now correctly omit args from the wire format when not supplied, aligning with the updated runtime schema.

E2E Coverage

E2E tests were added for all five SDKs, and the two snapshot YAML files correctly cover all test naming patterns:

  • accept_mcp_server_config_without_args.yaml → Go and Rust tests
  • should_accept_mcp_server_configuration_without_args.yaml → Node.js, Python, and .NET tests

Notes

  • The .NET Args nullability change is safe because the SDK's JsonSerializerOptions configures DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull globally, ensuring null Args is omitted rather than serialized as "args": null.
  • The Rust approach (Vec<String> with skip_serializing_if) is idiomatic — empty args and absent args are treated equivalently on the wire, which is the correct behavior here.

No cross-SDK inconsistencies found. 🎉

Generated by SDK Consistency Review Agent for issue #1347 · ● 549.2K ·

@stephentoub stephentoub merged commit 38ca096 into main May 20, 2026
45 of 46 checks passed
@stephentoub stephentoub deleted the optionalargs branch May 20, 2026 19:17
SteveSandersonMS added a commit that referenced this pull request May 21, 2026
Picks up @github/copilot 1.0.51 schema changes (#1351, #1353) and
MCPStdioServerConfig.args optional (#1347).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

MCPStdioServerConfig.args should be optional

3 participants