Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ You can refer to the specific Actor's documentation for a list of available argu
### Helper tools
One of the powerful features of MCP with Apify is dynamic actor tooling – the ability for an AI agent to find new tools (Actors) as needed and incorporate them. Here are some special MCP operations and how Apify MCP Server supports them:

- Actor discovery and management: Search for Actors (`search-actors`), view details (`get-actor-details`), and dynamically add or remove tools (`add-actor`, `remove-actor`).
- Actor execution and monitoring: Start Actor runs, fetch run results (`get-actor-run`), logs (`get-actor-log`), and abort runs (`abort-actor-run`).
- Dataset access: List datasets, retrieve dataset info and items (`get-dataset`, `get-dataset-list`, `get-dataset-items`).
- Key-value store access: List key-value stores, view keys, and retrieve records (`get-key-value-store-list`, `get-key-value-store`, `get-key-value-store-keys`, `get-key-value-store-record`).
- Actor discovery and management: Search for Actors (`search-actors`), view details (`get-actor-details`), and dynamically add them (`add-actor`).
- Apify documentation: Search Apify documentation (`search-apify-docs`) and fetch specific documents (`fetch-apify-docs`).
- Built-in help tool: A static helper (`apify-actor-help-tool`) that returns usage info for the Apify MCP Server.

## Prompt & Resources
Expand Down
228 changes: 228 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@
"@apify/datastructures": "^2.0.3",
"@apify/log": "^2.5.16",
"@modelcontextprotocol/sdk": "^1.13.2",
"@types/turndown": "^5.0.5",
"ajv": "^8.17.1",
"algoliasearch": "^5.31.0",
"apify": "^3.4.2",
"apify-client": "^2.12.6",
"express": "^4.21.2",
"turndown": "^7.2.0",
"yargs": "^17.7.2",
"zod": "^3.24.1",
"zod-to-json-schema": "^3.24.1"
Expand Down
11 changes: 11 additions & 0 deletions src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export enum HelperTools {
KEY_VALUE_STORE_RECORD_GET = 'get-key-value-store-record',
APIFY_MCP_HELP_TOOL = 'apify-actor-help-tool',
STORE_SEARCH = 'search-actors',
DOCS_SEARCH = 'search-apify-docs',
DOCS_FETCH = 'fetch-apify-docs',
}

export const defaults = {
Expand All @@ -49,8 +51,11 @@ export const ACTOR_OUTPUT_TRUNCATED_MESSAGE = `Output was truncated because it w

export const ACTOR_ADDITIONAL_INSTRUCTIONS = 'Never call/execute tool/Actor unless confirmed by the user.';

// 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 ACTOR_PRICING_MODEL = {
/** Rental actors */
Expand All @@ -69,3 +74,9 @@ export const ACTOR_PRICING_MODEL = {
export const ACTOR_SEARCH_ABOVE_LIMIT = 50;

export const MCP_STREAMABLE_ENDPOINT = '/mcp';

export const ALGOLIA = {
appId: 'N8EOCSBQGH',
apiKey: 'e97714a64e2b4b8b8fe0b01cd8592870', // search only (public) API key
indexName: 'test_test_apify_sdk',
};
7 changes: 5 additions & 2 deletions src/state.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ACTOR_CACHE_MAX_SIZE, ACTOR_CACHE_TTL_SECS } from './const.js';
import type { ActorDefinitionPruned } from './types.js';
import { ACTOR_CACHE_MAX_SIZE, ACTOR_CACHE_TTL_SECS, APIFY_DOCS_CACHE_MAX_SIZE, APIFY_DOCS_CACHE_TTL_SECS } from './const.js';
import type { ActorDefinitionPruned, ApifyDocsSearchResult } from './types.js';
import { TTLLRUCache } from './utils/ttl-lru.js';

export const actorDefinitionPrunedCache = new TTLLRUCache<ActorDefinitionPruned>(ACTOR_CACHE_MAX_SIZE, ACTOR_CACHE_TTL_SECS);
export const searchApifyDocsCache = new TTLLRUCache<ApifyDocsSearchResult[]>(APIFY_DOCS_CACHE_MAX_SIZE, APIFY_DOCS_CACHE_TTL_SECS);
/** Stores processed Markdown content */
export const fetchApifyDocsCache = new TTLLRUCache<string>(APIFY_DOCS_CACHE_MAX_SIZE, APIFY_DOCS_CACHE_TTL_SECS);
Loading