MCPcopy Index your code
hub / github.com/simstudioai/sim / closeMcpSession

Function closeMcpSession

apps/sim/lib/mcp/oauth/probe.ts:96–116  ·  view source on GitHub ↗

* Best-effort DELETE to release the streamable-HTTP session the probe just * allocated. Reuses the probe's pinned fetch so this cleanup hop stays pinned. * Failures are ignored — the session will expire on the server side.

(
  url: string,
  sessionId: string,
  probeFetch: FetchLike
)

Source from the content-addressed store, hash-verified

94 * Failures are ignored — the session will expire on the server side.
95 */
96async function closeMcpSession(
97 url: string,
98 sessionId: string,
99 probeFetch: FetchLike
100): Promise<void> {
101 try {
102 const controller = new AbortController()
103 const timer = setTimeout(() => controller.abort(), PROBE_TIMEOUT_MS)
104 try {
105 await probeFetch(url, {
106 method: 'DELETE',
107 headers: { 'Mcp-Session-Id': sessionId },
108 signal: controller.signal,
109 })
110 } finally {
111 clearTimeout(timer)
112 }
113 } catch {
114 // Ignore — best-effort cleanup
115 }
116}

Callers 1

detectMcpAuthTypeFunction · 0.85

Calls 1

abortMethod · 0.65

Tested by

no test coverage detected