-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
feat(proxy): add per-MCP-server RPM rate limiting for keys and teams #29482
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 6 commits into
litellm_internal_staging
from
litellm_mcp_per_server_rpm_limit
Jun 2, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f0b5f03
feat(proxy): add per-MCP-server RPM rate limiting for keys and teams
Sameerlite 4fc8bfb
fix(proxy): gate MCP rpm descriptors on call_mcp_tool; document mcp_r…
Sameerlite 73c61e5
Fix MCP rate limit quota handling
cursoragent a34126a
Delete scripts/test_mcp_rpm_limit.sh
Sameerlite 8c74ef7
docs(proxy): clarify mcp_rpm_limit is enforced for keys and teams, no…
mateo-berri 1d52d36
fix(proxy): accept mcp_rpm_limit in generate_key_helper_fn
mateo-berri 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
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
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
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.
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.
Medium: MCP rate limit bypass through key metadata updates
mcp_rpm_limitis now treated as generic key metadata, and/key/updatepreserves that path for key owners and delegated team members on non-budget fields. A caller with key-update access can set their key'smcp_rpm_limitto{}or a higher value and remove the admin-configured per-server key cap thatget_key_mcp_rpm_limit()enforces; make this field admin-only/immutable on key updates or preserve the existing value unless the caller has key administration rights.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.
This finding flags intended, pre-existing behavior rather than a regression introduced here.
mcp_rpm_limitis plumbed exactly like the existing per-key rate-limit metadata fieldsmodel_rpm_limitandmodel_tpm_limit: sameLiteLLM_ManagementEndpoint_MetadataFieldshoisting, sameget_key_*key-over-team resolution. It is not handled any differently from those fields on/key/update.The
/key/updateauthorization model is deliberate (see_validate_update_key_data, the GHSA-q775-qw9r-2r4g hardening). A non-admin key owner or an authorized team member may update non-budget fields on their own key; onlymax_budgetandspendare gated behind the admin check. Under that model,rpm_limit,tpm_limit,model_rpm_limit, andmodel_tpm_limitare already self-modifiable by the key owner today.mcp_rpm_limitinherits the same property, so it does not open a new bypass.Making just this one field admin-only or immutable would be inconsistent with every other per-key rate limit, was not part of this feature's scope, and would not actually change the threat model since the same caller could still raise their own
rpm_limit/model_rpm_limit. Budget and spend remain the hard, admin-only controls. If per-key rate limits should become admin-immutable, that is a separate, system-wide design change covering all rate-limit fields, not something specific tomcp_rpm_limit.