BerriAI/litellm · error · ValueError

Command '{values['command']}' is not in the allowed commands

Error message

Command '{values['command']}' is not in the allowed commands list for stdio transport. Allowed commands: {sorted(MCP_STDIO_ALLOWED_COMMANDS)}

What it means

Pydantic model_validator on the MCP server registration type rejecting a stdio server whose base command (basename of the configured command, so wrapped paths like /bin/npx resolve to 'npx') is not in the MCP_STDIO_ALLOWED_COMMANDS allowlist. This is a security control against arbitrary command execution via the registration API; the message lists the sorted allowlist so the caller can pick a permitted launcher.

Source

Thrown at litellm/proxy/_types.py:1386

    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.

        auth_value is optional — users may configure it dynamically
        (e.g. via per-request headers or OAuth2 flows) instead of
        storing a static value at server creation time.
        """
        return values

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a command from the allowed list, or add it via LITELLM_MCP_STDIO_EXTRA_COMMANDS.

Example fix

export LITELLM_MCP_STDIO_EXTRA_COMMANDS='mycommand'
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/_types.py:1386 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/d0d38f95217533a9. Report an issue: GitHub.