{"record":{"id":"6ee9a487da566792","repo":"HKUDS/Vibe-Trading","slug":"http-mcp-servers-require-an-explicit-type-of-sse","errorCode":null,"errorMessage":"HTTP MCP servers require an explicit type of 'sse' or 'streamableHttp'","messagePattern":"HTTP MCP servers require an explicit type of 'sse' or 'streamableHttp'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/config/schema.py","lineNumber":370,"sourceCode":"    type: Literal[\"stdio\", \"sse\", \"streamableHttp\"] | None = None\n    command: str = \"\"\n    args: list[str] = Field(default_factory=list)\n    env: dict[str, str] = Field(default_factory=dict)\n    url: str = \"\"\n    headers: dict[str, str] = Field(default_factory=dict)\n    auth: MCPOAuthConfig | None = None\n    tool_timeout: float = Field(default=30.0, ge=0.1)\n    init_timeout: float | None = Field(default=None, ge=0.1)\n    enabled_tools: list[str] = Field(default_factory=lambda: [\"*\"])\n\n    def resolved_transport(self) -> Literal[\"stdio\", \"sse\", \"streamableHttp\"]:\n        \"\"\"Resolve the effective transport from explicit type or implied fields.\"\"\"\n        if self.type is not None:\n            return self.type\n        if self.command.strip() or self.args or self.env:\n            return \"stdio\"\n        if self.url.strip():\n            raise ValueError(\"HTTP MCP servers require an explicit type of 'sse' or 'streamableHttp'\")\n        return \"stdio\"\n\n    @model_validator(mode=\"after\")\n    def validate_transport_config(self) -> \"MCPServerConfig\":\n        \"\"\"Validate transport-specific MCP server configuration.\n\n        Returns:\n            The validated MCP server config instance.\n\n        Raises:\n            ValueError: If required fields are missing for the resolved\n                transport or conflicting fields are provided.\n        \"\"\"\n        transport = self.resolved_transport()\n\n        if transport == \"stdio\":\n            if not self.command.strip():\n                raise ValueError(\"stdio MCP servers require a command\")","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/config/schema.py#L352-L388","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add type: sse or type: streamableHttp to the server entry (streamableHttp is the modern default for HTTP MCP servers).","If the server is actually a local process, replace url with command (and args/env)."],"exampleFix":"# before\nmcp_servers:\n  my-http:\n    url: https://mcp.example.com/sse\n\n# after\nmcp_servers:\n  my-http:\n    type: sse\n    url: https://mcp.example.com/sse","handlingStrategy":"validation","validationCode":"def http_mcp_entry_valid(entry: dict) -> bool:\n    if entry.get('url') and not (entry.get('command') or entry.get('args') or entry.get('env')):\n        return entry.get('type') in ('sse', 'streamableHttp')\n    return True","typeGuard":"def has_explicit_http_type(entry: dict) -> bool:\n    return entry.get('type') in ('sse', 'streamableHttp')","tryCatchPattern":null,"preventionTips":["Always set type explicitly on every mcp_servers entry","Validate config with the schema (construct AgentConfig/MCPServerConfig) before deploying"],"tags":["mcp","config","transport","validation"],"backgroundTag":"config-validation-failed","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}