Skip to main content
Glama
by microsoft
proxy.ts1.2 kB
import { ProxyAgent } from "undici" import { genaiscriptDebug } from "./debug" const dbg = genaiscriptDebug("proxy") /** * Resolves an HTTP proxy agent based on environment variables. * * This function checks various environment variables to locate * a proxy configuration. If a proxy is found, it returns an * instance of `HttpsProxyAgent` configured with the proxy URL; * otherwise, it returns null. * * Environment variables checked (in order of precedence): * - `GENAISCRIPT_HTTPS_PROXY` * - `GENAISCRIPT_HTTP_PROXY` * - `HTTPS_PROXY` * - `HTTP_PROXY` * - `https_proxy` * - `http_proxy` * * @returns An instance of `HttpsProxyAgent` if a proxy is configured, * or null if no proxy is detected. */ export function resolveHttpProxyAgent() { // We create a proxy based on Node.js environment variables. const proxy = process.env.GENAISCRIPT_HTTPS_PROXY || process.env.GENAISCRIPT_HTTP_PROXY || process.env.HTTPS_PROXY || process.env.HTTP_PROXY || process.env.https_proxy || process.env.http_proxy if (proxy) dbg(`proxy: %s`, proxy) const agent = proxy ? new ProxyAgent(proxy) : null return agent }

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