feat(tokens): permanently delete agent tokens to free the name for reuse (#820)#821
Merged
Conversation
…use (#820) Revoking an agent token is a soft delete: the record is kept so the token name stays reserved, which blocks creating a new token with the same name (issue #820). This adds a permanent delete that removes the token record and its name->hash mapping, freeing the name for reuse. - storage: DeleteAgentToken(name) removes both the agent_tokens record and the agent_token_names mapping in one tx. - REST: DELETE /api/v1/tokens/{name}/permanent (distinct from the existing revoke DELETE /api/v1/tokens/{name}). Admin-only, 204/404. - server edition: parallel DELETE /api/v1/user/tokens/{name}/permanent, scoped to the authenticated user. - CLI: `mcpproxy token delete <name>` (aliases: rm, remove). - Web UI: a Delete button on revoked/expired tokens (active tokens must be revoked first) with a confirm dialog. - docs + agent-tokens API contract updated. Tests: storage/API delete + name-reuse-after-delete, CLI subcommand wiring.
Deploying mcpproxy-docs with
|
| Latest commit: |
0e67bb4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://453d3a6f.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://feat-delete-agent-tokens.mcpproxy-docs.pages.dev |
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 28966820968 --repo smart-mcp-proxy/mcpproxy-go
|
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
Closes #820.
Revoking an agent token is a soft delete — the record is kept so the token name stays reserved, which blocks creating a new token with the same name. This adds a permanent delete that removes the token record and its
name → hashmapping, freeing the name for reuse.Changes
DeleteAgentToken(name)removes both theagent_tokensrecord and theagent_token_namesmapping in one BBolt tx (revoke leaves both intact).DELETE /api/v1/tokens/{name}/permanent— distinct from the existing revokeDELETE /api/v1/tokens/{name}. Admin-only,204on success,404if not found.DELETE /api/v1/user/tokens/{name}/permanent, scoped to the authenticated user.mcpproxy token delete <name>(aliasesrm,remove).docs/features/agent-tokens.md+specs/028-agent-tokens/contracts/agent-tokens-api.yaml.Design notes
/permanent) rather than overloading the revokeDELETEor a query param — keeps revoke (soft) and delete (hard) unambiguous and independently testable.rm); requiring revoke-first would add friction for automation, while the UI keeps the interactive path safe.ValidateAgentTokenkeeps rejecting revoked tokens with "token has been revoked".Testing
-race; server edition green.golangci-lintv2 (CI config) clean; frontendtype-checkclean.409→ permanent delete → recreate201) and end-to-end through the Web UI (Delete button removes a revoked token, then the freed name is reused successfully).