feat(mcp): API-key management tools for the stdio MCP server#226
Conversation
Adds create_api_key, list_api_keys, and revoke_api_key tools so MCP clients can manage project API keys (with scopes) directly — matching the hosted remote MCP server. They call the keyless /api/v1/keys endpoints (project from the auth context). create_api_key enforces the subset-of-caller scope rule server-side. - src/index.ts: 3 new tools + an apiScopeSchema enum of the API scopes - tests: cover the new tools' request URL/method/body - README: list the new tools Co-Authored-By: Duyet Le <[email protected]> Co-Authored-By: duyetbot <[email protected]>
|
Warning Review limit reached
More reviews will be available in 15 minutes and 28 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds new Model Context Protocol (MCP) tools for managing project API keys, specifically create_api_key, list_api_keys, and revoke_api_key, along with corresponding documentation and unit tests. The feedback points out a potential issue in the revoke_api_key tool where a 204 No Content response from the DELETE request can lead to an undefined return value and an invalid MCP response; returning an explicit success object is recommended to avoid client-side errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| toolHandler(async ({ id }) => | ||
| apiRequest(`/v1/keys/${encodeURIComponent(id)}`, { method: "DELETE" }), | ||
| ), |
There was a problem hiding this comment.
Since the backend returns a 204 No Content status for the DELETE request, apiRequest will return undefined. In toolHandler, JSON.stringify(undefined) evaluates to undefined, which results in an invalid MCP TextContent object (missing the required text property) and can cause client-side errors or crashes. Returning an explicit object like { success: true } ensures a valid JSON string is returned to the MCP client.
toolHandler(async ({ id }) => {
await apiRequest(`/v1/keys/${encodeURIComponent(id)}`, { method: "DELETE" });
return { success: true };
}),
Adds
create_api_key,list_api_keys, andrevoke_api_keyto the local stdio MCP server (@agentstate/mcp), matching the hosted remote MCP server's key tools. They call the keyless/api/v1/keysendpoints (project from the authenticating key);create_api_keyaccepts optionalscopesand the server enforces the subset-of-caller delegation rule.apiScopeSchemaenum mirroring the API scope taxonomyVerification:
tsc --noEmitclean (via node),vitest run11 passed.Co-Authored-By: Duyet Le [email protected]
Co-Authored-By: duyetbot [email protected]