Merge branch 'feat/mcppanel-mcp-server-management-page-and' into dev

This commit is contained in:
AskaEth committed 2026-10-24 19:58:37 +08:00
commit 187eb327d6
16 files changed
+2256 -121

No files matched your search

@@ -63,6 +63,9 @@ type pluginInstallConfig struct {
Args []string `json:"args"`
APIKey string `json:"apiKey"`
Env map[string]string `json:"env"`
// Enabled 是安装时的初始启用态。缺省(nil)=启用;显式 false =装上但先不连
// (配置落盘、工具不注册,之后可由面板「启用」)。
Enabled *bool `json:"enabled"`
}
// AdminInstalledPlugin 是管理列表中一个已安装插件的线上
@@ -78,6 +81,9 @@ type AdminInstalledPlugin struct {
APIKey string `json:"apiKey,omitempty"`
Env map[string]string `json:"env,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
// Enabled 是这一台的启用态(plugins.json 的 `enabled`,缺省视为 true)。
// 停用 ≠ 卸载:条目仍在列表里,只是没连、没注册工具。
Enabled bool `json:"enabled"`
// Live 报告 MCP server 是否已连接、其工具是否已注册。
Live bool `json:"live"`
// ToolCount 是活着的 server 已注册的工具数。
@@ -134,6 +140,7 @@ func (s *Server) adminInstallMCPPlugin(w http.ResponseWriter, r *http.Request, r
Args: req.Config.Args,
APIKey: req.Config.APIKey,
Env: req.Config.Env,
Enabled: req.Config.Enabled,
}.Normalize()
if err := cfg.Validate(); err != nil {
s.auditClaims(r, "plugin.install", "error")
@@ -160,6 +167,7 @@ func (s *Server) adminInstallMCPPlugin(w http.ResponseWriter, r *http.Request, r
"name": res.Config.Name,
"kind": res.Config.Kind,
"transport": res.Config.Transport,
"enabled": res.Config.IsEnabled(),
"toolCount": res.ToolCount,
})
}
@@ -240,6 +248,7 @@ func adminInstalledPluginOf(it pluginmgr.Installed) AdminInstalledPlugin {
APIKey: cfg.APIKey,
Env: cfg.Env,
CreatedAt: cfg.CreatedAt,
Enabled: cfg.IsEnabled(),
Live: it.Live,
ToolCount: it.ToolCount,
}