mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #18588] [CLOSED] feat: set TOOL_SERVER_CONNECTIONS using a local file #11641
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/18588
Author: @jobunk
Created: 10/24/2025
Status: ❌ Closed
Base:
dev← Head:main📝 Commits (2)
14d7442first draft on TOOL_SERVER_CONNECTIONS_FILE67aa892added watcher for toll servers file📊 Changes
3 files changed (+111 additions, -2 deletions)
View changed files
📝
backend/open_webui/config.py(+18 -2)📝
backend/open_webui/main.py(+4 -0)➕
backend/open_webui/tool_servers/watcher.py(+89 -0)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch may lead to immediate closure of the PR.Changelog Entry
Description
In this PR I introduced a new env var TOOL_SERVER_CONNECTIONS_FILE. It let's you specify the path of a json file in the open-webui container that contains the starting configuration of available tool server. My testing example looked as follows:
[ { "url": "http://test.default.svc.cluster.local", "path": "openapi.json", "type": "openapi", "auth_type": "bearer", "key": "replaced", "config": { "enable": true, "access_control": null }, "spec_type": "url", "spec": "", "info": { "id": "test", "name": "test", "description": "test" } } ]The main difference towards the existing env var TOOL_SERVER_CONNECTIONS is that there is a watcher looking for changes to the json file (every 60 seconds). It uses the value of info.id to see if a tool listed in the json file needs to be added/updated in the PersistentConfig. Because it uses info.id to identify the tools that are relevant to the json file, it won't touch tools added using the UI (unless the user give it the exact same id as a tool from the json). It also won't delete any tools and will only start if the env var TOOL_SERVER_CONNECTIONS_FILE was set.
The goal was to be able to edit the json file inside the docker container through sidecar containers, which let's us add mcp servers on the fly using code. In my specific use case I have a service that discovers available mcp server in my kubernetes cluster. This service is inside a sidecar container and also has the json file specified in TOOL_SERVER_CONNECTIONS_FILE mounted. When it discovers a new mcp server, it can add it to the json and then the watcher in open-webui will pick up on the change and make it available to the user.
Added
Additional Information
I also opened a discussion here: https://github.com/open-webui/open-webui/discussions/18589
If this is as a general concept is wanted for this project I can of course add more type checks on the provided json, more error handling and also add the required documentation. Since I was not sure if this PR would go anywhere, I tried to keep the code small and just did some manual tests using a kubernetes pod with two containers for now.
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.