BerriAI/litellm · error · ImportError

streamable_http_client is not available. Please install mcp…

Error message

streamable_http_client is not available. Please install mcp with HTTP support.

What it means

The MCP client selected the streamable-HTTP transport but the installed `mcp` package does not expose streamable_http_client, i.e. it lacks HTTP support and must be reinstalled with the appropriate extra.

Solutions

  1. Install the mcp package with HTTP support so streamable_http_client is available.
  2. Update the mcp package to a version that includes the streamable HTTP client.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/experimental_mcp_client/client.py:290 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/2af17933cadbdc72. Report an issue: GitHub.

Appendix: source

Thrown at litellm/experimental_mcp_client/client.py:290

                args=self.stdio_config.get("args", []),
                env=self._get_safe_stdio_env(self.stdio_config.get("env")),
            )
            return stdio_client(server_params), None
        if self.transport_type == MCPTransport.sse:
            headers = self._get_auth_headers()
            httpx_client_factory = self._create_httpx_client_factory()
            return (
                sse_client(
                    url=self.server_url,
                    timeout=self.timeout,
                    headers=headers,
                    httpx_client_factory=httpx_client_factory,
                ),
                None,
            )
        # HTTP transport (default)
        if streamable_http_client is None:
            raise ImportError("streamable_http_client is not available. Please install mcp with HTTP support.")
        headers = self._get_auth_headers()
        httpx_client_factory = self._create_httpx_client_factory()
        verbose_logger.debug("litellm headers for streamable_http_client: %s", headers)
        http_client = httpx_client_factory(
            headers=headers,
            timeout=httpx.Timeout(self.timeout),
        )
        transport_ctx: Final = streamable_http_client(
            url=self.server_url,
            http_client=http_client,
        )
        return transport_ctx, http_client

    def _get_safe_stdio_env(self, provided_env: dict[str, str] | None) -> dict[str, str] | None:
        """
        Return a safe environment for the stdio subprocess.

        If provided_env is set, we use it as-is.

View on GitHub (pinned to 77b7c6c40c)