BusyBee3333 4e6467ffb0 Add CRESync CRM application with Setup page
- Build complete Next.js CRM for commercial real estate
- Add authentication with JWT sessions and role-based access
- Add GoHighLevel API integration for contacts, conversations, opportunities
- Add AI-powered Control Center with tool calling
- Add Setup page with onboarding checklist (/setup)
- Add sidebar navigation with Setup menu item
- Fix type errors in onboarding API, GHL services, and control center tools
- Add Prisma schema with SQLite for local development
- Add UI components with clay morphism design system

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 17:30:55 -05:00

59 lines
1.5 KiB
TypeScript

import { NextResponse } from 'next/server';
import { getSession } from '@/lib/auth';
import { createMCPClient } from '@/lib/control-center/mcp-client';
import type { ToolDefinition } from '@/types/control-center';
interface ToolsResponse {
tools: ToolDefinition[];
toolCount: number;
mcpStatus: {
connected: boolean;
serverUrl: string;
};
}
export async function GET() {
// Check authentication
const session = await getSession();
if (!session) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
try {
const mcpClient = await createMCPClient();
if (!mcpClient) {
return NextResponse.json({
tools: [],
toolCount: 0,
mcpStatus: { connected: false, serverUrl: 'Not configured' }
});
}
const isHealthy = await mcpClient.healthCheck();
if (!isHealthy) {
return NextResponse.json({
tools: [],
toolCount: 0,
mcpStatus: { connected: false, serverUrl: 'Server not responding' }
});
}
const tools = await mcpClient.getTools();
const response: ToolsResponse = {
tools,
toolCount: tools.length,
mcpStatus: { connected: true, serverUrl: 'http://localhost:8000' }
};
return NextResponse.json(response);
} catch (error) {
console.error('Failed to fetch tools:', error);
return NextResponse.json(
{ error: 'Failed to fetch tools', details: error instanceof Error ? error.message : 'Unknown' },
{ status: 500 }
);
}
}