Skip to content

fix(mcp): align hub publication status and controls - #43241

Merged
joshua-berri merged 4 commits into
mainfrom
litellm_mcp_hub_publication
Sep 26, 2026
Merged

joshua-berri merged 4 commits into
mainfrom
litellm_mcp_hub_publication

Conversation

@tin-berri

@tin-berri tin-berri commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • MCP visibility labels disagree with actual hub publication
  • Rejected publication saves change the running hub

How it solves it:

  • Derive publication from the current registry and settings
  • Apply runtime publication changes only after successful saves
  • Separate network access from explicit hub membership

Intentional product change: cards and details show All Networks, Internal Only, or Unknown. Hub publication controls stay in AI Hub and support clearing the list. Explicit hub publication still allows public-IP requests; authentication and access permissions retain their existing behavior

User Flow

Before: an admin sees conflicting publication information and cannot clear the hub

  1. Configure two MCP servers, explicitly publishing only the internal server
  2. Open /ui/mcp-servers/: Public/Internal badges obscure effective network access
  3. Open AI Hub > MCP Hub: stale metadata misstates publication
  4. Deselect every server: Next is disabled

After: the admin sees network access separately from hub publication

  1. Configure the same two servers, explicitly publishing only the internal server
  2. Open /ui/mcp-servers/: All Networks/Internal Only labels reflect effective access
  3. Open AI Hub > MCP Hub: only explicit members are selected
  4. Clear the list and save; rejected saves leave the running hub unchanged

Changes

  • Share strict/legacy membership rules across list, detail, and public responses
  • Save publication settings before changing runtime state
  • Show effective network access, including explicit-publication overrides
  • Support empty selections, YAML guidance, and backend error messages
  • Block edits when older proxies lack explicit-membership metadata

Caveats

Medium

  • Older proxies need explicit-membership metadata before publication editing

Low

  • Legacy mode still automatically lists network-enabled servers
  • Explicit publication still permits public-IP requests

Validation status

Current tip f1914b3b32 includes main at 635a718ba1 through an ordinary merge. Both PRs merge together cleanly

All required CI and current test jobs pass. Greptile is 5/5; Veria and Cursor Bugbot are clean on this tip. No unresolved review threads remain

Independent Devin verification: 1,441 affected backend tests; 103, with 46 rerun after the UI guard extraction affected dashboard tests. Canonical backend lint/type gates, dashboard formatting/full lint/budgets, type tests, dead-code checks, API-type synchronization, and builds pass. No new or worsened UI warnings; the existing AVIF build warning is unchanged

Completed Codecov report: 28 uploads, 14/14 changed executable backend lines covered against the merge base. Repository-wide line coverage is 78.87%; dashboard coverage is measured separately in Vitest. All 40 changed executable dashboard lines are covered. Two defensive early-return arcs in the publication dialog cannot be reached through its disabled buttons; existing tests click those buttons and verify no API call. Two backend arcs at the pre-existing missing-server 404 remain uncovered in the unit report; the real API rejection was verified separately. No exclusions or lower thresholds were added. Live source verification passes; screenshot publication awaits deployment approval

Pre-Submission checklist

  • I have added meaningful tests
  • Affected tests and coverage pass on the current tip
  • All required CI/CD checks pass on the current tip
  • The PR solves one specific problem
  • Greptile is at least 4/5 with no open actionable findings

Screenshots / Proof of Fix

Independent Devin execution used source-built proxies at the commits below and isolated PostgreSQL databases. Register identical servers hub_pubA and hub_pubB; start with strict publication enabled and only hub_pubA published. Set BASE_URL to each proxy and LITELLM_MASTER_KEY to its test credential

Before (635a718)

Publication metadata and network labels

  1. Run authenticated GETs to /v1/mcp/server and /v1/mcp/server/hub_pubA, then GET /public/mcp_hub: list/detail publication metadata disagree and explicit membership is unavailable
  2. Publish both registered IDs with POST /v1/mcp/make_public, then clear with {"mcp_server_ids":[]}: HTTP 202 updates the public feed, but detail metadata still omits publication state
  3. Open /ui/mcp-servers/: Public/Internal badges obscure the distinction between network access and hub membership

Failed persistence

  1. Successfully publish only hub_pubA, then install a PostgreSQL trigger rejecting configuration writes in the isolated test database
  2. Run curl -s -X POST "$BASE_URL/v1/mcp/make_public" -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"mcp_server_ids":["hub_pubA","hub_pubB"]}': HTTP 500 reports the rejected write
  3. Read /public/mcp_hub: both servers appear, despite the database still containing only hub_pubA. Retrying preserves the incorrect running state
  4. Remove the test trigger and restart: the hub reverts to only hub_pubA

After (f1914b3)

Publication metadata and network labels

  1. Run the same list/detail/public requests: hub_pubA reports is_public=true and is_public_explicit=true; hub_pubB reports both false. The public feed contains only hub_pubA
  2. Publish both, then clear with the same empty list: HTTP 202 updates list, detail, and public feed consistently. Resaving both and restarting preserves membership. In legacy mode a network-visible, unpublished server reports public=true and explicit=false
  3. Open /ui/mcp-servers/: an explicitly published internal server shows All Networks, while an unpublished internal server shows Internal Only

