MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / reauthServer

Method reauthServer

src/mcp/manager.ts:184–196  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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> {

Callers 1

reauthSelectedFunction · 0.80

Calls 3

disconnectOneMethod · 0.95
connectOneMethod · 0.95
getConfigDirFunction · 0.85

Tested by

no test coverage detected