Skip to main content
Glama

OpenAI SDK Knowledge MCP Server

by seratch
service-status.ts1.64 kB
export interface ServiceHealth { status: "active" | "partial" | "down"; services: { database: { status: string; latency: number }; vectorStore: { status: string; latency: number }; openai: { status: string; latency: number }; }; } export async function calculateServiceStatus(env: any): Promise<ServiceHealth> { const health: ServiceHealth = { status: "active", services: { database: { status: "unknown", latency: 0 }, vectorStore: { status: "unknown", latency: 0 }, openai: { status: "unknown", latency: 0 }, }, }; if (env.DB) { try { const dbStart = Date.now(); await env.DB.prepare("SELECT 1").first(); health.services.database = { status: "healthy", latency: Date.now() - dbStart, }; } catch (error) { health.services.database = { status: "unhealthy", latency: 0 }; health.status = "partial"; } } else { health.services.database = { status: "not configured", latency: 0 }; } if (env.VECTORIZE && env.OPENAI_API_KEY) { health.services.vectorStore = { status: "configured", latency: 0 }; } else { health.services.vectorStore = { status: "not configured", latency: 0 }; } if (env.OPENAI_API_KEY) { health.services.openai = { status: "configured", latency: 0 }; } else { health.services.openai = { status: "not configured", latency: 0 }; health.status = "partial"; } const criticalServices = [health.services.database, health.services.openai]; if (criticalServices.some((service) => service.status === "unhealthy")) { health.status = "down"; } return health; }

Latest Blog Posts

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/seratch/openai-sdk-knowledge-org'

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