Skip to content

Bug: LLM provider/model forms do nothing on submit (saveLLMProvider/saveLLMModel not in global scope) #4662

@sealkrach

Description

@sealkrach

Description

In the Admin UI, clicking Save on the Add/Edit LLM Provider or Add/Edit LLM Model modals does nothing. The page silently reloads without saving.

Root Cause

In mcpgateway/templates/admin.html, both forms use bare function names in their onsubmit handlers:

<!-- Line ~2081 -->
<form id="llm-provider-form" onsubmit="saveLLMProvider(event)">

<!-- Line ~2179 -->
<form id="llm-model-form" onsubmit="saveLLMModel(event)">

However, saveLLMProvider and saveLLMModel are not exposed as global functions. They are only registered on the window.Admin namespace in admin.js:

Admin.saveLLMProvider = saveLLMProvider;
Admin.saveLLMModel = saveLLMModel;

When the form is submitted, the browser cannot resolve saveLLMProvider as a global, event.preventDefault() is never called, and the form falls back to a native HTML submission (page reload). No provider or model is ever saved.

Fix

Change both onsubmit attributes to use the Admin. prefix:

<form id="llm-provider-form" onsubmit="Admin.saveLLMProvider(event)">
<form id="llm-model-form" onsubmit="Admin.saveLLMModel(event)">

Steps to Reproduce

  1. Open the Admin UI → LLM Settings
  2. Click "Add Provider" and fill in the form
  3. Click "Save" — nothing happens, page reloads

Impact

The entire LLM provider and model management UI is non-functional. Users cannot add or edit providers/models through the admin interface.

Environment

Affects all deployments (Docker, PyPI). Bug is in the template source.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions