Skip to main content
Glama
testEnv.ts1.46 kB
import dotenv from 'dotenv'; import { existsSync } from 'fs'; import { ProcessEnvEx } from '../types/process-env.js'; import { Datasource, getDatasource, getWorkbook, Workbook } from './constants.js'; type EnvValues = Record<keyof ProcessEnvEx, string>; export function setEnv(): void { if (existsSync('.env')) { throw new Error( 'Please remove or rename the .env file at the base of the project before running the tests.', ); } dotenv.config({ path: 'tests/.env', override: true }); } export function resetEnv(): void { dotenv.config({ path: 'tests/.env.reset', override: true }); } export function getEnv(envKeys: Array<keyof ProcessEnvEx>): EnvValues { return envKeys.reduce( (acc, key) => { acc[key] = process.env[key] ?? ''; return acc; }, {} as Record<keyof ProcessEnvEx, string>, ); } export function getDefaultEnv(): EnvValues { return getEnv([ 'SERVER', 'SITE_NAME', 'AUTH', 'JWT_SUB_CLAIM', 'CONNECTED_APP_CLIENT_ID', 'CONNECTED_APP_SECRET_ID', 'CONNECTED_APP_SECRET_VALUE', ]); } export function getSuperstoreDatasource(env?: EnvValues): Datasource { const { SERVER, SITE_NAME } = env ?? getDefaultEnv(); return getDatasource(SERVER, SITE_NAME, 'Superstore Datasource'); } export function getSuperstoreWorkbook(env?: EnvValues): Workbook { const { SERVER, SITE_NAME } = env ?? getDefaultEnv(); return getWorkbook(SERVER, SITE_NAME, 'Superstore'); }

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/datalabs89/tableau-mcp'

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