{"record":{"id":"9ce7a574dc718cd3","repo":"huggingface/smolagents","slug":"unsupported-transport-transport-supported-tran","errorCode":null,"errorMessage":"Unsupported transport: {transport}. Supported transports are 'streamable-http' and 'sse'.","messagePattern":"Unsupported transport: (.+?)\\. Supported transports are 'streamable-http' and 'sse'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/smolagents/mcp_client.py","lineNumber":114,"sourceCode":"                \"To suppress this warning, explicitly set structured_output=True (new behavior) or structured_output=False (legacy behavior). \"\n                \"See documentation at https://huggingface.co/docs/smolagents/tutorials/tools#structured-output-and-output-schema-support for more details.\",\n                FutureWarning,\n                stacklevel=2,\n            )\n            structured_output = False\n\n        try:\n            from mcpadapt.core import MCPAdapt\n            from mcpadapt.smolagents_adapter import SmolAgentsAdapter\n        except ModuleNotFoundError:\n            raise ModuleNotFoundError(\"Please install 'mcp' extra to use MCPClient: `pip install 'smolagents[mcp]'`\")\n        if isinstance(server_parameters, dict):\n            transport = server_parameters.get(\"transport\")\n            if transport is None:\n                transport = \"streamable-http\"\n                server_parameters[\"transport\"] = transport\n            if transport not in {\"sse\", \"streamable-http\"}:\n                raise ValueError(\n                    f\"Unsupported transport: {transport}. Supported transports are 'streamable-http' and 'sse'.\"\n                )\n        adapter_kwargs = adapter_kwargs or {}\n        self._adapter = MCPAdapt(\n            server_parameters, SmolAgentsAdapter(structured_output=structured_output), **adapter_kwargs\n        )\n        self._tools: list[Tool] | None = None\n        self.connect()\n\n    def connect(self):\n        \"\"\"Connect to the MCP server and initialize the tools.\"\"\"\n        self._tools: list[Tool] = self._adapter.__enter__()\n\n    def disconnect(\n        self,\n        exc_type: type[BaseException] | None = None,\n        exc_value: BaseException | None = None,\n        exc_traceback: TracebackType | None = None,","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/huggingface/smolagents/blob/30bb1161095dbae2271e6bc3cc4c219cc3897a57/src/smolagents/mcp_client.py#L96-L132","documentation":"When MCPClient is constructed with a dict of server_parameters, it reads the 'transport' key (defaulting to 'streamable-http') and only accepts 'streamable-http' or 'sse'. Any other value raises ValueError immediately, before any connection is attempted. This mirrors the transports supported by the underlying MCPAdapt library.","triggerScenarios":"Passing server_parameters={'url': ..., 'transport': 'stdio'} or 'websocket', 'http', or a typo like 'sse ' to MCPClient.__init__.","commonSituations":"Copy-pasting stdio-based MCP server config (command/args style) into the dict form; protocol rename confusion (older MCP examples used 'http'); misspelled transport strings.","solutions":["Set transport to 'streamable-http' or 'sse', or omit it to get the 'streamable-http' default","For stdio servers (command/args config), use the MCPAdapt stdio parameters form rather than a dict with 'transport'","Double-check for typos and trailing whitespace in the transport value"],"exampleFix":"# before\nclient = MCPClient({\"url\": \"http://localhost:8000/mcp\", \"transport\": \"http\"})\n\n# after\nclient = MCPClient({\"url\": \"http://localhost:8000/mcp\", \"transport\": \"streamable-http\"})","handlingStrategy":"validation","validationCode":"SUPPORTED_TRANSPORTS = {\"streamable-http\", \"sse\"}\ntransport = server_parameters.get(\"transport\", \"streamable-http\")\nif transport not in SUPPORTED_TRANSPORTS:\n    raise ValueError(f\"Pick one of {SUPPORTED_TRANSPORTS}\")\nclient = MCPClient(server_parameters)","typeGuard":"def is_valid_mcp_transport(params: dict) -> bool:\n    t = params.get(\"transport\", \"streamable-http\")\n    return t in {\"streamable-http\", \"sse\"}","tryCatchPattern":"try:\n    client = MCPClient(server_parameters)\nexcept ValueError as e:\n    if 'Unsupported transport' in str(e):\n        server_parameters['transport'] = 'streamable-http'\n        client = MCPClient(server_parameters)","preventionTips":["Omit 'transport' to use the streamable-http default","Validate config dicts against the supported set before constructing MCPClient","Don't reuse stdio-style MCP configs with the dict transport form"],"tags":["smolagents","mcp","transport","config-validation"],"backgroundTag":"invalid-transport-protocol","analyzedSha":"30bb1161095dbae2271e6bc3cc4c219cc3897a57","analyzedAt":"2026-08-28T18:52:54.169Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}