BerriAI/litellm · error · ValueError

command is required for stdio transport

Error message

command is required for stdio transport

What it means

Pydantic model_validator (validate_transport_fields) on the MCP server registration type rejecting a stdio-transport server whose config has no 'command'. A stdio MCP server is launched by executing a local binary, so the command to run is mandatory; without it the proxy would have nothing to spawn. Sister guards in the same validator enforce args and the command allowlist.

Solutions

  1. Provide the 'command' field for stdio transport.

Example fix

command='npx', args=[...]
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/_types.py:1380 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/51375acb9e4ae1a2. Report an issue: GitHub.

Appendix: source

Thrown at litellm/proxy/_types.py:1380

        description="Server-managed: set by the endpoint; caller values are overridden.",
    )
    submitted_by: str | None = Field(
        None,
        description="Server-managed: set by the endpoint; caller values are overridden.",
    )
    submitted_at: datetime | None = Field(
        None,
        description="Server-managed: set by the endpoint; caller values are overridden.",
    )

    @model_validator(mode="before")
    @classmethod
    def validate_transport_fields(cls, values):
        if isinstance(values, dict):
            transport: Final = values.get("transport")
            if transport == MCPTransport.stdio:
                if not values.get("command"):
                    raise ValueError("command is required for stdio transport")
                if not values.get("args"):
                    raise ValueError("args is required for stdio transport")
                # Validate command against allowlist to prevent arbitrary execution
                base_command: Final = os.path.basename(values["command"])
                if base_command not in MCP_STDIO_ALLOWED_COMMANDS:
                    raise ValueError(
                        f"Command '{values['command']}' is not in the allowed commands list "
                        f"for stdio transport. Allowed commands: {sorted(MCP_STDIO_ALLOWED_COMMANDS)}"
                    )
            elif transport in [MCPTransport.http, MCPTransport.sse]:
                if not values.get("url") and not values.get("spec_path"):
                    raise ValueError("url or spec_path is required for HTTP/SSE transport")
        return values

    @model_validator(mode="before")
    @classmethod
    def validate_credentials_requirements(cls, values):
        """Validate credentials when provided.

View on GitHub (pinned to 77b7c6c40c)