Repository navigation
Set per-tool rate limits in Settings → Roles and log refused calls - #1556
Merged
Merged
Conversation
#1544 added per-tool limits for MCP roles, reachable only through the API: an admin could neither see nor set them in the dashboard, and a refused call left no trace in the logs. - Settings → Roles → Manage tools: per-minute and per-hour fields next to each ticked tool (empty is unlimited), a count of limited tools per connector, and a note on how limits count. Values are validated before anything is saved; system roles show no fields. - A refused call is logged like a failed call (status ERROR, error "Rate limit reached: ..."), without the connector, so connector health, failure alerts and the support desk do not count it. - CLI README: setting and clearing limits with amcp api, and finding refused calls in the audit log.
helpcodeai
enabled auto-merge (squash)
November 6, 2026 11:34
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
#1544 added per-tool rate limits for MCP roles, but only through the API. An admin could not see or set them in the dashboard, and a call refused by a limit left no trace in the logs. This adds the dashboard part, logs refused calls, and documents the CLI path.
Changes
Dashboard: Settings → Roles → Manage tools (
settings/roles/page.tsx)PUT /api/roles/:id/tools) and only the limits that changed (PUT .../rate-limit). New grants start unlimited, as the API does.Backend: logging (
dynamic-mcp-tools.ts)ERROR, errorRate limit reached: ..., input and output. It shows up in /logs and inGET /api/audit/invocations.connectorId. Connector health (MCP server view), the connector failure alerts inAuditService.logInvocationand the support desk'sconnector_issuesall group errors by connector. A refusal we made ourselves says nothing about the connector.CLI README: a recipe for setting and clearing limits with
amcp api, and for finding refused calls in the audit log.Cloud and self-hosted: same behaviour in both. No migration and no new endpoint; it uses the endpoints from #1544.
Type
Testing
In
packages/backend:npx jest src/mcp-server: 700 passed, 5 skipped. New tests:npx tsc --noEmitandnpx eslinton the changed files: clean.In
packages/frontend:npx playwright test tests/e2e/role-tool-rate-limits.spec.ts tests/e2e/i18n.spec.ts: 57 passed. The new spec covers:0is refused and nothing is saved.npx tsc --noEmit: clean.npx eslinton the changed files: no errors. The 2 warnings are the existingloadDataeffect on this page, unchanged.Root:
node scripts/generate-llms-txt.mjs --check: up to date.Checklist