Feature(mcp): add http_probe for private-network HTTP checks
Run an HTTP/HTTPS request inside a shell on a managed host and return a structured result: status code, headers, body (UTF-8 or base64), size and elapsed time, so interface health on the host or its subnet can be checked without a full remote-control session. The safety boundary is hard-coded on the server, not in the shell script: only http/https and IP literals (or localhost); only loopback and private ranges (127/8, ::1, 10/8, 172.16/12, 192.168/16) are accepted; redirects are not followed; the body is capped at 64KB; TLS certificates are verified. Domain names are refused on purpose - resolving them on the server would probe the wrong network. Windows runs a single-line PowerShell 2.0-compatible script based on HttpWebRequest. Accept/User-Agent/Referer are mapped to their dedicated properties because .NET rejects them through Headers.Add. Linux uses curl with temp files. Payloads cross the terminal channel as 56-character base64 chunks with a declared byte length. ConPTY re-emits the boundary character of lines wider than 80 columns, so single-line base64 arrives corrupted; the length check converts any remaining loss into an explicit error rather than silent garbage. The tool reuses an existing persistent terminal session. Sessions it creates itself are closed after the command and kept only when the probe timed out while still running. Platform gating: Windows and Linux only. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
697044d84b
commit
613aa7291a
3 files changed
+992
-2
No files matched your search
@@ -52,6 +52,8 @@ GATE = {
|
||||
"terminal_open": ("terminal", True, False),
|
||||
"terminal_exec": ("terminal", True, False),
|
||||
"terminal_close": ("terminal", True, False),
|
||||
# http_probe 在主机上跑 shell(Windows PowerShell / Linux curl),与终端族同门控
|
||||
"http_probe": ("terminal", True, False),
|
||||
|
||||
# ---- remote_control ----
|
||||
"remote_open": ("remote_control", True, False),
|
||||
@@ -170,6 +172,9 @@ PLATFORMS = {
|
||||
"terminal_close": _WLA,
|
||||
"exec_command": _WLA,
|
||||
|
||||
# http_probe 走终端通道:macOS 终端未开放;Android 的 toybox 不保证有 curl/base64
|
||||
"http_probe": _WL,
|
||||
|
||||
# macOS 客户端有 COMMAND_KILLPROCESS 分支,但服务端同样拦着(McpServer.cpp:6870)
|
||||
"kill_process": _WL,
|
||||
|
||||
|
||||
Reference in new issue
Block a user