[PR #21338] [CLOSED] fix: preserve trailing slash in MCP server URLs #49083

Closed
opened 2026-04-30 01:24:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/21338
Author: @shtse8
Created: 2/12/2026
Status: Closed

Base: mainHead: fix/mcp-preserve-trailing-slash


📝 Commits (1)

  • 98b8290 fix: preserve trailing slash in MCP server URLs

📊 Changes

1 file changed (+4 additions, -2 deletions)

View changed files

📝 src/lib/components/AddToolServerModal.svelte (+4 -2)

📄 Description

Summary

When configuring tool servers via the web UI, trailing slashes are stripped from all URLs—including MCP servers. For MCP servers, the trailing slash can be significant: some servers (e.g., Bitrix24) require a specific path format, and removing the slash causes a 301 redirect that loses authentication headers, resulting in a 400 Bad Request error.

Changes

Only strip trailing slashes for openapi type tool servers (where path construction appends specific endpoints like /openapi.json). MCP server URLs are used as-is by the MCP client and should preserve the user's exact input.

Before

https://api.example.com/mcp/  →  https://api.example.com/mcp  (slash removed)
→ 301 Moved Permanently → loses auth headers → 400 Bad Request

After

https://api.example.com/mcp/  →  https://api.example.com/mcp/  (preserved)
→ 200 OK

Fixes #21179


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/21338 **Author:** [@shtse8](https://github.com/shtse8) **Created:** 2/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/mcp-preserve-trailing-slash` --- ### 📝 Commits (1) - [`98b8290`](https://github.com/open-webui/open-webui/commit/98b8290d5b6196d48414fefc03b4b5cc5baabaee) fix: preserve trailing slash in MCP server URLs ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/components/AddToolServerModal.svelte` (+4 -2) </details> ### 📄 Description ## Summary When configuring tool servers via the web UI, trailing slashes are stripped from all URLs—including MCP servers. For MCP servers, the trailing slash can be significant: some servers (e.g., Bitrix24) require a specific path format, and removing the slash causes a **301 redirect** that loses authentication headers, resulting in a **400 Bad Request** error. ## Changes Only strip trailing slashes for `openapi` type tool servers (where path construction appends specific endpoints like `/openapi.json`). MCP server URLs are used as-is by the MCP client and should preserve the user's exact input. ### Before ``` https://api.example.com/mcp/ → https://api.example.com/mcp (slash removed) → 301 Moved Permanently → loses auth headers → 400 Bad Request ``` ### After ``` https://api.example.com/mcp/ → https://api.example.com/mcp/ (preserved) → 200 OK ``` Fixes #21179 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-30 01:24:02 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#49083