Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Update http.py

Jeremiah Lowinac95a3aaafaf
diff --git a/src/fastmcp/server/http.py b/src/fastmcp/server/http.py
index a80b2235c..7041ba975 100644
--- a/src/fastmcp/server/http.py
+++ b/src/fastmcp/server/http.py
@@ -157,9 +157,8 @@ def create_sse_app(
Returns:
A Starlette application with RequestContextMiddleware
"""
-
+
# Ensure the message_path ends with a trailing slash to avoid automatic redirects
- # when mounting the application. sse_path uses Route instead of Mount so no fix needed.
if not message_path.endswith("/"):
message_path = message_path + "/"
@@ -311,11 +310,10 @@ def create_streamable_http_app(
raise
# Ensure the streamable_http_path ends with a trailing slash to avoid automatic redirects
- # when mounting the application
if not streamable_http_path.endswith("/"):
streamable_http_path = streamable_http_path + "/"
- # Add StreamableHTTP routes with or without auth
+ # Add StreamableHTTP routes with or without auth
if auth:
auth_middleware, auth_routes, required_scopes = (
setup_auth_middleware_and_routes(auth)