Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

Description

This PR fixes the MCP/Agent toggle not appearing in the chat UI when users create model configurations that share the same model file. The toggle was incorrectly gated behind a gallery config check, which only exists for gallery-installed models.

Changes

  • UI Template (chat.html): Removed {{ if $galleryConfig }} wrapper around MCP toggle logic. The toggle now displays for any model with MCP configuration, regardless of installation source.

  • Test Coverage (model_config_test.go): Added test verifying multiple configs pointing to the same model file maintain independent MCP settings.

Example Scenario

# model-base.yaml (from gallery, has ._gallery_model-base.yaml)
name: model-base
parameters:
  model: shared-model.gguf

# model-agent.yaml (user-created, no gallery file)
name: model-agent
parameters:
  model: shared-model.gguf  # same file
mcp:
  stdio: |
    mcpServers:
      test:
        command: mcp-server-test

Before: /chat/model-agent showed no MCP toggle (missing gallery file)
After: /chat/model-agent shows MCP toggle (checks model config directly)

Notes for Reviewers

The fix is a 2-line change in the template. Gallery configs are metadata for gallery-installed models and should not gate feature availability.

Signed commits

  • Yes, I signed my commits.
Original prompt

This section details on the original issue you should resolve

<issue_title>MCP / Agent mode is not working when model file is shared</issue_title>
<issue_description>LocalAI version:
v3.7.0

Describe the bug

If you configure model twice using same model file, and one configuration spec'ed for MCP / Agent mode, LocalAI fails to recognize that and MCP / Agent feature is not working.

To Reproduce

  1. Download model from gallery
  2. Copy configuration file for downloaded model
  3. Import model by pasting copied configuration file, adding MCP and Agent sections, and changing name (but not changing filename!)
  4. Try to chat with model configured for MCP / Agent mode (Chat view is not showing option to enable MCP)
  5. (optional) Verify logs in debug mode to see no MCP activity happens
  6. (optional) Verify configuration of MCP / Agent mode by downloading yet another model from gallery and editing it's original configuration file by pasting MCP and Agent sections.

Expected behavior
One of configurations works in Agent mode (uses MCP), another works in standard way.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link

netlify bot commented Nov 19, 2025

Deploy Preview for localai ready!

Name Link
🔨 Latest commit eae90ca
🔍 Latest deploy log https://app.netlify.com/projects/localai/deploys/691e41c861f5760007901e58
😎 Deploy Preview https://deploy-preview-7318--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI changed the title [WIP] Fix MCP / Agent mode not working with shared model file [ui] Fix MCP toggle not shown for models without gallery config Nov 19, 2025
Copilot AI requested a review from mudler November 19, 2025 22:19
Copilot finished work on behalf of mudler November 19, 2025 22:19
@github-actions github-actions bot added kind/documentation Improvements or additions to documentation dependencies labels Nov 19, 2025
@mudler mudler closed this Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies kind/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP / Agent mode is not working when model file is shared

2 participants