import { NextResponse } from 'next/server' import { createGraphifyClientFromEnv } from '@/lib/graphify' export const dynamic = 'force-dynamic' // GET /api/aos/graphify-health // Checks if the Graphify MCP HTTP service is configured and reachable. // Used by the instance detail UI to show whether graphify is available. export async function GET() { const url = process.env.GRAPHIFY_URL if (!url) { return NextResponse.json({ configured: false, ok: false, message: 'Graphify not configured (GRAPHIFY_URL missing)', }) } const client = createGraphifyClientFromEnv() if (!client) { return NextResponse.json({ configured: true, ok: false, message: 'client init failed' }) } const health = await client.health() return NextResponse.json({ configured: true, ok: health.ok, url, version: health.version, message: health.ok ? 'Graphify service is up' : 'Graphify service unreachable', }) }