mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #20742] [CLOSED] fix(startup): auto-initialize tool servers from TOOL_SERVER_CONNECTIONS env var #64611
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/20742
Author: @SpootyMcSpoot
Created: 1/17/2026
Status: ❌ Closed
Base:
main← Head:fix/tool-server-connections-auto-init📝 Commits (1)
cb02247fix(startup): auto-initialize tool servers from TOOL_SERVER_CONNECTIONS env var📊 Changes
1 file changed (+30 additions, -0 deletions)
View changed files
📝
backend/open_webui/main.py(+30 -0)📄 Description
Summary
This PR fixes the issue where
TOOL_SERVER_CONNECTIONSenvironment variable is set but tool servers are not actually initialized until the user manually visits the Admin Panel and clicks Save.Problem:
TOOL_SERVER_CONNECTIONSis aPersistentConfigthat only pre-populates the Admin Panel settings. The tools don't become available untilset_tool_servers()is called, which currently only happens when a user manually saves the config.Solution: Call
set_tool_servers()during application startup (in thelifespan()function) whenTOOL_SERVER_CONNECTIONShas entries. This makes tools available immediately without requiring manual intervention.Use Case
Users deploying Open-WebUI in Kubernetes/containerized environments want to pre-configure tool servers via environment variables for GitOps/IaC workflows. Currently this requires:
TOOL_SERVER_CONNECTIONSenv varWith this fix, step 3-6 are eliminated - tools work immediately on startup.
Changes
set_tool_serversfromopen_webui.utils.toolslifespan()function to callset_tool_servers()whenTOOL_SERVER_CONNECTIONSis configuredTesting
Tested with MCPO (MCP-to-OpenAPI proxy) tool servers configured via environment:
app.state.TOOL_SERVERSon startupFixes #18140
Contributor License Agreement
I have read and agree to the Open WebUI Contributor License Agreement.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.