# ==============================================================================
# Crawl4AI RAG MCP Client Configuration Template
# ==============================================================================
# Copy this file to .env and configure the settings below for your deployment
#
# Usage:
# 1. Copy this file: cp .env_template.txt .env
# 2. Edit .env with your remote server details
# 3. Start the client: docker compose up -d
#
# WHAT IS CLIENT MODE?
# Client mode runs a lightweight MCP server that forwards all requests to a
# remote REST API server. This is useful for:
# - Running the MCP server close to your LLM (e.g., on your local machine)
# - Connecting to a centralized RAG server with the database and processing
# - Reducing resource usage on the client machine
#
# ==============================================================================
# ------------------------------------------------------------------------------
# CLIENT CONFIGURATION
# ------------------------------------------------------------------------------
# IS_SERVER: Set to false for client deployment mode
# In client mode, this container forwards MCP requests to a remote server
# The remote server handles all crawling, database storage, and processing
# Options: true | false
# IMPORTANT: Must be false for client deployment
IS_SERVER=false
# ------------------------------------------------------------------------------
# REMOTE SERVER CONFIGURATION (REQUIRED FOR CLIENT MODE)
# ------------------------------------------------------------------------------
# REMOTE_API_URL: URL of the remote REST API server
# This is the server that hosts the full RAG system with database and Crawl4AI
# Format: http://IP_ADDRESS:PORT or https://DOMAIN:PORT
# Example: http://192.168.10.50:8080 (local network)
# Example: https://myrag.example.com:8080 (internet)
# REQUIRED: Must point to a running Crawl4AI RAG server
REMOTE_API_URL=http://192.168.10.50:8080
# REMOTE_API_KEY: API key for authenticating with the remote server
# This must match the LOCAL_API_KEY configured on the remote server
# Ask your server administrator for this key
# SECURITY: Keep this key secret! It grants full access to the RAG system
REMOTE_API_KEY=<APIKEY>
# ------------------------------------------------------------------------------
# BLOCKED DOMAIN PROTECTION
# ------------------------------------------------------------------------------
# BLOCKED_DOMAIN_KEYWORD: Secret keyword required to remove blocked domain patterns
# This must match the keyword configured on the remote server
# Used when calling the remove_blocked_domain tool through the MCP server
# Ask your server administrator for this keyword
# NOTE: Changing this requires recreating the container: docker compose down && docker compose up -d
BLOCKED_DOMAIN_KEYWORD=<YourKeyword>
# ------------------------------------------------------------------------------
# LOCAL CLIENT SETTINGS (for compatibility)
# ------------------------------------------------------------------------------
# SERVER_HOST: Local host for the MCP server
# The MCP server will bind to this address on the client machine
# Use localhost for local-only access (recommended)
# Use 0.0.0.0 to accept connections from the local network
# Default: localhost
SERVER_HOST=localhost
# SERVER_PORT: Local port for the MCP server
# Your LLM (e.g., Claude Desktop, LM Studio) will connect to this port
# Default: 3000
# Configure your LLM to use: stdio or http://localhost:3000
SERVER_PORT=3000
# ------------------------------------------------------------------------------
# LOGGING CONFIGURATION
# ------------------------------------------------------------------------------
# LOG_LEVEL: Verbosity of client logs
# Options: DEBUG | INFO | WARNING | ERROR | CRITICAL
# DEBUG: Detailed request/response logging (useful for troubleshooting)
# INFO: General informational messages (recommended)
# WARNING: Warning messages only
# ERROR: Error messages only
# Default: INFO
LOG_LEVEL=INFO
# ==============================================================================
# ADDITIONAL NOTES
# ==============================================================================
#
# 1. CLIENT VS SERVER MODE:
# Client mode is a lightweight forwarder:
# - Exposes MCP server interface locally
# - Forwards all requests to remote REST API
# - No database or Crawl4AI service needed
# - Minimal resource usage
#
# 2. NETWORK REQUIREMENTS:
# - The client must be able to reach REMOTE_API_URL
# - Check firewall rules if connection fails
# - Test connectivity: curl http://REMOTE_API_URL/health
#
# 3. LLM CONFIGURATION:
# Configure your LLM to use the MCP server:
#
# For Claude Desktop (config.json):
# {
# "mcpServers": {
# "crawl4ai-rag": {
# "command": "docker",
# "args": ["exec", "-i", "crawl4ai-rag-client", "python", "-m", "core.rag_processor"]
# }
# }
# }
#
# For LM Studio:
# - Server URL: http://localhost:3000 (or your SERVER_PORT)
# - Protocol: MCP over HTTP
#
# 4. AVAILABLE MCP TOOLS:
# When connected, your LLM will have access to these tools:
# - crawl_url: Fetch and process a single URL
# - crawl_and_remember: Crawl a URL and store in knowledge base
# - deep_crawl: Recursively crawl a website
# - ask: Query the knowledge base using semantic search
# - list_memory: List stored content
# - list_domains: List unique domains in knowledge base
# - forget_url: Remove specific content
# - clear_temp_memory: Clear temporary session content
# - db_stats: Get database statistics
# - add_blocked_domain: Add domain to blocklist (admin)
# - remove_blocked_domain: Remove domain from blocklist (requires keyword)
# - list_blocked_domains: View blocked domains
#
# 5. SECURITY CONSIDERATIONS:
# - The client has full access to the remote server via REMOTE_API_KEY
# - Protect this .env file from unauthorized access
# - Use HTTPS for REMOTE_API_URL in production
# - Keep BLOCKED_DOMAIN_KEYWORD and REMOTE_API_KEY secret
#
# 6. TROUBLESHOOTING:
# Connection errors:
# - Verify REMOTE_API_URL is correct and accessible
# - Check that remote server is running: curl http://REMOTE_API_URL/health
# - Verify REMOTE_API_KEY matches server's LOCAL_API_KEY
#
# Authentication errors:
# - REMOTE_API_KEY must match the server's LOCAL_API_KEY exactly
# - Check for extra spaces or quotes in the key
#
# Container won't start:
# - Check logs: docker compose logs -f
# - Verify .env file syntax (no spaces around =)
#
# 7. CHANGING CONFIGURATION:
# To apply changes to .env:
# docker compose down && docker compose up -d
#
# ==============================================================================