Skip to main content
Glama
route.ts1.1 kB
import { NextRequest, NextResponse } from 'next/server'; import { initializeDatabase } from '@/lib/db'; export const dynamic = 'force-dynamic'; export async function GET(request: NextRequest) { try { // Check for authorization const API_KEY = process.env.ADMIN_API_KEY; if (!API_KEY) { return NextResponse.json( { error: 'Admin API key not configured' }, { status: 500 } ); } const authHeader = request.headers.get('Authorization'); if (!authHeader || !authHeader.startsWith('Bearer ') || authHeader.substring(7) !== API_KEY) { return NextResponse.json( { error: 'Unauthorized' }, { status: 401 } ); } // Initialize database defaults await initializeDatabase(); return NextResponse.json({ success: true, message: 'Database initialized successfully' }); } catch (error) { console.error('Database initialization error:', error); return NextResponse.json( { error: 'Failed to initialize database', details: String(error) }, { status: 500 } ); } }

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/thomasdavis/blah'

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