Open WebUI OpenAPI Servers

repository·main·Indexed 21 days ago

https://github.com/open-webui/openapi-servers

Reference implementations of OpenAPI Tool Servers designed to integrate external tools and data sources into LLM agents and workflows. Includes FastAPI-based servers for filesystem access, Git, memory and knowledge graphs, weather, user info, SQL chat, external RAG, and a Bitcoin price predictor. Also provides bridging capabilities between Model Context Protocol (MCP) and OpenAPI.

Tokens
19.4K
Snippets
102
Records
129
Agent score
75%

What's inside open-webui-openapi-servers

  1. Overview of the User Info Proxy API

    main
    The User Info Proxy API is a lightweight FastAPI microservice designed to act as a proxy for authentication. It receives an Authorization: Bearer token, forwards it to an internal authentication server (defined by OPEN_WEBUI_BASE_URL), and returns the authenticated user's details. It is useful for bridging Open WebUI sessions with internal identity providers.
  2. Reference OpenAPI Tool Server Implementations

    main

    The repository provides several reference implementations that demonstrate common use cases for LLM agents:

    • Filesystem Access (servers/filesystem): Safe local file operations with configurable restrictions.
    • Git Server (servers/git): Search and read Git repositories via controlled API endpoints.
    • Memory & Knowledge Graph (servers/memory): Persistent memory and semantic knowledge querying.
    • Weather Server (servers/weather): Access to current weather and forecasts via public APIs.
    • Get User Info Server (servers/get-user-info): Access to enriched user profiles from auth providers.
    • SQL Chat Server (servers/sql): Natural language to SQL query generation and execution for database exploration.
    • External RAG Tool Server (servers/external-rag): Integration of custom or third-party Retrieval-Augmented Generation (RAG) pipelines as callable tools.
  3. Quickstart: Install and run the Weather Tool Server

    main

    To set up the Weather Tool Server locally, clone the repository, navigate to the weather server directory, install the required Python dependencies, and run the server using uvicorn.

    Note: This server is built using FastAPI and requires a Python environment with pip and uvicorn installed.

    git clone https://github.com/open-webui/openapi-servers
    cd openapi-servers/servers/weather
    
    # Install dependencies
    pip install -r requirements.txt
    
    # Run the server
    uvicorn main:app --host 0.0.0.0 --reload
  4. Quickstart: Install and run the Flashcard Display API

    main

    The Flashcard Display API is a lightweight FastAPI service designed to render interactive flashcards in a browser. To set up the server locally, clone the repository, install the required Python dependencies, and run the application using uvicorn.

    # Clone the repo
    git clone https://github.com/open-webui/openapi-severs
    cd openapi-servers/servers/flashcards
    
    # Install dependencies
    pip install -r requirements.txt
    
    # Run the server
    uvicorn main:app --host 0.0.0.0 --reload
  5. Quickstart the Git Tool Server

    main

    The Git Tool Server is a FastAPI-based implementation designed to provide Git capabilities to Open WebUI via OpenAPI. To run the server locally, clone the repository, navigate to the specific server directory, install the required Python dependencies, and start the server using uvicorn.

    git clone https://github.com/open-webui/openapi-servers
    cd openapi-servers/servers/git
    
    pip install -r requirements.txt
    uvicorn main:app --host 0.0.0.0 --reload
  6. Quickstart: Install and run the Slack Tool Server

    main

    To get the Slack Tool Server running locally, clone the repository, install the Python dependencies, configure the required environment variables, and start the FastAPI server using uvicorn.

    Installation Steps

    1. Clone the repository and navigate to the Slack server directory:
      git clone https://github.com/open-webui/openapi-servers
      cd openapi-servers/servers/slack
    2. Install dependencies:
      pip install -r requirements.txt
    3. Run the server:
      uvicorn main:app --host 0.0.0.0 --reload
    git clone https://github.com/open-webui/openapi-servers
    cd openapi-servers/servers/slack
    
    # Install dependencies
    pip install -r requirements.txt
    
    # Run the server
    uvicorn main:app --host 0.0.0.0 --reload
  7. Quickstart: Install and run an OpenAPI Tool Server

    main

    You can get started by using the reference FastAPI-based implementations located in the servers/ directory. To run a specific server (using the filesystem server as an example), clone the repository, navigate to the server directory, install dependencies, and run it using uvicorn or docker compose.

    Note: You can adapt these examples to any OpenAPI-compatible stack such as FastAPI or FastOpenAPI.

    # Clone and navigate
    git clone https://github.com/open-webui/openapi-servers
    cd openapi-servers
    
    # Option 1: Manual installation (using 'filesystem' as an example)
    cd servers/filesystem
    pip install -r requirements.txt
    uvicorn main:app --host 0.0.0.0 --reload
    
    # Option 2: Using Docker (using 'filesystem' as an example)
    cd servers/filesystem
    docker compose up
  8. Quickstart the Time Tool Server

    main

    To run the Time Tool Server locally, clone the repository, navigate to the specific server directory, install the required Python dependencies, and start the server using uvicorn. The server will be accessible on all network interfaces (0.0.0.0) with hot-reloading enabled.

    git clone https://github.com/open-webui/openapi-servers
    cd openapi-servers/servers/time
    pip install -r requirements.txt
    uvicorn main:app --host 0.0.0.0 --reload
  9. Set up and run the User Info Proxy API

    main

    The service requires Python 3.11+ and FastAPI. Follow these steps to configure and launch the service:

    1. Configure the Auth Backend: Set the OPEN_WEBUI_BASE_URL environment variable to point to your internal authentication server.

      export OPEN_WEBUI_BASE_URL=http://your-open-webui.com
    2. Run the service: Use uvicorn to start the FastAPI application.

      uvicorn main:app --host 0.0.0.0 --reload
    uvicorn main:app --host 0.0.0.0 --reload
  10. Install and run the Filesystem Tool Server

    main

    The Filesystem Tool Server is a FastAPI-powered server that allows interaction with your local filesystem via OpenAPI. To set it up, clone the repository, navigate to the specific server directory, install the required Python dependencies, and run the server using uvicorn.

    git clone https://github.com/open-webui/openapi-servers
    cd openapi-servers/servers/filesystem
    pip install -r requirements.txt
    uvicorn main:app --host 0.0.0.0 --reload
  11. Setup and run the Token Extractor API

    main

    To use this service, ensure that SSO is configured in Open WebUI and that the client has the oauth_id_token and oauth_access_token cookies set.

    Prerequisites

    • Python 3.11+
    • FastAPI

    Running the service

    Use uvicorn to start the FastAPI application:

    uvicorn main:app --host 0.0.0.0 --reload
    uvicorn main:app --host 0.0.0.0 --reload