fix(plugins): restore token entry after MCP URL changes

Merged
WE
2h ago
+55-1

Description

Restore API-token entry after an administrator changes an MCP server URL. Saving the new URL clears old header values before opening Authentication. The retained empty header previously prevented the form from creating its token field.

Restore the default Authorization: Bearer {api_key} template when all API-token header values are blank. Administrators can then enter a replacement personal or shared token. Existing nonempty custom headers remain intact.

This follow-up targets main after the MCP setup stack merged. Its release backport requires the MCP backport stack ending at #16455.

How Has This Been Tested?

  • 102 MCP authentication, configuration, and detail component tests passed.
  • Regression cases cover replacement personal and shared tokens, the new server URL, and the submitted authentication template.
  • Changed-file pre-commit checks passed, including TypeScript typing and coverage, lint, formatting, and feature-map integrity.

Additional Options

  • [Optional] Please cherry-pick this PR to the latest release version.

Summary by cubic

Fixes the MCP API-token field disappearing after an administrator changes a server URL. Saving the new URL clears old header values, and a fully blank header previously prevented the form from creating its token field. The form now restores the default Authorization: Bearer {api_key} template whenever all API-token header values are blank, so administrators can enter a replacement personal or shared token. Existing nonempty custom headers remain intact.

Summary by CodeRabbit

  • Bug Fixes
    • Restored the API-token authentication template when authentication headers are empty or cleared after changing a server URL.
    • Kept the replacement token field available for both user and administrator authentication flows.
    • Preserved the replacement server URL and generated the appropriate credential payload during submission.