-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
fix(mcp): highlight MCP cards red when the logged-in user is missing per-user env vars #29856
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
Merged
mateo-berri
merged 2 commits into
litellm_internal_staging
from
litellm_mcp_card_validation_fix
Jun 6, 2026
+77
−30
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Low: Env-var metadata exposed outside the user's MCP grants
_resolve_accessible_mcp_servers()returns every server inview_allmode for any non-route-restricted caller, but this endpoint returns the per-user env var names/descriptions from those unredacted server objects. A normal authenticated user can call/v1/mcp/user-env-vars/statusand enumerate credential-field metadata for servers their key/team cannot access through the per-server env-var endpoints, which still use the narrower authorization check. Keep this bulk status path scoped to the user's effective allowed servers for non-admins, or only use the view_all/unfiltered branch for admin-view callers.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.
Thanks for the careful look. I dug into this and I don't think it widens exposure for this PR.
The status endpoint and the card grid (
GET /v1/mcp/server) now resolve their server set through the same_resolve_accessible_mcp_servershelper, so every server whose per-user var status is reported here is one the same caller already sees as a card on their dashboard. This endpoint cannot surface a server, or any field of one, that the grid would not already show that caller.What it returns is also tightly limited.
_compute_user_env_var_statusonly emitsscope="user"variables that are actually blocking (referenced by a static header with no admin global fallback), and only as name + description + is_set; admin-configuredscope="global"secret names and every stored value are filtered out before the response is built, so no admin credential and no stored secret is ever exposed here.This is also the disclosure path the code already designates for non-admins.
_sanitize_mcp_server_for_non_admindeliberately stripsenv_varsfrom the grid so the per-user subset comes from/user-env-vars/statusinstead (see the comment atlitellm/proxy/management_endpoints/mcp_management_endpoints.py:548-552). Scoping this endpoint back to the narrow key grant would reintroduce the exact bug the PR fixes, where a card the user sees on the grid never lights up red for its missing per-user vars.The only mode that returns the full inventory to a non-admin is
view_all, an opt-in general setting (user_mcp_management_mode: view_all) whose defined behavior is to show every server to every dashboard user; the grid has resolved it that way for non-admins since before this PR. The defaultrestrictedmode keeps both surfaces scoped to the user's effective allowed servers