(mcpName: string)
| 147 | } |
| 148 | |
| 149 | export function cancelPending(mcpName: string): void { |
| 150 | // Look up the oauthState for this mcpName via the reverse index |
| 151 | const oauthState = mcpNameToState.get(mcpName) |
| 152 | const key = oauthState ?? mcpName |
| 153 | const pending = pendingAuths.get(key) |
| 154 | if (pending) { |
| 155 | clearTimeout(pending.timeout) |
| 156 | pendingAuths.delete(key) |
| 157 | mcpNameToState.delete(mcpName) |
| 158 | pending.reject(new Error("Authorization cancelled")) |
| 159 | stopIfIdle() |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | export async function isPortInUse(port: number = OAUTH_CALLBACK_PORT): Promise<boolean> { |
| 164 | return new Promise((resolve) => { |
nothing calls this directly
no test coverage detected