File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class Settings(BaseSettings, Generic[LifespanResultT]):
9292 mount_path : str = "/" # Mount path (e.g. "/github", defaults to root path)
9393 sse_path : str = "/sse"
9494 message_path : str = "/messages/"
95- streamable_http_path : str = "/mcp/ "
95+ streamable_http_path : str = "/mcp"
9696
9797 # StreamableHTTP settings
9898 json_response : bool = False
@@ -830,6 +830,18 @@ async def handle_streamable_http(
830830 )
831831 )
832832
833+ # Always mount both /mcp and /mcp/ for full compatibility, regardless of default
834+ _main_path = self .settings .streamable_http_path
835+ if _main_path .endswith ("/" ):
836+ _alt_path = _main_path .rstrip ("/" )
837+ else :
838+ _alt_path = _main_path + "/"
839+ if _alt_path != _main_path :
840+ if self ._auth_server_provider :
841+ routes .append (Mount (_alt_path , app = RequireAuthMiddleware (handle_streamable_http , required_scopes )))
842+ else :
843+ routes .append (Mount (_alt_path , app = handle_streamable_http ))
844+
833845 routes .extend (self ._custom_starlette_routes )
834846
835847 return Starlette (
You can’t perform that action at this time.
0 commit comments