Feature: Add MCP (Model Context Protocol) server integration
Add an optional MCP server (JSON-RPC 2.0 over Streamable HTTP) exposing an online-host listing tool, protected by a Bearer token. Disabled by default; configured via a new "Extensions > MCP Settings" dialog. - McpServer: httplib + JSON-RPC 2.0 dispatch (initialize/ping/tools/list/tools/call) - McpSettingsDlg: runtime-created dialog for enable/port/bind/token - HostJson: extract single-host JSON serialization shared with WebService - FRP: expose MCP port (union with listening/Web ports) when bound to 0.0.0.0 - i18n: en_US / zh_TW translations Co-Authored-By: deepseek-v4-pro
This commit is contained in:
15
server/2015Remote/HostJson.h
Normal file
15
server/2015Remote/HostJson.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "jsoncpp/json.h"
|
||||
|
||||
class context;
|
||||
class _ClientList;
|
||||
|
||||
// 公共函数:将单台在线主机 context 序列化为 JSON(UTF-8,含 GBK/UTF-8 编码处理)。
|
||||
// 供 Web UI(CWebService::BuildDeviceListJson)与 MCP 工具(list_online_hosts)复用,
|
||||
// 避免两处重复易错的编码转换(见 docs/Mcp_Design.md §3.4 方案 C)。
|
||||
//
|
||||
// 职责边界:本函数只负责「单台主机 → Json::Value」的字段序列化与编码转换。
|
||||
// 分组/用户过滤、m_cs 加锁、外层结构(Web 的 {"cmd","devices"} vs MCP 的 {"hosts"})
|
||||
// 属于调用方,不进本函数。调用方须在 m_cs 锁内调用。
|
||||
Json::Value BuildHostJson(context* ctx, _ClientList* clientMap);
|
||||
Reference in New Issue
Block a user