anthropics/skills · error · ValueError

Command is required for stdio transport

Error message

Command is required for stdio transport

What it means

create_connection() in mcp-builder's connections.py validates transport parameters: for transport='stdio' the command (the executable to launch) is mandatory, since an MCP stdio client must spawn a server process. Empty/None command means the caller cannot possibly form a valid MCPConnectionStdio, so it fails fast rather than constructing a broken connection.

Source

Thrown at skills/mcp-builder/scripts/connections.py:137

) -> MCPConnection:
    """Factory function to create the appropriate MCP connection.

    Args:
        transport: Connection type ("stdio", "sse", or "http")
        command: Command to run (stdio only)
        args: Command arguments (stdio only)
        env: Environment variables (stdio only)
        url: Server URL (sse and http only)
        headers: HTTP headers (sse and http only)

    Returns:
        MCPConnection instance
    """
    transport = transport.lower()

    if transport == "stdio":
        if not command:
            raise ValueError("Command is required for stdio transport")
        return MCPConnectionStdio(command=command, args=args, env=env)

    elif transport == "sse":
        if not url:
            raise ValueError("URL is required for sse transport")
        return MCPConnectionSSE(url=url, headers=headers)

    elif transport in ["http", "streamable_http", "streamable-http"]:
        if not url:
            raise ValueError("URL is required for http transport")
        return MCPConnectionHTTP(url=url, headers=headers)

    else:
        raise ValueError(f"Unsupported transport type: {transport}. Use 'stdio', 'sse', or 'http'")

View on GitHub (pinned to f6656c1256)

Solutions

  1. Supply the server command: create_connection(name='x', transport='stdio', command='npx', args=['-y', 'server-puppeteer']).
  2. Check the config source for typos — the key must be exactly 'command' (not 'cmd', 'exec', 'path').
  3. If the server is remote, switch transport to 'sse' or 'http' with a url instead.
  4. Validate config entries before passing them: assert entry.get('command') for stdio entries.

Example fix

# before
create_connection(name="fs", transport="stdio", command="", args=["--root", "/tmp"])

# after
create_connection(name="fs", transport="stdio", command="npx", args=["-y", "@modelcontextprotocol/server-filesystem", "/tmp"])
Defensive patterns

Strategy: validation

Validate before calling

def valid_stdio_entry(entry: dict) -> bool:
    return bool(entry.get("transport", "stdio").lower() == "stdio" and (entry.get("command") or "").strip())

Try / catch

try:
    conn = create_connection(name=n, transport="stdio", command=cmd, args=a)
except ValueError as e:
    if "Command is required" in str(e):
        raise ConfigError(f"server {n!r}: stdio entry missing 'command'") from e
    raise

Prevention

When it happens

Trigger: Calling create_connection(name=..., transport='stdio', command=None or '') — e.g. reading config where the 'command' key was misspelled or omitted, or wiring a URL-based server config to stdio transport.

Common situations: Misconfigured JSON/YAML MCP server entries (command field missing); mixing up transports (an sse/http server entry passed with transport='stdio'); empty-string command from templating bugs in generated config files.

Related errors


AI-assisted analysis of anthropics/skills@f6656c1256 (2026-08-14). Data as JSON: /api/errors/68cb1e991aa3d450. Report an issue: GitHub.