From e17397af914d9528ac84eaae926fe9a482652470 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Mon, 30 Jun 2025 18:32:53 -0400 Subject: [PATCH] Remove automatic trailing slash modification from server paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #991 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/fastmcp/server/http.py | 8 -------- 1 file changed, 8 deletions(-) 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 = (