Failed persistence

  1. Successfully publish only hub_pubA, then install the same database write-rejection trigger
  2. Run the same POST publishing both valid server IDs: HTTP 500 reports the same rejected write
  3. Read /public/mcp_hub: only hub_pubA appears. List metadata and the database also retain only hub_pubA; a repeated failed request changes nothing
  4. Remove the trigger and restart: the hub still contains only hub_pubA

Dashboard before/after captures exist for these source commits. Public screenshot upload awaits deployment approval; private verification URLs are intentionally omitted

Type

Bug Fix

@tin-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

Please review the current publication fix, especially derived visibility, empty selections, and persistence before runtime changes

@tin-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review the current commit for publication consistency, explicit versus effective visibility, and failed-save behavior across supported configuration modes

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Refactors MCP server publication logic and UI display.

The PR appears safe to merge based on this review.

Summary

The PR derives MCP Hub publication from current registry settings, saves publication changes before updating runtime state, and separates hub listing from network access in the dashboard. The latest change extracts the visibility-control guard without changing its behavior.

Reviews (9) · Last reviewed commit: "refactor(mcp): keep hub visibility guard..."

Comment thread ui/litellm-dashboard/src/components/AIHub/forms/MakeMCPPublicForm.tsx Outdated
@codspeed

codspeed Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_mcp_hub_publication (f1914b3) with main (69d2a3c)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (8d16625) during the generation of this report, so 69d2a3c was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov

codecov Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tin-berri
tin-berri force-pushed the litellm_mcp_hub_publication branch from 85932d4 to a161e62 Compare September 25, 2026 23:24
@tin-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review a161e62. Missing explicit publication metadata now blocks editing, YAML generation, and saving, with live compatibility proof

@tin-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

Please review a161e62, including the unknown-metadata gate, catalog refresh behavior, and empty publication saves against supported proxies

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@tin-berri
tin-berri force-pushed the litellm_mcp_hub_publication branch from a161e62 to 999e9be Compare September 25, 2026 23:49
@tin-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review rebased head 999e9be against current main. The MCP patch is unchanged and upstream test assignments are fixed.

@tin-berri

Copy link
Copy Markdown
Contributor Author

bugbot run Please review rebased head 999e9be against current main and check for regressions in MCP publication behavior.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@tin-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review origin/main...999e9be. Classifier and logging changes belong to merged main commits and are absent from this PR’s current diff

@tin-berri
tin-berri force-pushed the litellm_mcp_hub_publication branch from 999e9be to c53859b Compare September 26, 2026 01:07
@tin-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review c53859b, focusing on effective network access labels, explicit publication overrides, unknown metadata handling, and removed redundant hub badges

@tin-berri

Copy link
Copy Markdown
Contributor Author

bugbot run Please review c53859b for regressions in network access labels, explicit hub overrides, unknown metadata, and card and detail consistency

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@tin-berri
tin-berri enabled auto-merge (squash) September 26, 2026 03:37
@tin-berri
tin-berri force-pushed the litellm_mcp_hub_publication branch from c53859b to dbaf6ca Compare September 26, 2026 06:31
@tin-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review dbaf6ca. This follow-up shortens network badges to All Networks and Internal Only, without changing access behavior

@tin-berri

Copy link
Copy Markdown
Contributor Author

bugbot run Please review dbaf6ca for regressions after shortening the network badges and updating their existing tests and documentation

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@joshua-berri

Copy link
Copy Markdown
Contributor

@greptileai @cursor review Please review the current tip after resolving test conflicts with main and confirm prior findings remain resolved

@joshua-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@joshua-berri

Copy link
Copy Markdown
Contributor

@greptileai Please review 6649ed1 after merging current main. Confirm prior findings remain resolved; the PR diff stays isolated

@joshua-berri

Copy link
Copy Markdown
Contributor

@cursor review Please review current tip 6649ed1 after the main update, including previous fixes and preserved compatibility behavior

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@joshua-berri

Copy link
Copy Markdown
Contributor

@greptileai Please review f1914b3, including the behavior-preserving visibility guard extraction and publication behavior. Full UI checks pass in Devin

@joshua-berri

Copy link
Copy Markdown
Contributor

@cursor review Please review f1914b3 after the visibility guard extraction. Existing loading and failed-refresh regressions pass with both guard branches covered

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f1914b3. Configure here.

@@ -0,0 +1,37 @@
# Publish MCP servers in the AI Hub

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed ?

Copy link
Copy Markdown
Contributor Author

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

Comment on lines +6767 to +6776
@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 ())

@ryan-crabbe-berri ryan-crabbe-berri Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these feel like they be one method, a little confusing naming here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consolidated the helpers into is_mcp_server_public in #43394, preserving batch lookups and strict/legacy behavior; the existing publication matrix passes

@ryan-crabbe-berri ryan-crabbe-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after nits

@joshua-berri
joshua-berri merged commit 5d777c1 into main Sep 26, 2026
106 of 107 checks passed
@joshua-berri
joshua-berri deleted the litellm_mcp_hub_publication branch September 26, 2026 23:53

This branch was successfully deployed

1 active deployment
e2e-changed — f1914b3b Deployed Sep 26, 2026 by joshua-berri via oauth #1415
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants