Skip to content

feat: add MCP token management UI to My Tokens page#617

Merged
liuwei08 merged 9 commits into
masterfrom
feat/mcp-token-ui
Jun 29, 2026
Merged

feat: add MCP token management UI to My Tokens page#617
liuwei08 merged 9 commits into
masterfrom
feat/mcp-token-ui

Conversation

@sap-yuan

Copy link
Copy Markdown
Collaborator

Summary

  • Add MCP token CRUD to UserTokenService.js — 4 new methods wiring up the /api/v1/mcp/tokens/* endpoints added in DIARCHERS-1396: MCP-dedicated API layer with rate limiting, auth, and audit #610
  • Append a MCP Tokens card to the existing /user/tokens page (UserGlobalTokens.vue) — no new route needed
  • Post-create dialog shows the ib_mcp_* token value (shown once) with a INFRABOX_MCP_TOKEN=... usage hint for the MCP client

What users can do after this PR

  1. Open My Tokens in the sidebar
  2. Scroll down to the MCP Tokens section
  3. Create a token with a name and validity period
  4. Copy the ib_mcp_* value and set INFRABOX_MCP_TOKEN in their MCP client config
  5. Toggle trigger permission per-token via a switch
  6. Revoke tokens when no longer needed

Related

Completes the frontend half of DIARCHERS-1396 / #610 (backend MCP API layer).

@sap-yuan sap-yuan self-assigned this Jun 25, 2026

@liuwei08 liuwei08 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two bugs that must be fixed before merge — see inline comments.

Comment thread src/dashboard-client/src/components/user/UserGlobalTokens.vue Outdated
Comment thread src/dashboard-client/src/components/user/UserGlobalTokens.vue Outdated
@sap-yuan

Copy link
Copy Markdown
Collaborator Author

Fixed in 902bf9b:

  1. Trigger switch revert on failure — added .catch(() => { token.allow_trigger = !newVal }) to revert visual state if the API call fails
  2. Token value leak on dialog reopen — extracted closeMcpTokenDialog() method that calls .close() and clears newMcpToken = ''; wired the OK button to this method

Yuan Huang added 4 commits June 26, 2026 16:32
- UserTokenService: add loadMcpTokens, createMcpToken, revokeMcpToken,
  setMcpTrigger methods calling /api/v1/mcp/tokens/* endpoints
- UserGlobalTokens.vue: append MCP Tokens card to /user/tokens page
  with create form, token list (name, project scope, expiry, last used,
  trigger toggle), revoke action, and post-create dialog showing the
  ib_mcp_* token value with INFRABOX_MCP_TOKEN usage hint
- createMcpToken form: native checkbox list for project selection
- token list: edit button expands inline scope editor per token
- PATCH /api/v1/mcp/tokens/<id> via new updateMcpToken service method
- NewAPIService: add patch() method
- validation: show error messages on invalid name/days input
@sap-yuan sap-yuan force-pushed the feat/mcp-token-ui branch from 680ae35 to 94d4e0f Compare June 26, 2026 08:33
Yuan Huang added 5 commits June 26, 2026 16:59
- projects.py: empty dict falls through to full collaborator query
- auth.py: check_project_access_mcp treats empty dict as allow-all
… response

- auth.py: clarify enabled_projects={} means allow-all (not deny-all);
  add docstring explaining the intentional semantics
- UserGlobalTokens.vue: fix toggleMcpTrigger — v-model already flips
  token.allow_trigger before @change fires, so read it directly instead
  of negating again (previous code sent the wrong value and silently
  reverted the UI)
- NewAPIService.js: patch() returns response.body || {} to guard against
  204 No Content responses

@liuwei08 liuwei08 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@liuwei08 liuwei08 merged commit 4107706 into master Jun 29, 2026
2 checks passed
@liuwei08 liuwei08 deleted the feat/mcp-token-ui branch June 29, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants