From 24179cde2f9e004ab5db38a323998ad6fb992ad4 Mon Sep 17 00:00:00 2001 From: Varun Chawla <34209028+veeceey@users.noreply.github.com> Date: Sun, 15 Feb 2026 17:09:41 -0800 Subject: [PATCH] fix: preserve trailing slash in MCP server URLs (#21212) Stop trimming trailing slashes from MCP server URLs on save. Some MCP servers (e.g. Bitrix24) require a trailing slash; removing it triggers a 301 redirect that drops Authorization headers, resulting in 400 errors. The trailing-slash trim is now skipped when the connection type is 'mcp', while OpenAPI connections continue to have it stripped as before. Fixes open-webui#21179 --- src/lib/components/AddToolServerModal.svelte | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/components/AddToolServerModal.svelte b/src/lib/components/AddToolServerModal.svelte index 5b64b692a..555d8ff8e 100644 --- a/src/lib/components/AddToolServerModal.svelte +++ b/src/lib/components/AddToolServerModal.svelte @@ -250,8 +250,12 @@ const submitHandler = async () => { loading = true; - // remove trailing slash from url - url = url.replace(/\/$/, ''); + // remove trailing slash from url for non-MCP connections + // MCP servers may require a trailing slash; stripping it can cause + // 301 redirects that lose auth headers (see #21179) + if (type !== 'mcp') { + url = url.replace(/\/$/, ''); + } if (id.includes(':') || id.includes('|')) { toast.error($i18n.t('ID cannot contain ":" or "|" characters')); loading = false;