Skip to main content
WebSocket connector for MCP implementations. This module provides a connector for communicating with MCP implementations through WebSocket connections.

WebSocketConnector

from mcp_use.connectors.websocket import WebSocketConnector

method init

Initialize a new WebSocket connector.Parameters
url
str
required
The WebSocket URL to connect to.
headers
dict[str, str] | None
default:"None"
Optional additional headers.
auth
str | dict[str, typing.Any] | httpx.Auth | None
default:"None"
Authentication method - can be:
Signature
def __init__(url: str, headers: dict[str, str] | None = None, auth: str | dict[str, typing.Any] | httpx.Auth | None = None):
I