We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/robertn702/mcp-sunsama'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
client-resolver.ts•945 B
import { SunsamaClient } from "sunsama-api/client";
import { getGlobalSunsamaClient } from "../auth/stdio.js";
import type { SessionData } from "../auth/types.js";
import { sessionManager } from "../transports/http.js";
/**
* Gets the appropriate SunsamaClient instance based on context
* - HTTP transport: Uses session-scoped client from request
* - Stdio transport: Uses global singleton client
*/
export async function getClient(session?: any): Promise<SunsamaClient> {
// Check if session has a client directly (might be set by transport)
if (session?.sunsamaClient) {
return session.sunsamaClient;
}
// Check if session has an ID we can use to lookup in SessionManager
if (session?.id) {
const sessionData = sessionManager.getSessionData(session.id);
if (sessionData) {
return sessionData.sunsamaClient;
}
}
// Fallback to stdio transport: global client
return await getGlobalSunsamaClient();
}