Option to hide MCP servers with no tools available to the current user #15460
Replies: 1 comment
|
The semantics in the sketch are the ones I would ship:
Default off is required. YAML servers currently get implicit VIEW in This sits next to MCP ACLs (#9731), it does not replace them. ACLs cover servers stored in LibreChat. Gateway / The fork looks small enough. Open the PR against |
Uh oh!
There was an error while loading. Please reload this page.
What features would you like to see added?
An opt-in setting to hide an MCP server from the tools dropdown (and the agent builder's MCP section) when the current user's tool list for that server is empty — either globally (
interface.mcpServers.hideEmpty: true) or per server (hideWhenEmpty: true) inlibrechat.yaml.More details
Our deployment (and, we believe, a growing number of enterprise deployments) puts LibreChat behind an MCP gateway that enforces per-user authorization: the gateway forwards the user's identity (via
Authorization: Bearer {{LIBRECHAT_OPENID_ACCESS_TOKEN}}headers) to an external policy engine (OPA), which filterstools/listper user. Different users therefore see different tool sets for the same configured server — and for some users a given server legitimately resolves to zero tools.Today every
mcpServersentry fromlibrechat.yamlis always shown to every user: the dropdown is populated fromGET /api/mcp/servers, which resolves the configured servers without considering the user's tool catalog, and YAML-based servers get an implicit VIEW permission on the client (useMCPServerManager.ts). A user without access to a server's tools still sees the entry, can toggle it on, and gets an empty (0-tool) server — confusing UX, especially when servers are split into several themed entries.The information needed to do better already exists:
GET /api/mcp/tools(loadMCPServerCatalogs) already loads the per-user tool catalog per server, using the user's own headers. The ask is only to let the client use that data to filter the server list, behind an opt-in flag so current behavior is unchanged by default.Suggested semantics:
This complements the recently added MCP server ACLs (#9731): ACLs cover DB-stored servers managed inside LibreChat, while this option covers deployments where per-user tool authorization lives outside LibreChat (MCP gateway / ext_authz), with servers defined in
librechat.yaml.Implementation sketch (what our working branch does): a
hideWhenEmptyfield on themcpServersschema inpackages/data-provider(server-managed, exposed through the redaction allowlist);GET /api/mcp/toolsmarks each server withcatalogLoadedso clients can distinguish "loaded and empty" from "catalog unknown" (connection or OAuth pending);useMCPServerManagerfiltersselectableServersand the agent builder skips the same servers; unit tests for the filtering predicate. Default behavior is unchanged, and the tools catalog is not fetched by the hook unless a server opts in.Implementation status: implemented and unit-tested in our fork, validated end-to-end in a production-like deployment (LibreChat behind an MCP gateway with OPA ext_authz filtering tools per user): https://github.com/PeterMilanovics/LibreChat/tree/feat/mcp-hide-when-empty (8 files, +164/−9). Happy to open the PR against
devif the approach is acceptable, and to adjust anything based on your feedback — including the option name or moving the flag underinterface.mcpServers.Which components are impacted by your request?
UI
All reactions