HKUDS/Vibe-Trading · error · ValueError

HTTP MCP servers require an explicit type of 'sse' or 'strea

Error message

HTTP MCP servers require an explicit type of 'sse' or 'streamableHttp'

What it means

Raised by MCPServerConfig.resolved_transport when a server definition has a url but no explicit type and no command/args/env. Because a url-based server could be either sse or streamableHttp, the schema refuses to guess and requires an explicit type field.

Source

Thrown at agent/src/config/schema.py:370

    type: Literal["stdio", "sse", "streamableHttp"] | None = None
    command: str = ""
    args: list[str] = Field(default_factory=list)
    env: dict[str, str] = Field(default_factory=dict)
    url: str = ""
    headers: dict[str, str] = Field(default_factory=dict)
    auth: MCPOAuthConfig | None = None
    tool_timeout: float = Field(default=30.0, ge=0.1)
    init_timeout: float | None = Field(default=None, ge=0.1)
    enabled_tools: list[str] = Field(default_factory=lambda: ["*"])

    def resolved_transport(self) -> Literal["stdio", "sse", "streamableHttp"]:
        """Resolve the effective transport from explicit type or implied fields."""
        if self.type is not None:
            return self.type
        if self.command.strip() or self.args or self.env:
            return "stdio"
        if self.url.strip():
            raise ValueError("HTTP MCP servers require an explicit type of 'sse' or 'streamableHttp'")
        return "stdio"

    @model_validator(mode="after")
    def validate_transport_config(self) -> "MCPServerConfig":
        """Validate transport-specific MCP server configuration.

        Returns:
            The validated MCP server config instance.

        Raises:
            ValueError: If required fields are missing for the resolved
                transport or conflicting fields are provided.
        """
        transport = self.resolved_transport()

        if transport == "stdio":
            if not self.command.strip():
                raise ValueError("stdio MCP servers require a command")

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Add type: sse or type: streamableHttp to the server entry (streamableHttp is the modern default for HTTP MCP servers).
  2. If the server is actually a local process, replace url with command (and args/env).

Example fix

# before
mcp_servers:
  my-http:
    url: https://mcp.example.com/sse

# after
mcp_servers:
  my-http:
    type: sse
    url: https://mcp.example.com/sse
Defensive patterns

Strategy: validation

Validate before calling

def http_mcp_entry_valid(entry: dict) -> bool:
    if entry.get('url') and not (entry.get('command') or entry.get('args') or entry.get('env')):
        return entry.get('type') in ('sse', 'streamableHttp')
    return True

Type guard

def has_explicit_http_type(entry: dict) -> bool:
    return entry.get('type') in ('sse', 'streamableHttp')

Prevention

When it happens

Trigger: Configuring an MCP server entry with url set, type omitted, and no stdio fields; runtime config layering that strips the type while keeping the url.

Common situations: Migrating configs from older versions where url implied a transport; hand-written YAML entries copied from HTTP examples without the type key; overrides that accidentally clear type.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/6ee9a487da566792. Report an issue: GitHub.