Skip to main content
Glama
ampcome-mcps

Apify Model Context Protocol Server

by ampcome-mcps
apify-client.ts1.17 kB
import type { ApifyClientOptions } from 'apify'; import { ApifyClient as _ApifyClient } from 'apify-client'; import type { AxiosRequestConfig } from 'axios'; import { USER_AGENT_ORIGIN } from './const.js'; /** * Adds a User-Agent header to the request config. * @param config * @private */ function addUserAgent(config: AxiosRequestConfig): AxiosRequestConfig { const updatedConfig = { ...config }; updatedConfig.headers = updatedConfig.headers ?? {}; updatedConfig.headers['User-Agent'] = `${updatedConfig.headers['User-Agent'] ?? ''}; ${USER_AGENT_ORIGIN}`; return updatedConfig; } export function getApifyAPIBaseUrl(): string { // Workaround for Actor server where the platform APIFY_API_BASE_URL did not work with getActorDefinition from actors.ts if (process.env.APIFY_IS_AT_HOME) return 'https://api.apify.com'; return process.env.APIFY_API_BASE_URL || 'https://api.apify.com'; } export class ApifyClient extends _ApifyClient { constructor(options: ApifyClientOptions) { super({ ...options, baseUrl: getApifyAPIBaseUrl(), requestInterceptors: [addUserAgent], }); } }

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/ampcome-mcps/apify-mcp'

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