Add MCP API key management tool#109
Open
IlyaasK wants to merge 1 commit into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Monitoring Plan: API key management via MCP toolWhat this PR does: Lets AI agents create, list, rename, and delete Kernel API keys directly through the MCP protocol, without leaving their context. Intended effect:
Risks:
Status updates will be posted automatically on this PR as monitoring progresses. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
manage_api_keysMCP tool for create/list/get/update/deleteproject_idand optionaldays_to_expireValidation
bunx prettier --write src/lib/mcp/tools/api-keys.ts src/lib/mcp/register.tsgit diff --checkKERNEL_CLI_PROD_CLIENT_ID=dummy-prod KERNEL_CLI_STAGING_CLIENT_ID=dummy-staging KERNEL_CLI_DEV_CLIENT_ID=dummy-dev NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_Y2xlcmsuZXhhbXBsZS5jb20k bun run buildhttp://127.0.0.1:3002/mcpwithAPI_BASE_URL=http://127.0.0.1:3001: initialized MCP, verifiedmanage_api_keyswas listed, created a scratch project, created a project-scoped API key, confirmed plaintext key is returned on create only, got/updated/listed/deleted the key, then deleted the scratch projectNotes
bun run format:checkstill fails on pre-existingAGENTS.mdformatting outside this PR scope.Note
High Risk
Introduces programmatic create/delete of API credentials over MCP; create returns full plaintext keys, which is high-impact if MCP auth or tool access is misconfigured.
Overview
Exposes Kernel API key lifecycle to MCP clients via a new
manage_api_keystool, registered inregisterMcpCapabilitiesimmediately after project tools.Agents can create org-wide or project-scoped keys (optional
project_id,days_to_expireup to 3650 or no expiry), list/get masked metadata with pagination, update names, and delete keys. Create responses include the plaintext secret once; other actions return masked JSON. Calls use the authenticated MCP token throughcreateKernelClientand mirror the existingmanage_projectsaction/switch pattern.Reviewed by Cursor Bugbot for commit 8849607. Bugbot is set up for automated code reviews on this repo. Configure here.