Skip to main content
Glama

PostgreSQL MCP Server

by sreedhag
env.ts1.04 kB
import dotenv from "dotenv"; import { connect } from "node:http2"; dotenv.config(); export function getEnvVar(name: string): string { const value = process.env[name]; if (value === undefined || value === null) { throw new Error(`${name} is not defined`); } if (typeof value !== "string") { throw new Error(`${name} must be a string`); } return value; } const postgres = process.env["POSTGRES_URL"] ? { connectionString: getEnvVar("POSTGRES_URL") } : { username: getEnvVar("POSTGRES_USERNAME"), password: getEnvVar("POSTGRES_PASSWORD"), host: getEnvVar("POSTGRES_HOST"), port: parseInt(process.env.POSTGRES_PORT || "5432", 10), database: getEnvVar("POSTGRES_DATABASE"), }; export const config = { postgres, server: { port: parseInt(process.env.PORT || "3000", 10), host: process.env.HOST || "0.0.0.0", corsOrigins: process.env.CORS_ORIGIN ? process.env.CORS_ORIGIN.split(",") : ["http://localhost:8080", "http://localhost:3000"], }, };

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/sreedhag/postgres-mcp-server'

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