Skip to main content
Glama

Spotify Streamable MCP Server

by iceener
context.ts956 B
import { AsyncLocalStorage } from 'node:async_hooks'; export type RequestContext = { sessionId?: string; rsToken?: string; spotifyAccessToken?: string; }; const ctxAls = new AsyncLocalStorage<RequestContext>(); export function runWithRequestContext<T>( context: RequestContext, fn: () => Promise<T>, ): Promise<T> { return new Promise<T>((resolve, reject) => { ctxAls.run(context, async () => { try { const result = await fn(); resolve(result); } catch (e) { reject(e); } }); }); } function getRequestContext(): RequestContext { return ctxAls.getStore() ?? {}; } export function getCurrentSessionId(): string | undefined { return getRequestContext().sessionId; } export function getCurrentRsToken(): string | undefined { return getRequestContext().rsToken; } export function getCurrentSpotifyAccessToken(): string | undefined { return getRequestContext().spotifyAccessToken; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/iceener/spotify-streamable-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server