Skip to main content
Glama
package-manager.ts2.08 kB
import { CommandOutput, execPromise, fileSystemUtils, spawnWithKill, } from '@activepieces/server-shared' import { tryCatch } from '@activepieces/shared' import dayjs from 'dayjs' import { FastifyBaseLogger } from 'fastify' export const packageManager = (log: FastifyBaseLogger) => ({ async install({ path, filtersPath }: InstallParams): Promise<CommandOutput> { const args = [ '--ignore-scripts', '--linker isolated', ] const filters: string[] = filtersPath .map(sanitizeFilterPath) .map((path) => `--filter ./${path}`) await fileSystemUtils.threadSafeMkdir(path) log.debug({ path, args, filters }, '[PackageManager#install]') const { error, data } = await tryCatch(async () => spawnWithKill({ cmd: `bun install ${args.join(' ')} ${filters.join(' ')}`, options: { cwd: path, }, printOutput: false, timeoutMs: dayjs.duration(10, 'minutes').asMilliseconds(), })) if (error) { log.error({ error }, '[PackageManager#install] Failed to install dependencies') throw error } return data }, async build({ path, entryFile, outputFile }: BuildParams): Promise<CommandOutput> { const config = [ `${entryFile}`, '--target node', '--production', '--format cjs', `--outfile ${outputFile}`, ] log.debug({ path, entryFile, outputFile, config }, '[PackageManager#build]') return execPromise(`bun build ${config.join(' ')}`, { cwd: path }) }, }) const sanitizeFilterPath = (filterPath: string): string => { const allowed = /^(?![.])[a-zA-Z0-9\-_.@/]+$/ if (!allowed.test(filterPath)) { throw new Error(`Invalid filter path ${filterPath}`) } return filterPath } type InstallParams = { path: string filtersPath: string[] } type BuildParams = { path: string entryFile: string outputFile: string }

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/activepieces/activepieces'

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