Skip to main content
Glama

My Credentials MCP Server

by preangelleo
connection.ts•1.04 kB
import postgres from "postgres"; let dbInstance: postgres.Sql | null = null; /** * Get database connection singleton * Following the pattern from BASIC-DB-MCP.md but adapted for PostgreSQL with connection pooling */ export function getDb(databaseUrl: string): postgres.Sql { if (!dbInstance) { dbInstance = postgres(databaseUrl, { // Minimal configuration to avoid Cloudflare Workers subrequest limits max: 1, // Only 1 connection to avoid subrequest issues idle_timeout: 30, connect_timeout: 5, // Disable prepared statements to reduce complexity prepare: false, // Disable connection retries connection: { application_name: 'mcp-server' } }); } return dbInstance; } /** * Close database connection pool * Call this when the Durable Object is shutting down */ export async function closeDb(): Promise<void> { if (dbInstance) { try { await dbInstance.end(); } catch (error) { console.error('Error closing database connection:', error); } finally { dbInstance = null; } } }

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/preangelleo/my-credentials-mcp'

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