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

@@ -0,0 +1,39 @@
#pragma once
#include <afxwin.h>
#include <afxcmn.h>
#include <vector>
// 「MCP设置」配置对话框启用 MCP / 端口 / 绑定地址 / Token。
// 因 2015Remote.rc 为 UTF-16 编码、不宜手工编辑,参照 ZstaPickerDlg 用
// InitModalIndirect + 内存 DLGTEMPLATE 程序化创建(见 docs/Mcp_Design.md §3.8)。
class CMcpSettingsDlg : public CDialog
{
public:
explicit CMcpSettingsDlg(CWnd* parent = nullptr);
virtual INT_PTR DoModal();
protected:
virtual BOOL OnInitDialog();
virtual void OnOK();
DECLARE_MESSAGE_MAP()
private:
enum CtrlId {
IDC_MCP_ENABLE = 1001, // 「启用 MCP」复选框
IDC_MCP_PORT = 1002, // 端口编辑框
IDC_MCP_BIND = 1003, // 绑定地址编辑框
IDC_MCP_TOKEN = 1004, // Token 编辑框
};
CButton m_btnEnable;
CStatic m_lblPort, m_lblBind, m_lblToken;
CEdit m_editPort, m_editBind, m_editToken;
CButton m_btnOK, m_btnCancel;
std::vector<BYTE> m_Template; // 内存 DLGTEMPLATE 字节
void LayoutControls(int cx, int cy);
};