Skip to main content
Glama
verify-key.ts1.72 kB
import { PrismaClient } from '@prisma/client'; // Use the connection string from the root .env const prisma = new PrismaClient({ datasources: { db: { url: "postgresql://postgres:123@localhost:5432/canvelete?schema=public" } } }); async function setupKey() { const apiKey = "cvt_a5c514564c4b08b2778fc8586fffd8df6a5a6391a9cbfe89adedcaf01427b73a"; console.log('Setting up API Key:', apiKey); try { // 1. Find a user const user = await prisma.user.findFirst(); if (!user) { console.error('❌ No users found in database. Cannot create API key.'); return; } console.log('Found user:', user.email, user.id); // 2. Check if key exists const existingKey = await prisma.apiKey.findUnique({ where: { key: apiKey } }); if (existingKey) { console.log('✅ Key already exists (plain text match).'); return; } // 3. Create the key (Plain text for MCP compatibility) // We use the first 7 chars as prefix based on the input const prefix = apiKey.substring(0, 7); await prisma.apiKey.create({ data: { name: 'MCP Server Key', key: apiKey, // Storing plain text to match auth.ts logic keyPrefix: prefix, userId: user.id, status: 'ACTIVE', scopes: ['*'] } }); console.log('✅ Created plain text API key for MCP server!'); } catch (error) { console.error('Error setting up key:', error); } finally { await prisma.$disconnect(); } } setupKey();

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/Amanuel-1/mcp-server'

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