Skip to main content
Glama
configFactory.ts1.17 kB
import type { MasterConfig, ServerConfig, AuthStrategy } from '../../src/types/config.js' export function makeServerConfig(id: string, endpoint: string, authStrategy: AuthStrategy = 0 as any): ServerConfig { return { id, type: 'local', url: endpoint, auth_strategy: authStrategy || 'bypass_auth', config: { port: new URL(endpoint).port ? Number(new URL(endpoint).port) : undefined }, } } export function makeMasterConfig(params: { servers: Array<{ id: string; endpoint: string }> hosting?: Partial<MasterConfig['hosting']> routing?: MasterConfig['routing'] master_oauth?: Partial<MasterConfig['master_oauth']> }): MasterConfig { const servers: ServerConfig[] = params.servers.map((s) => makeServerConfig(s.id, s.endpoint)) return { master_oauth: { authorization_endpoint: 'http://localhost/authorize', token_endpoint: 'http://localhost/token', client_id: 'local', redirect_uri: 'http://localhost/oauth/callback', scopes: ['openid'], ...(params.master_oauth ?? {}), }, servers, hosting: { platform: 'node', port: 0, ...(params.hosting ?? {}) }, routing: params.routing, } }

Latest Blog Posts

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/Jakedismo/master-mcp-server'

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