// Actor input const
export const ACTOR_README_MAX_LENGTH = 5_000;
// Actor enum property max length, we need to make sure that most of the enum values fit into the input (such as geocodes)
export const ACTOR_ENUM_MAX_LENGTH = 2000;
export const ACTOR_MAX_DESCRIPTION_LENGTH = 500;
// Actor run const
export const ACTOR_MAX_MEMORY_MBYTES = 4_096; // If the Actor requires 8GB of memory, free users can't run actors-mcp-server and requested Actor
// Tool output
/**
* Usual tool output limit is 25k tokens where 1 token =~ 4 characters
* thus 50k chars so we have some buffer because there was some issue with Claude code Actor call output token count.
* This is primarily used for Actor tool call output, but we can then
* reuse this in other tools as well.
*/
export const TOOL_MAX_OUTPUT_CHARS = 50000;
// MCP Server
export const SERVER_NAME = 'apify-mcp-server';
export const SERVER_TITLE = 'Apify MCP Server';
export const SERVER_VERSION = '1.0.0';
// User agent headers
export const USER_AGENT_ORIGIN = 'Origin/mcp-server';
export enum HelperTools {
ACTOR_ADD = 'add-actor',
ACTOR_CALL = 'call-actor',
ACTOR_GET_DETAILS = 'fetch-actor-details',
ACTOR_GET_DETAILS_INTERNAL = 'fetch-actor-details-internal',
ACTOR_OUTPUT_GET = 'get-actor-output',
ACTOR_RUNS_ABORT = 'abort-actor-run',
ACTOR_RUNS_GET = 'get-actor-run',
ACTOR_RUNS_LOG = 'get-actor-log',
ACTOR_RUN_LIST_GET = 'get-actor-run-list',
DATASET_GET = 'get-dataset',
DATASET_LIST_GET = 'get-dataset-list',
DATASET_GET_ITEMS = 'get-dataset-items',
DATASET_SCHEMA_GET = 'get-dataset-schema',
KEY_VALUE_STORE_LIST_GET = 'get-key-value-store-list',
KEY_VALUE_STORE_GET = 'get-key-value-store',
KEY_VALUE_STORE_KEYS_GET = 'get-key-value-store-keys',
KEY_VALUE_STORE_RECORD_GET = 'get-key-value-store-record',
STORE_SEARCH = 'search-actors',
STORE_SEARCH_INTERNAL = 'search-actors-internal',
DOCS_SEARCH = 'search-apify-docs',
DOCS_FETCH = 'fetch-apify-docs',
GET_HTML_SKELETON = 'get-html-skeleton',
}
export const RAG_WEB_BROWSER = 'apify/rag-web-browser';
export const RAG_WEB_BROWSER_WHITELISTED_FIELDS = ['query', 'maxResults', 'outputFormats'];
export const RAG_WEB_BROWSER_ADDITIONAL_DESC = `Use this tool when user wants to GET or RETRIEVE actual data immediately (one-time data retrieval).
This tool directly fetches and returns data - it does NOT just find tools.
Examples of when to use:
- User wants current/immediate data (e.g., "Get flight prices for tomorrow", "What's the weather today?")
- User needs to fetch specific content now (e.g., "Fetch news articles from CNN", "Get product info from Amazon")
- User has time indicators like "today", "current", "latest", "recent", "now"
This is for general web scraping and immediate data needs. For repeated/scheduled scraping of specific platforms (e-commerce, social media), consider suggesting a specialized Actor from the Store for better performance and reliability.`;
export const defaults = {
actors: [
RAG_WEB_BROWSER,
],
};
export const SKYFIRE_MIN_CHARGE_USD = 5.0;
export const SKYFIRE_SELLER_ID = process.env.SKYFIRE_SELLER_SERVICE_ID;
export const SKYFIRE_TOOL_INSTRUCTIONS = `To run the Actor, you need to provide a Skyfire PAY JWT token in the \`skyfire-pay-id\` input property. You first need to create the Skyfire PAY token by calling the \`create-pay-token\` tool from the Skyfire MCP server and then provide the created JWT token in the \`skyfire-pay-id\` input property when calling Actor tool. IMPORTANT: The value you pass to \`skyfire-pay-id\` must be the JWT token string itself (it starts with "ey"), NOT an ID or UUID. The Skyfire PAY token is used for billing purposes and needs to be charged with at least ${SKYFIRE_MIN_CHARGE_USD} USD.${SKYFIRE_SELLER_ID ? ` The Skyfire seller ID for Apify MCP server is "${SKYFIRE_SELLER_ID}".` : ''} When retrieving Actor output using the \`get-actor-output\` tool, you also need to provide the same Skyfire PAY JWT token (starting with "ey") in the \`skyfire-pay-id\` input property.`;
export const SKYFIRE_PAY_ID_PROPERTY_DESCRIPTION = `Skyfire PAY JWT token used for billing purposes. This must be the JWT token string returned by the create-pay-token tool (starts with "ey"), NOT a token ID or UUID.`;
export const SKYFIRE_README_CONTENT = `The Apify MCP Server allows clients to interact with Apify Actors, storage, and documentation. Before running any Apify Actor, you need to set up a Skyfire PAY token for billing purposes. To set up the PAY token you need to use the create-pay-token tool from the Skyfire MCP server. The PAY token must be charged with a minimum of ${SKYFIRE_MIN_CHARGE_USD} USD to be valid.${SKYFIRE_SELLER_ID ? ` The Skyfire seller ID for Apify MCP server is "${SKYFIRE_SELLER_ID}".` : ''} When running an Actor using the call-actor tool, you must provide the Skyfire PAY JWT token in the \`skyfire-pay-id\` input property. IMPORTANT: The value for \`skyfire-pay-id\` must be the actual JWT token string (starting with "ey") returned by the create-pay-token tool, NOT a token ID or UUID. Similarly, when retrieving Actor output using the get-actor-output tool, you must also provide the same Skyfire PAY JWT token (starting with "ey") in the \`skyfire-pay-id\` input property.`;
/**
* Set of internal tool names that require Skyfire PAY token ID in Skyfire mode.
* These tools interact with Actor runs, datasets, or key-value stores and need billing support.
*/
export const SKYFIRE_ENABLED_TOOLS = new Set([
HelperTools.ACTOR_CALL,
HelperTools.ACTOR_OUTPUT_GET,
HelperTools.ACTOR_RUNS_GET,
HelperTools.ACTOR_RUNS_LOG,
HelperTools.ACTOR_RUNS_ABORT,
HelperTools.DATASET_GET,
HelperTools.DATASET_GET_ITEMS,
HelperTools.DATASET_SCHEMA_GET,
HelperTools.KEY_VALUE_STORE_GET,
HelperTools.KEY_VALUE_STORE_KEYS_GET,
HelperTools.KEY_VALUE_STORE_RECORD_GET,
]);
export const CALL_ACTOR_MCP_MISSING_TOOL_NAME_MSG = `When calling an MCP server Actor, you must specify the tool name in the actor parameter as "{actorName}:{toolName}" in the "actor" input property.`;
// Cache
export const ACTOR_CACHE_MAX_SIZE = 500;
export const ACTOR_CACHE_TTL_SECS = 30 * 60; // 30 minutes
export const APIFY_DOCS_CACHE_MAX_SIZE = 500;
export const APIFY_DOCS_CACHE_TTL_SECS = 60 * 60; // 1 hour
export const GET_HTML_SKELETON_CACHE_TTL_SECS = 5 * 60; // 5 minutes
export const GET_HTML_SKELETON_CACHE_MAX_SIZE = 200;
export const MCP_SERVER_CACHE_MAX_SIZE = 500;
export const MCP_SERVER_CACHE_TTL_SECS = 30 * 60; // 30 minutes
export const USER_CACHE_MAX_SIZE = 200;
export const USER_CACHE_TTL_SECS = 60 * 60; // 1 hour
export const ACTOR_PRICING_MODEL = {
/** Rental Actors */
FLAT_PRICE_PER_MONTH: 'FLAT_PRICE_PER_MONTH',
FREE: 'FREE',
/** Pay per result (PPR) Actors */
PRICE_PER_DATASET_ITEM: 'PRICE_PER_DATASET_ITEM',
/** Pay per event (PPE) Actors */
PAY_PER_EVENT: 'PAY_PER_EVENT',
} as const;
/**
* Used in search Actors tool to search above the input supplied limit,
* so we can safely filter out rental Actors from the search and ensure we return some results.
*/
export const ACTOR_SEARCH_ABOVE_LIMIT = 50;
export const MCP_STREAMABLE_ENDPOINT = '/mcp';
export const DOCS_SOURCES = [
{
id: 'apify',
label: 'Apify',
appId: 'N8EOCSBQGH',
apiKey: 'e97714a64e2b4b8b8fe0b01cd8592870',
indexName: 'test_test_apify_sdk',
filters: 'version:latest',
description:
'Apify Platform documentation including: Platform features, SDKs (JS, Python), CLI, '
+ 'REST API, Academy (web scraping fundamentals), Actor development and deployment',
},
{
id: 'crawlee-js',
label: 'Crawlee (JavaScript)',
appId: '5JC94MPMLY',
apiKey: '267679200b833c2ca1255ab276731869',
indexName: 'crawlee',
typeFilter: 'lvl1', // Filter to page-level results only (Docusaurus lvl1)
facetFilters: ['language:en', ['docusaurus_tag:default', 'docusaurus_tag:docs-default-3.15']],
description:
'Crawlee is a web scraping library for JavaScript. '
+ 'It handles blocking, crawling, proxies, and browsers for you.',
},
{
id: 'crawlee-py',
label: 'Crawlee (Python)',
appId: '5JC94MPMLY',
apiKey: '878493fcd7001e3c179b6db6796a999b',
indexName: 'crawlee_python',
typeFilter: 'lvl1', // Filter to page-level results only (Docusaurus lvl1)
facetFilters: ['language:en', ['docusaurus_tag:docs-default-current']],
description:
'Crawlee is a web scraping library for Python. '
+ 'It handles blocking, crawling, proxies, and browsers for you.',
},
] as const;
export const ALLOWED_DOC_DOMAINS = [
'https://docs.apify.com',
'https://crawlee.dev',
] as const;
export const PROGRESS_NOTIFICATION_INTERVAL_MS = 5_000; // 5 seconds
export const APIFY_STORE_URL = 'https://apify.com';
export const APIFY_FAVICON_URL = `${APIFY_STORE_URL}/favicon.ico`;
export const APIFY_MCP_URL = 'https://mcp.apify.com';
export const APIFY_DOCS_MCP_URL = 'https://docs.apify.com/platform/integrations/mcp';
// Telemetry
export const TELEMETRY_ENV = {
DEV: 'DEV',
PROD: 'PROD',
} as const;
export const DEFAULT_TELEMETRY_ENABLED = true;
export const DEFAULT_TELEMETRY_ENV = TELEMETRY_ENV.PROD;
// We are using the same values as apify-core for consistency (despite that we ship events of different types).
// https://github.com/apify/apify-core/blob/2284766c122c6ac5bc4f27ec28051f4057d6f9c0/src/packages/analytics/src/server/segment.ts#L28
// Reasoning from the apify-core:
// Flush at 50 events to avoid sending too many small requests (default is 15)
export const SEGMENT_FLUSH_AT_EVENTS = 50;
// Flush interval in milliseconds (default is 10000)
export const SEGMENT_FLUSH_INTERVAL_MS = 5_000;
// Tool status
/**
* Unified status constants for tool execution lifecycle.
* Single source of truth for all tool status values.
*/
export const TOOL_STATUS = {
SUCCEEDED: 'SUCCEEDED',
FAILED: 'FAILED',
ABORTED: 'ABORTED',
SOFT_FAIL: 'SOFT_FAIL',
} as const;
// Modes that allow long running task tool executions
export const ALLOWED_TASK_TOOL_EXECUTION_MODES = ['optional', 'required'] as const;