MCPcopy
hub / github.com/21st-dev/1code / handleDeepLink

Function handleDeepLink

src/main/index.ts:189–216  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

187
188// Handle deep link
189function handleDeepLink(url: string): void {
190 console.log("[DeepLink] Received:", url)
191
192 try {
193 const parsed = new URL(url)
194
195 // Handle auth callback: twentyfirst-agents://auth?code=xxx
196 if (parsed.pathname === "/auth" || parsed.host === "auth") {
197 const code = parsed.searchParams.get("code")
198 if (code) {
199 handleAuthCode(code)
200 return
201 }
202 }
203
204 // Handle MCP OAuth callback: twentyfirst-agents://mcp-oauth?code=xxx&state=yyy
205 if (parsed.pathname === "/mcp-oauth" || parsed.host === "mcp-oauth") {
206 const code = parsed.searchParams.get("code")
207 const state = parsed.searchParams.get("state")
208 if (code && state) {
209 handleMcpOAuthCallback(code, state)
210 return
211 }
212 }
213 } catch (e) {
214 console.error("[DeepLink] Failed to parse:", e)
215 }
216}
217
218// Register protocol BEFORE app is ready
219console.log("[Protocol] ========== PROTOCOL REGISTRATION ==========")

Callers 1

index.tsFile · 0.85

Calls 3

handleMcpOAuthCallbackFunction · 0.90
handleAuthCodeFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected