Repository navigation
fix(mcp): align hub publication status and controls #43241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dbaf6ca
8c8e735
6649ed1
f1914b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Publish MCP servers in the AI Hub | ||
|
|
||
| Set `litellm_settings.public_mcp_servers` to the concrete IDs of the servers you want listed in the public AI Hub. Pin `server_id` in each configuration entry so the publication list stays stable across deployments | ||
|
|
||
| ```yaml | ||
| mcp_servers: | ||
| documentation: | ||
| server_id: documentation-mcp | ||
| url: https://mcp.example.com/mcp | ||
| transport: http | ||
| available_on_public_internet: true | ||
|
|
||
| litellm_settings: | ||
| public_mcp_hub_strict_whitelist: true | ||
| public_mcp_servers: | ||
| - documentation-mcp | ||
| ``` | ||
|
|
||
| Use `documentation-mcp`, the `server_id`, in the publication list. The configuration key `documentation`, display names, and aliases are not publication IDs. Database-created servers use the ID returned by `/v1/mcp/server` | ||
|
|
||
| The dashboard's **AI Hub > MCP Hub > Manage MCP Hub Visibility** dialog edits this same list. Its YAML example includes the selected server IDs. With database-backed configuration (`store_model_in_db: true`), a value declared in YAML is owned by that file: edit the file and reload, or remove that key from YAML to let the dashboard manage it in the database. File-backed deployments can save the list directly to their configuration file | ||
|
|
||
| To remove all explicit entries, save an empty selection in the dialog or configure: | ||
|
|
||
| ```yaml | ||
| litellm_settings: | ||
| public_mcp_hub_strict_whitelist: true | ||
| public_mcp_servers: [] | ||
| ``` | ||
|
|
||
| ## Hub listing and network access | ||
|
|
||
| The **Hub listing** column in AI Hub identifies servers that appear in `/public/mcp_hub`. The dashboard derives this status from the current registry and publication settings. Setting `mcp_info.is_public` on a server does not publish it; that response field is derived metadata. `mcp_info.is_public_explicit` identifies registered servers included in the explicit publication list | ||
|
|
||
| Gateway cards and server details show **All Networks** when `available_on_public_internet` is enabled or the server is explicitly published in `public_mcp_servers`. They show **Internal Only** when both are false. The per-server flag defaults to `true`; explicit publication overrides a disabled flag for compatibility. Older proxies that omit the metadata needed to determine access show **Unknown**. These labels describe allowed client IPs; authentication and tool permissions still apply | ||
|
|
||
| The default `public_mcp_hub_strict_whitelist: true` lists only registered servers in `public_mcp_servers`. Legacy mode (`false`) additionally lists registered servers with `available_on_public_internet: true`. In legacy mode, clearing the explicit publication list leaves these automatically listed servers visible. Enable strict mode when the publication list should fully determine hub visibility | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6764,6 +6764,16 @@ def get_mcp_server_by_id(self, server_id: str, client_ip: str | None = None) -> | |
| return server | ||
| return None | ||
|
|
||
| @staticmethod | ||
| def _is_public_mcp_server(server: MCPServer, public_ids: Container[str]) -> bool: | ||
| return server.server_id in public_ids or ( | ||
| not litellm.public_mcp_hub_strict_whitelist and server.available_on_public_internet | ||
| ) | ||
|
|
||
| def is_mcp_server_public(self, server_id: str) -> bool: | ||
| server: Final = self.registry.get(server_id) or self.config_mcp_servers.get(server_id) | ||
| return server is not None and self._is_public_mcp_server(server, litellm.public_mcp_servers or ()) | ||
|
|
||
|
Comment on lines
+6767
to
+6776
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these feel like they be one method, a little confusing naming here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consolidated the helpers into |
||
| def get_public_mcp_servers(self) -> list[MCPServer]: | ||
| """ | ||
| Return the MCP servers published to the AI Hub via /v1/mcp/make_public. | ||
|
|
@@ -6781,18 +6791,8 @@ def get_public_mcp_servers(self) -> list[MCPServer]: | |
| deployments that relied on the OR-with-default semantics; will be | ||
| removed in a future release. | ||
| """ | ||
| if litellm.public_mcp_hub_strict_whitelist: | ||
| if litellm.public_mcp_servers is None: | ||
| return [] | ||
| public_ids = set(litellm.public_mcp_servers) | ||
| return [server for server in self.get_registry().values() if server.server_id in public_ids] | ||
|
|
||
| public_ids = set(litellm.public_mcp_servers or []) | ||
| return [ | ||
| server | ||
| for server in self.get_registry().values() | ||
| if server.available_on_public_internet or server.server_id in public_ids | ||
| ] | ||
| public_ids: Final = frozenset(litellm.public_mcp_servers or ()) | ||
| return [server for server in self.get_registry().values() if self._is_public_mcp_server(server, public_ids)] | ||
|
|
||
| def expand_permission_list(self, identifiers: list[str]) -> list[str]: | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the standalone README in #43394; the visibility dialog still provides YAML examples, canonical server ID guidance, and clearing controls