Skip to content

ui: fix mcp panel for toggle + timeout + proxy + ON/OFF state#25631

Open
ServeurpersoCom wants to merge 6 commits into
ggml-org:masterfrom
ServeurpersoCom:ui/fix-mcp-panel-toggle-timeout-proxy
Open

ui: fix mcp panel for toggle + timeout + proxy + ON/OFF state#25631
ServeurpersoCom wants to merge 6 commits into
ggml-org:masterfrom
ServeurpersoCom:ui/fix-mcp-panel-toggle-timeout-proxy

Conversation

@ServeurpersoCom

@ServeurpersoCom ServeurpersoCom commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Overview

Fixes MCP panel issues :

  • The "Use llama-server proxy" switch is back in the Add New Server dialog, no need to edit the server afterwards.
  • Connecting to an unreachable MCP server now fails cleanly after the configured timeout instead of locking up the UI.
  • Toggling a server off keeps it listed with its switch off, so it can be re-enabled anytime. Previously it vanished from every menu.
  • New chats now inherit the on/off state of each server from the MCP page, instead of starting with every server disabled.

Also includes cleanups :

  • The MCP request timeout setting now applies live to all servers. Previously it was frozen per server at creation time, so changing it had no effect.
  • The single-option MCP settings section is merged into the Agentic section.
  • Removed the "Max lines per tool preview" setting, which no longer had any effect: since the agentic loop rework, full tool results persist as messages.
  • Removed the internal server list getter whose filtering caused the toggle bug, with a unit test pinning the invariant.

Additional information

Also includes a small cleanup with a unit test to prevent the server on/off toggle bug from reappearing.

Fixes #25625

Thanks @bill88t for testing

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: YES Fable 5 / Self-hosted MCP sandbox servers with shared GPUs

Restore the llama-server proxy switch in the Add New Server dialog.
The dialog never passed useProxy/onUseProxyChange to McpServerForm,
which only renders the proxy switch when the handler is provided.
The flag is now wired, persisted on addServer, and reset on close.

Bound the MCP connection handshake with the configured timeout.
handshakeTimeoutMs was set in the server config but never consumed.
The SDK timeout only covers the initialize request, not
transport.start(), which can hang forever on an unreachable host.
The whole handshake now races against the timeout and closes the
transport on expiry so the underlying fetch or socket is aborted.

Keep disabled MCP servers visible in management and chat-add UIs.
Collapsing mcpDefaultServerOverrides into mcpServers[i].enabled turned
the visibleMcpServers enabled filter into a visibility trap: toggling
a server off outside a conversation hid it from every surface with no
way to re-enable it. The filter is dropped, tools derived from health
checks still skip disabled servers, and the settings page and server
card render the real card instead of a skeleton for disabled servers
that never receive a startup health check.
Remove the visibleMcpServers getter, a filterless alias of getServers
whose name invites the next refactor to put a filter back. Call sites
read getServers directly, the duplicate list in the chat submenu is
merged, and the misleading local variable in the sheet is renamed.

A parser unit test pins the invariant: enabled is an on/off state,
never a visibility filter, so disabled servers stay listed and
toggleable.
@ServeurpersoCom ServeurpersoCom requested a review from a team as a code owner July 13, 2026 17:37
@ServeurpersoCom

Copy link
Copy Markdown
Contributor Author

I make some UI manual stress test...

@ServeurpersoCom ServeurpersoCom changed the title UI/fix mcp panel toggle timeout proxy ui: fix mcp panel for toggle + timeout + proxy Jul 13, 2026
The per-server requestTimeoutSeconds field was never editable in any
UI and froze the global setting at server creation time, so changing
the timeout in Settings was a no-op for existing servers. The field
is removed from the data model and parsers, the timeout is read live
from the global setting wherever a request config is built, and the
misleading "Can be overridden per server" help text is dropped. A
parser unit test guards against reintroducing the stored field.
@bill88t

bill88t commented Jul 13, 2026

Copy link
Copy Markdown

Built commit c26d5d1 and tested all the changes with my configuration, existing data clients, and new browser sessions.

Most of the weirdness is gone, but noticed that new chats always start with all MCP servers off, even if they're enabled in the MCP page.

The timeouts worked, I set mine to 10s in the server json config now, and tested what happens, all good.
The llama-proxy button is back where it should be and works.

If you want me to open a seperate issue for that new chat weirdness, let me know.

@ServeurpersoCom

Copy link
Copy Markdown
Contributor Author

Most of the weirdness is gone, but noticed that new chats always start with all MCP servers off, even if they're enabled in the MCP page.

You're right, I had already noticed this issue, and I'll take the opportunity to fix it here while the commit is small, that way, we won't forget about it.
I'm also going to move the Settings Timeout into Agentic. Having a standalone MCP section is no good.

The MCP section held a single setting. The timeout is a global tool
execution parameter like the other Agentic entries, so it moves there
and the section is removed. Same settings key, no migration needed.
@ServeurpersoCom

Copy link
Copy Markdown
Contributor Author

Another legacy thing to clean and remove !

Legacy

The agenticMaxToolPreviewLines setting was read into AgenticConfig
and consumed by nothing: the agentic loop only uses enabled and
maxTurns. Its help text described a previous architecture where only
truncated previews and the final response survived the loop; tool
results and intermediate turns now persist as full DB messages, so
the setting had no effect at any value. Stale keys in localStorage
or a server ui-config are ignored.
New conversations started with every MCP server off: the settings
rework stopped seeding a per-conversation override list, assuming
the enabled check would fall back to mcpServers[i].enabled, but it
fell back to false, and the send path passed the raw stored list
with no fallback at all. The per-conversation list is now sparse by
contract, holding only explicit toggles, and every access point
resolves a missing entry to the server's own enabled flag: the
toggle display, the resolved list handed to the agentic flow, and
the enabled check itself.
@ServeurpersoCom

Copy link
Copy Markdown
Contributor Author

@bill88t can you try again? New conversations should now inherit the MCP page toggles, and per-conversation enable/disable should stick.

@ServeurpersoCom ServeurpersoCom requested a review from allozaur July 13, 2026 19:26
@ServeurpersoCom ServeurpersoCom changed the title ui: fix mcp panel for toggle + timeout + proxy ui: fix mcp panel for toggle + timeout + proxy + ON/OFF state Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misc. bug: WebUI MCP panel breakage

2 participants