mirror of
https://github.com/alibaba/higress.git
synced 2026-04-21 20:17:29 +08:00
fix: refactored mcp server auto discovery logic and fix some issue (#2382)
Co-authored-by: johnlanni <zty98751@alibaba-inc.com>
This commit is contained in:
@@ -24,12 +24,9 @@ const (
|
||||
IstioMcpAutoGeneratedHttpRouteName = IstioMcpAutoGeneratedPrefix + "-httproute"
|
||||
IstioMcpAutoGeneratedMcpServerName = IstioMcpAutoGeneratedPrefix + "-mcpserver"
|
||||
|
||||
DefaultMcpToolsGroup = "mcp-tools"
|
||||
DefaultMcpCredentialsGroup = "credentials"
|
||||
DefaultNacosServiceNamespace = "public"
|
||||
|
||||
StdioProtocol = "stdio"
|
||||
HttpProtocol = "http"
|
||||
HttpsProtocol = "https"
|
||||
DubboProtocol = "dubbo"
|
||||
McpSSEProtocol = "mcp-sse"
|
||||
McpStreambleProtocol = "mcp-streamble"
|
||||
@@ -39,19 +36,19 @@ type McpToolArgsType string
|
||||
|
||||
// WasmPluginConfig Struct for mcp tool wasm plugin marshal
|
||||
type WasmPluginConfig struct {
|
||||
Rules []*McpServerRule `json:"_rules_"`
|
||||
Rules []*McpServerRule `json:"_rules_,omitempty"`
|
||||
}
|
||||
|
||||
type McpServerRule struct {
|
||||
MatchRoute []string `json:"_match_route_,omitempty"`
|
||||
Server *ServerConfig `json:"server"`
|
||||
Tools []*McpTool `json:"tools"`
|
||||
Server *ServerConfig `json:"server,omitempty"`
|
||||
Tools []*McpTool `json:"tools,omitempty"`
|
||||
AllowTools []string `json:"allowTools,omitempty"`
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
AllowTools []string `json:"allowTools,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Config map[string]interface{} `json:"config,omitempty"`
|
||||
}
|
||||
|
||||
type McpTool struct {
|
||||
@@ -144,13 +141,13 @@ type InputSchema struct {
|
||||
}
|
||||
|
||||
type ToolsMeta struct {
|
||||
InvokeContext map[string]string `json:"InvokeContext,omitempty"`
|
||||
Enabled bool `json:"Enabled,omitempty"`
|
||||
Templates map[string]interface{} `json:"Templates,omitempty"`
|
||||
InvokeContext map[string]string `json:"invokeContext,omitempty"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Templates map[string]interface{} `json:"templates,omitempty"`
|
||||
}
|
||||
|
||||
type JsonGoTemplate struct {
|
||||
RequestTemplate RequestTemplate `json:"requestTemplate"`
|
||||
ResponseTemplate ResponseTemplate `json:"responseTemplate"`
|
||||
RequestTemplate RequestTemplate `json:"requestTemplate,omitempty"`
|
||||
ResponseTemplate ResponseTemplate `json:"responseTemplate,omitempty"`
|
||||
ArgsPosition map[string]string `json:"argsPosition,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user