{"record":{"id":"8b2ed37ed07b7d99","repo":"PrefectHQ/fastmcp","slug":"the-verify-parameter-is-only-supported-for-http","errorCode":null,"errorMessage":"The 'verify' parameter is only supported for HTTP transports.","messagePattern":"The 'verify' parameter is only supported for HTTP transports\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"fastmcp_slim/fastmcp/client/client.py","lineNumber":483,"sourceCode":"        if verify is not None:\n            from fastmcp.client.transports.http import StreamableHttpTransport\n            from fastmcp.client.transports.sse import SSETransport\n\n            if isinstance(self.transport, StreamableHttpTransport | SSETransport):\n                self.transport.verify = verify\n                # Re-sync existing OAuth auth with the new verify setting,\n                # but only if the transport doesn't have a custom factory\n                # (which takes precedence and was already applied to OAuth).\n                if (\n                    isinstance(self.transport.auth, OAuth)\n                    and auth is None\n                    and self.transport.httpx_client_factory is None\n                ):\n                    verify_factory = self.transport._make_verify_factory()\n                    if verify_factory is not None:\n                        self.transport.auth.httpx_client_factory = verify_factory\n            else:\n                raise ValueError(\n                    \"The 'verify' parameter is only supported for HTTP transports.\"\n                )\n\n        if auth is not None:\n            self.transport._set_auth(auth)\n\n        if log_handler is None:\n            log_handler = default_log_handler\n\n        if progress_handler is None:\n            progress_handler = default_progress_handler\n\n        self._progress_handler = progress_handler\n\n        # Convert request timeout to float seconds (0 means disabled -> None)\n        read_timeout_seconds = normalize_timeout_to_seconds(timeout)\n\n        # handle init handshake timeout (0 means disabled)","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/PrefectHQ/fastmcp/blob/1f021142978e0861cd910c8df4e8074bc7cf3978/fastmcp_slim/fastmcp/client/client.py#L465-L501","documentation":"The verify parameter (TLS verification: bool, ssl.SSLContext, or CA bundle path) is applied by mutating the transport's TLS settings, which only StreamableHttpTransport and SSETransport support. Passing verify with any other transport (STDIO, in-memory, etc.) raises this ValueError in Client.__init__.","triggerScenarios":"Client(StdioTransport(...), verify='/path/to/ca.pem') or any Client construction where the inferred transport is not an HTTP/SSE transport and verify is not None.","commonSituations":"Reusing a shared Client-construction helper across local (stdio) and remote (HTTP) servers; forgetting that verify only makes sense for network transports; config-driven clients that always pass verify.","solutions":["Only pass verify when the transport is HTTP-based (streamable HTTP or SSE).","Make verify conditional: pass verify=None (omit it) for stdio/in-memory transports.","If TLS customization is needed for a non-HTTP transport, it does not apply — remove the parameter.","For config files, gate the verify key on the transport type."],"exampleFix":"// before: verify passed for a stdio server\nclient = Client('python', args=['server.py'], verify='/etc/ssl/ca.pem')\n// after: verify only for HTTP transports\nkwargs = {'verify': '/etc/ssl/ca.pem'} if url.startswith('http') else {}\nclient = Client(url, **kwargs)","handlingStrategy":"validation","validationCode":"def uses_http_transport(transport_or_url) -> bool:\n    s = str(transport_or_url)\n    return s.startswith(('http://', 'https://'))\nverify_arg = ca_bundle if uses_http_transport(target) else None\nclient = Client(target, verify=verify_arg)","typeGuard":"from fastmcp.client.transports.http import StreamableHttpTransport\nfrom fastmcp.client.transports.sse import SSETransport\n\ndef supports_verify(transport) -> bool:\n    return isinstance(transport, StreamableHttpTransport | SSETransport)","tryCatchPattern":"try:\n    client = Client(transport, verify=ca_bundle)\nexcept ValueError as e:\n    if 'only supported for HTTP transports' in str(e):\n        client = Client(transport)  # drop verify for non-HTTP transports\n    else:\n        raise","preventionTips":["Only pass verify for http(s) URLs or explicit HTTP/SSE transports.","Conditionally build Client kwargs based on transport type in shared helpers.","Remember stdio and in-memory transports have no TLS surface.","Add a unit test asserting Client construction per transport type in your config loader."],"tags":["tls","ssl","validation","transport","arguments"],"backgroundTag":"unsupported-parameter","analyzedSha":"1f021142978e0861cd910c8df4e8074bc7cf3978","analyzedAt":"2026-08-29T14:31:16.082Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}