33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
"""MCP Server 配置(环境变量,生产用 .env 注入)。"""
|
|
import os
|
|
|
|
|
|
def _env(key, default):
|
|
return os.environ.get(key, default)
|
|
|
|
|
|
class Settings:
|
|
# 平台(auto_control)地址与账号
|
|
platform_url = _env("MCP_PLATFORM_URL", "http://127.0.0.1:18050")
|
|
platform_user = _env("MCP_PLATFORM_USER", "admin")
|
|
platform_pass = _env("MCP_PLATFORM_PASS", "")
|
|
|
|
# 安全
|
|
allow_write = _env("MCP_ALLOW_WRITE", "0") == "1" # 写操作门控(默认只读)
|
|
allowed_serials = [s.strip() for s in
|
|
_env("MCP_ALLOWED_SERIALS", "").split(",") if s.strip()] # 空=不限
|
|
|
|
# 传输
|
|
http_host = _env("MCP_HTTP_HOST", "0.0.0.0")
|
|
http_port = int(_env("MCP_HTTP_PORT", "8033"))
|
|
|
|
# 截图
|
|
screenshot_width = int(_env("MCP_SCREENSHOT_WIDTH", "540"))
|
|
jpeg_quality = int(_env("MCP_JPEG_QUALITY", "70"))
|
|
|
|
# 审计
|
|
audit_file = _env("MCP_AUDIT_FILE", "/var/log/mcp/audit.log")
|
|
|
|
# 平台请求超时(秒)
|
|
platform_timeout = float(_env("MCP_PLATFORM_TIMEOUT", "30"))
|