config.py•885 B
"""
Configuration constants for the MCP Data Fetch Server.
"""
from pathlib import Path
# Security and Configuration Constants
MAX_CONTENT_LENGTH = 50 * 1024 * 1024 # 50MB
MAX_DOWNLOAD_SIZE = 100 * 1024 * 1024 # 100MB
REQUEST_TIMEOUT = 30
MAX_REDIRECTS = 10
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
# Default directories (sandboxed working directory)
DEFAULT_WORKING_DIR = Path.home() / ".mcp_datafetch"
DEFAULT_CACHE_SUBDIR = "cache" # Relative to working directory
# Blocked domains for security (localhost, private networks)
BLOCKED_DOMAINS = {
'localhost', '127.0.0.1', '0.0.0.0', '::1',
'10.', '172.16.', '192.168.'
}
# Blocked file extensions
BLOCKED_EXTENSIONS = {
'.exe', '.dll', '.bat', '.cmd', '.com', '.pif', '.scr',
'.vbs', '.js', '.jar', '.app', '.deb', '.rpm'
}