Skip to main content
Glama
tokenPersistence.ts953 B
import { type TokenData, type EnhancedTokenManagerOptions, } from '@sudowealth/schwab-api' /** * Maps MCP-style load/save functions to EnhancedTokenManager-compatible functions * * @param load Function to load tokens from storage * @param save Function to save tokens to storage * @returns Mapped load and save functions compatible with EnhancedTokenManager */ export function mapTokenPersistence<T extends EnhancedTokenManagerOptions = EnhancedTokenManagerOptions>( load?: () => Promise<TokenData | null>, save?: (tokenData: TokenData) => Promise<void>, ): Pick<T, 'load' | 'save'> { const mappedLoad: (() => Promise<TokenData | null>) | undefined = load ? async (): Promise<TokenData | null> => load() : undefined const mappedSave: ((d: TokenData) => Promise<void>) | undefined = save ? async (d: TokenData): Promise<void> => save(d) : undefined return { load: mappedLoad, save: mappedSave, } as Pick<T, 'load' | 'save'> }

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/sudowealth/schwab-mcp'

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