Skip to content

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

Remove automatic trailing slash modification from server paths

Jeremiah Lowine17397af914d
diff --git a/src/fastmcp/server/http.py b/src/fastmcp/server/http.py
index 8a85edfca..1b97702c4 100644
--- a/src/fastmcp/server/http.py
+++ b/src/fastmcp/server/http.py
@@ -158,10 +158,6 @@ def create_sse_app(
A Starlette application with RequestContextMiddleware
"""
- # Ensure the message_path ends with a trailing slash to avoid automatic redirects
- if not message_path.endswith("/"):
- message_path = message_path + "/"
-
server_routes: list[BaseRoute] = []
server_middleware: list[Middleware] = []
@@ -309,10 +305,6 @@ def create_streamable_http_app(
# Re-raise other RuntimeErrors if they don't match the specific message
raise
- # Ensure the streamable_http_path ends with a trailing slash to avoid automatic redirects
- if not streamable_http_path.endswith("/"):
- streamable_http_path = streamable_http_path + "/"
-
# Add StreamableHTTP routes with or without auth
if auth:
auth_middleware, auth_routes, required_scopes = (