Skip to main content
Genie Helper uses three MCP (Model Context Protocol) servers to provide the AI agent with 29 specialized tools for data management, LLM inference, and browser automation.

Architecture

MCP servers run as child processes of AnythingLLM and communicate via stdio transport. They auto-boot on AnythingLLM startup via a patched server/utils/boot/index.jsbootMCPServers() call. Configuration: storage/plugins/anythingllm_mcp_servers.json

Directus MCP Server (17 tools)

Script: scripts/directus-mcp-server.mjs Provides CRUD operations for Directus collections, user management, file handling, and flow triggering.

Collections

ToolDescription
list-collectionsList all custom Directus collections (excludes system tables)
get-collection-schemaGet field schema for a collection with types and requirements

Items CRUD

ToolDescription
read-itemsRead items with optional filtering, sorting, pagination, and field selection
read-itemRead a single item by ID (UUID)
create-itemCreate a new item with tier-gating for media_jobs operations
update-itemUpdate an existing item by ID
delete-itemDelete an item from a collection
search-itemsFull-text search across items in a collection

Users

ToolDescription
get-meGet the current authenticated user with full profile fields
list-usersList users with optional filtering (admin operation)
get-userGet a single user by ID with role information
update-userUpdate a user by ID (admin operation)
create-userCreate a new user (requires email, password, role UUID)

Files

ToolDescription
list-filesList files with optional folder filtering and metadata
get-fileGet file metadata and download URL by ID

Flows

ToolDescription
list-flowsList all available Directus Flows with trigger information
trigger-flowTrigger a flow by UUID with optional JSON payload

Tier Gating

The create-item tool includes built-in rate limiting for media_jobs creation:
  • Checks feature access flags (ai_clip_ops, watermark_ops, etc.) against subscription tier
  • Enforces usage quotas by counting user_usage_counts within billing cycle
  • Throws tier_limit: prefixed errors visible to the agent
  • Fails open on unexpected errors to maintain availability

Ollama MCP Server (3 tools)

Script: scripts/ollama-mcp-server.mjs Exposes Ollama’s local LLM inference API for text generation, chat, and model management.
ToolDescription
list-modelsList all locally available Ollama models with size and modified timestamps
generateSingle-turn completion with prompt, optional system message, temperature, and max_tokens
chatMulti-turn chat using messages array with role/content objects

Configuration

  • Default URL: http://127.0.0.1:11434
  • Default model: qwen-2.5:latest (configurable via OLLAMA_MODEL env var)
  • Temperature range: 0-2 (default 0.7)
  • Stream mode: Disabled (all responses are synchronous)

Stagehand MCP Server (9 tools)

Script: scripts/stagehand-mcp-server.mjs Wraps the Stagehand browser automation server (port 3002) for web scraping, platform interactions, and HITL (human-in-the-loop) workflows.

Session Management

ToolDescription
start-sessionStart a new browser session with configurable headless mode, returns session ID
close-sessionEnd and clean up a browser session
ToolDescription
navigateNavigate to a URL in an existing session
actPerform browser actions using natural language (“Click the Login button”)
observeObserve interactive elements on the current page

Data Extraction

ToolDescription
extractExtract structured data using natural language instruction and optional JSON schema
screenshotTake a screenshot of the current browser page (returns base64 or URL)
ToolDescription
get-cookiesGet all cookies from the current browser session
set-cookiesInject cookies for bypassing login (HITL workflow)

Configuration

  • Stagehand URL: http://127.0.0.1:3002
  • Default model: ollama/qwen-2.5 (for vision/element detection)
  • Launch args: Stealth mode enabled (--disable-blink-features=AutomationControlled)
  • Window size: 1920x1080
  • Resource limits: ~300MB RAM per active session, ~33 concurrent sessions ceiling

Error Handling

All tools surface HTTP errors to the agent with status code and error message extraction from Stagehand responses.
  • platform_sessions: Stores encrypted browser cookies captured via extension or HITL
  • hitl_sessions: Human-in-the-loop login requests (triggers yellow dashboard alert)
  • media_jobs: BullMQ job records for scrape, watermark, teaser, publish operations
  • action_flows: Flow definitions consumed by Action Runner (slug → steps JSON)

See Also

Build docs developers (and LLMs) love