Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/development/upgrade-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ This guide provides migration instructions for breaking changes and major update

## v3.0.0

### WSTransport Removed

The deprecated `WSTransport` client transport has been removed. Use `StreamableHttpTransport` instead.

### Provider Architecture

FastMCP v3 introduces a unified provider architecture for sourcing components. All tools, resources, and prompts now flow through providers:
Expand Down
4 changes: 4 additions & 0 deletions docs/development/v3-notes/v3-features.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ The `tool_serializer` parameter on `FastMCP` is deprecated. Return `ToolResult`

## Breaking Changes

### WSTransport Removed

The deprecated `WSTransport` client transport has been removed. Use `StreamableHttpTransport` instead.

### Component Enable/Disable Moved to Server/Provider

The `enabled` field and `enable()`/`disable()` methods removed from component objects:
Expand Down
16 changes: 7 additions & 9 deletions src/fastmcp/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
from .auth import OAuth, BearerAuth
from .client import Client
from .transports import (
ClientTransport,
WSTransport,
SSETransport,
StdioTransport,
PythonStdioTransport,
FastMCPTransport,
NodeStdioTransport,
UvxStdioTransport,
UvStdioTransport,
NpxStdioTransport,
FastMCPTransport,
PythonStdioTransport,
SSETransport,
StdioTransport,
StreamableHttpTransport,
UvStdioTransport,
UvxStdioTransport,
)
from .auth import OAuth, BearerAuth

__all__ = [
"BearerAuth",
Expand All @@ -28,5 +27,4 @@
"StreamableHttpTransport",
"UvStdioTransport",
"UvxStdioTransport",
"WSTransport",
]
39 changes: 0 additions & 39 deletions src/fastmcp/client/transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,45 +119,6 @@ def _set_auth(self, auth: httpx.Auth | Literal["oauth"] | str | None):
raise ValueError("This transport does not support auth")


class WSTransport(ClientTransport):
"""Transport implementation that connects to an MCP server via WebSockets."""

def __init__(self, url: str | AnyUrl):
# we never really used this transport, so it can be removed at any time
if fastmcp.settings.deprecation_warnings:
warnings.warn(
"WSTransport is a deprecated MCP transport and will be removed in a future version. Use StreamableHttpTransport instead.",
DeprecationWarning,
stacklevel=2,
)
if isinstance(url, AnyUrl):
url = str(url)
if not isinstance(url, str) or not url.startswith("ws"):
raise ValueError("Invalid WebSocket URL provided.")
self.url = url

@contextlib.asynccontextmanager
async def connect_session(
self, **session_kwargs: Unpack[SessionKwargs]
) -> AsyncIterator[ClientSession]:
try:
from mcp.client.websocket import websocket_client
except ImportError as e:
raise ImportError(
"The websocket transport is not available. Please install fastmcp[websockets] or install the websockets package manually."
) from e

async with websocket_client(self.url) as transport:
read_stream, write_stream = transport
async with ClientSession(
read_stream, write_stream, **session_kwargs
) as session:
yield session

def __repr__(self) -> str:
return f"<WebSocketTransport(url='{self.url}')>"


class SSETransport(ClientTransport):
"""Transport implementation that connects to an MCP server via Server-Sent Events."""

Expand Down
Loading