Re-authenticate a server in the needs-auth state: disconnect, clear * persisted OAuth tokens, then reconnect with `forceOAuth` so even servers * without an explicit `oauth` config use the OAuth flow (auto-detect). * The `authIntercept` lets the TUI surface the auth URL and provide the *
(name: string, authIntercept?: AuthIntercept)
| 182 | * The `authIntercept` lets the TUI surface the auth URL and provide the |
| 183 | * code via callback or paste. */ |
| 184 | async reauthServer(name: string, authIntercept?: AuthIntercept): Promise<void> { |
| 185 | await this.disconnectOne(name) |
| 186 | try { |
| 187 | const fs = await import("node:fs") |
| 188 | const path = await import("node:path") |
| 189 | const { getConfigDir } = await import("../config/settings.js") |
| 190 | fs.unlinkSync(path.join(getConfigDir(), "mcp-auth", `${name}.json`)) |
| 191 | } catch { |
| 192 | // best-effort; no stored tokens to clear |
| 193 | } |
| 194 | this.disabled.delete(name) |
| 195 | await this.connectOne(name, { authIntercept, forceOAuth: true }) |
| 196 | } |
| 197 | |
| 198 | /** Close every connection. Call on session end / exit. */ |
| 199 | async stop(): Promise<void> { |
no test coverage detected