Skip to main content
Glama

GenAIScript

Official
by microsoft
MIT License
43
2,820
  • Linux
  • Apple
vars.ts1.02 kB
import { CLI_ENV_VAR_RX } from "../../core/src/constants" import { parseKeyValuePair } from "../../core/src/fence" /** * Parses and combines variables from input and environment variables. * * @param vars - An array of strings representing key-value pairs to parse. * @param env - An object of environment variables with string keys and values. * @returns An object containing the merged key-value pairs from `vars` and environment variables whose keys match the regex, with their keys transformed to lowercase. */ export function parseOptionsVars( vars: string[], env: Record<string, string> ): Record<string, string> { const vals = vars?.reduce((acc, v) => ({ ...acc, ...parseKeyValuePair(v) }), {}) ?? {} const envVals = Object.keys(env) .filter((k) => CLI_ENV_VAR_RX.test(k)) .map((k) => ({ [k.replace(CLI_ENV_VAR_RX, "").toLocaleLowerCase()]: env[k], })) .reduce((acc, v) => ({ ...acc, ...v }), {}) return { ...vals, ...envVals } }

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/microsoft/genaiscript'

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