[PR #18588] [CLOSED] feat: set TOOL_SERVER_CONNECTIONS using a local file #63699

Closed
opened 2026-05-06 08:39:02 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/18588
Author: @jobunk
Created: 10/24/2025
Status: Closed

Base: devHead: main


📝 Commits (2)

  • 14d7442 first draft on TOOL_SERVER_CONNECTIONS_FILE
  • 67aa892 added 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:

  • Target branch: Verify that the pull request targets the dev branch. Not targeting the dev branch may lead to immediate closure of the PR.
  • Description: Provide a concise description of the changes made in this pull request.
  • [c] Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • [c] Documentation: If necessary, update relevant documentation Open WebUI Docs like environment variables, the tutorials, or other documentation sources.
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Take this as an opportunity to make screenshots of the feature/fix and include it in the PR description.
  • Agentic AI Code:: Confirm this Pull Request is not written by any AI Agent or has at least gone through additional human review and manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR.
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Title Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

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

  • new env var TOOL_SERVER_CONNECTIONS_FILE and a new class ToolServerConnectionsFileWatcher

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.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/18588 **Author:** [@jobunk](https://github.com/jobunk) **Created:** 10/24/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `main` --- ### 📝 Commits (2) - [`14d7442`](https://github.com/open-webui/open-webui/commit/14d74422b642b5da32c08bbb9a3ce745fd6fc139) first draft on TOOL_SERVER_CONNECTIONS_FILE - [`67aa892`](https://github.com/open-webui/open-webui/commit/67aa892f8aafca8484be19d7c7aff130f157c348) added watcher for toll servers file ### 📊 Changes **3 files changed** (+111 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+18 -2) 📝 `backend/open_webui/main.py` (+4 -0) ➕ `backend/open_webui/tool_servers/watcher.py` (+89 -0) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Verify that the pull request targets the `dev` branch. Not targeting the `dev` branch may lead to immediate closure of the PR. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [c] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [c] **Documentation:** If necessary, update relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs) like environment variables, the tutorials, or other documentation sources. - [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Take this as an opportunity to make screenshots of the feature/fix and include it in the PR description. - [x] **Agentic AI Code:**: Confirm this Pull Request is **not written by any AI Agent** or has at least gone through additional human review **and** manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR. - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Title Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # 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 - new env var TOOL_SERVER_CONNECTIONS_FILE and a new class ToolServerConnectionsFileWatcher ### 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)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <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-05-06 08:39: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#63699