Skip to content

MCPStdioServerConfig.args should be optional #1231

Closed

Description

@ricksmit3000

The args field on MCPStdioServerConfig in [nodejs/src/types.ts](https://github.com/github/copilot-sdk/blob/main/nodejs/src/types.ts) is currently required:

export interface MCPStdioServerConfig extends MCPServerConfigBase {
  command: string;
  args: string[];   // required
  env?: Record<string, string>;
  cwd?: string;
}

This is inconsistent with the MCP TypeScript SDK's own StdioServerParameters, which defines args as optional:

modelcontextprotocol/typescript-sdk — src/client/stdio.ts:

export type StdioServerParameters = {
  command: string;
  args?: string[];  // optional
  // ...
};

A stdio MCP server invoked with no arguments is a valid configuration per the spec, and omitting args is explicitly supported by the reference implementation.

Observed behaviour: Omitting args from a stdio server config causes the SDK's schema validation to reject the entire config with an invalid_union error (Invalid MCP config … args: Required).

Expected behaviour: args defaults to [] when omitted, consistent with StdioServerParameters.

Suggested fix: Change args: string[] to args?: string[] in MCPStdioServerConfig, treating a missing value as [] at the spawn call site.

Activity

  1. github-actions commented on May 8, 2026

    @github-actions
    Contributor

    Investigation findings: confirmed bug ✅

    I investigated the relevant code paths across all SDK implementations.

    What I looked at

    • nodejs/src/types.ts:1133–1142 — user-facing MCPStdioServerConfig interface
    • nodejs/src/generated/rpc.ts:869–887 — generated McpServerConfigLocal (the wire type sent to the CLI)
    • go/types.go:471–493 — Go MCPStdioServerConfig struct
    • python/copilot/session.py:778–787 — Python MCPStdioServerConfig TypedDict
    • dotnet/src/Types.cs:1794–1823 — .NET McpStdioServerConfig class

    What I found

    The args field is marked required in the Node.js user-facing type (args: string[]) and in the generated wire type (McpServerConfigLocal). When a user omits args, the SDK passes the config to the CLI without the field, and the CLI's schema validation rejects it with the invalid_union / args: Required error described in the issue.

    This is inconsistent across SDKs and inconsistent with the MCP spec:

    SDK Behaviour
    Node.js args: string[] — required; omitting causes CLI rejection
    Go Args []string with no omitempty — nil serialises as JSON null, which also fails CLI validation
    Python args: list[str] in a total=False TypedDict — technically optional at runtime but no NotRequired annotation
    .NET Args { get => field ??= []; set; } — always defaults to []; already correct

    The .NET SDK already handles this correctly by defaulting Args to an empty list. The other SDKs do not.

    The MCP spec and the reference TypeScript SDK (StdioServerParameters) treat args as optional, since invoking a binary with no arguments is a completely valid configuration. The current Node.js and Go behaviour is therefore a bug: it rejects valid configurations that the spec explicitly supports.

    Root cause

    The user-facing types and the SDK serialisation layer do not normalise a missing/nil args to [] before sending the payload to the CLI. The fix is to make args optional in the user-facing type (args?: string[]) and default it to [] at the call site where the session-create/resume payload is assembled — mirroring what the .NET SDK already does automatically.

    Labelled as bug.

    Generated by Bug Handler for issue #1231 · ● 1.4M · ◷

  2. added 3 commits that reference this issue on May 20, 2026
    08deeff
    f8795d9
    260839f
  3. added a commit that references this issue on May 20, 2026
    38ca096
  4. added 2 commits that reference this issue on Aug 4, 2026
    2a7834a
    d832161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions