fix(plugins): keep MCP edits unsaved until connection succeeds
Description
Keep MCP setup and connection edits unsaved until authentication and tool discovery succeed. In-form failures retain drafts and leave the saved connection unchanged.
Changing Configuration again invalidates an older staged proposal. Explicit Chat choices take priority over previous enable intents. Successful authentication preserves unsaved tool edits. URL changes clear old header values, and intentional OAuth navigation avoids a discard warning. Remove unused legacy client wrappers and dead state.
Full-page OAuth failures require restarting authorization; this change does not persist browser form drafts across redirects.
Setup failures use a neutral translated connection error when an upstream response has no usable error detail. OAuth-specific errors and safe backend details remain intact.
The shared browser-test helper follows staged setup responses and reads the saved server ID after OAuth completes.
How Has This Been Tested?
139 component tests and 49 selected service tests passed. Full TypeScript checking/coverage, lint, formatting, and feature-map checks passed. Backend transaction test limits are recorded in the parent PR. Two focused Playwright helper checks passed for immediate connection and pending authorization. A live local smoke test stopped at the existing SSRF block on the local mock; security settings were unchanged. Full browser CI is rerunning.
Additional Options
- [Optional] Please cherry-pick this PR to the latest release version.
Summary by CodeRabbit
-
New Features
- Added staged MCP server setup with validation and tool discovery before publishing.
- Preserved unsaved settings and tool selections during authentication.
- Added OAuth continuation for authentication-required setups.
- Added explicit control over enabling MCP servers for Chat.
-
Bug Fixes
- Failed or cancelled authentication no longer overwrites saved settings.
- Provider-denied OAuth requests now display the correct cancellation state.
- Improved connection-failure messaging across supported languages.
-
Documentation
- Updated MCP setup and OAuth lifecycle documentation.