Files
SimpleRemoter/server/2015Remote/HostJson.h
yuanyuanxiang 13052b7cae 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
2026-08-16 14:37:11 +02:00

16 lines
730 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "jsoncpp/json.h"
class context;
class _ClientList;
// 公共函数:将单台在线主机 context 序列化为 JSONUTF-8含 GBK/UTF-8 编码处理)。
// 供 Web UICWebService::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);