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:
yuanyuanxiang
2026-08-16 13:58:36 +02:00
parent 43398e405e
commit 13052b7cae
17 changed files with 1313 additions and 95 deletions

View File

@@ -171,6 +171,7 @@
#define HIDE_MENU_RELOAD_PLUGINS 0 // 重新加载插件
#define HIDE_MENU_PLUGIN_REQUEST 0 // 插件请求
#define HIDE_MENU_FRPS_FOR_SUB 0 // 下级FRP
#define HIDE_MENU_MCP_SETTINGS 0 // MCP设置
// --- 扩展菜单 - 语言子菜单 ---
#define HIDE_MENU_CHANGE_LANG 0 // 更改语言
@@ -298,6 +299,8 @@
// 用的 master password 解耦——后者一旦泄漏影响面更大,应避免在公网登录
// 时复用。与 Go 服务端的 YAMA_WEB_ADMIN_PASS 语义一致。
#define BRAND_WEB_ENV_VAR "YAMA_WEB_ADMIN_PASS"
// MCP 服务端静态 token 环境变量(优先级高于 settings/McpToken
#define BRAND_MCP_ENV_VAR "YAMA_MCP_TOKEN"
// --- 宽字符版本(自动生成)---
#define BRAND_APP_NAME_W _T(BRAND_APP_NAME)