mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-24 06:24:18 +02:00
Remove deprecated sse_app method (#2337)
This commit is contained in:
parent
85ceda1d89
commit
6ea606a98d
3 changed files with 1 additions and 41 deletions
|
|
@ -2081,37 +2081,6 @@ class FastMCP(Generic[LifespanResultT]):
|
|||
uvicorn_config=uvicorn_config,
|
||||
)
|
||||
|
||||
def sse_app(
|
||||
self,
|
||||
path: str | None = None,
|
||||
message_path: str | None = None,
|
||||
middleware: list[ASGIMiddleware] | None = None,
|
||||
) -> StarletteWithLifespan:
|
||||
"""
|
||||
Create a Starlette app for the SSE server.
|
||||
|
||||
Args:
|
||||
path: The path to the SSE endpoint
|
||||
message_path: The path to the message endpoint
|
||||
middleware: A list of middleware to apply to the app
|
||||
"""
|
||||
# Deprecated since 2.3.2
|
||||
if fastmcp.settings.deprecation_warnings:
|
||||
warnings.warn(
|
||||
"The sse_app method is deprecated (as of 2.3.2). Use http_app as a modern (non-SSE) "
|
||||
"alternative, or call `fastmcp.server.http.create_sse_app` directly.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return create_sse_app(
|
||||
server=self,
|
||||
message_path=message_path or self._deprecated_settings.message_path,
|
||||
sse_path=path or self._deprecated_settings.sse_path,
|
||||
auth=self.auth,
|
||||
debug=self._deprecated_settings.debug,
|
||||
middleware=middleware,
|
||||
)
|
||||
|
||||
def streamable_http_app(
|
||||
self,
|
||||
path: str | None = None,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from mcp import McpError
|
|||
from fastmcp.client import Client
|
||||
from fastmcp.client.transports import SSETransport
|
||||
from fastmcp.server.dependencies import get_http_request
|
||||
from fastmcp.server.http import create_sse_app
|
||||
from fastmcp.server.server import FastMCP
|
||||
from fastmcp.utilities.tests import run_server_async
|
||||
|
||||
|
|
@ -94,7 +95,6 @@ async def nested_sse_server():
|
|||
from starlette.applications import Starlette
|
||||
from starlette.routing import Mount
|
||||
|
||||
from fastmcp.server.http import create_sse_app
|
||||
from fastmcp.utilities.http import find_available_port
|
||||
|
||||
server = create_test_server()
|
||||
|
|
|
|||
|
|
@ -33,15 +33,6 @@ class TestDeprecationWarningsSetting:
|
|||
mcp.settings
|
||||
|
||||
|
||||
def test_sse_app_deprecation_warning():
|
||||
"""Test that sse_app raises a deprecation warning."""
|
||||
server = FastMCP("TestServer")
|
||||
|
||||
with pytest.warns(DeprecationWarning, match="The sse_app method is deprecated"):
|
||||
app = server.sse_app()
|
||||
assert isinstance(app, Starlette)
|
||||
|
||||
|
||||
def test_streamable_http_app_deprecation_warning():
|
||||
"""Test that streamable_http_app raises a deprecation warning."""
|
||||
server = FastMCP("TestServer")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue