MCPcopy Create free account
hub / github.com/anomalyco/opencode / cancelPending

Function cancelPending

packages/opencode/src/mcp/oauth-callback.ts:149–161  ·  view source on GitHub ↗
(mcpName: string)

Source from the content-addressed store, hash-verified

147}
148
149export 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
163export async function isPortInUse(port: number = OAUTH_CALLBACK_PORT): Promise<boolean> {
164 return new Promise((resolve) => {

Callers

nothing calls this directly

Calls 4

stopIfIdleFunction · 0.85
getMethod · 0.65
deleteMethod · 0.45
rejectMethod · 0.45

Tested by

no test coverage detected