feat(M0): MCP 手机控制 Server 骨架——FastMCP HTTP 传输(8033),平台登录会话+CSRF 封装,de_list_devices/de_screenshot(图像块)/de_tap/de_swipe,写门控/白名单/审计,实测全链路通过
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""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"))
|
||||
Reference in New Issue
Block a user