Alanxtl commented on code in PR #757:
URL: https://github.com/apache/dubbo-go-pixiu/pull/757#discussion_r2336397769


##########
pkg/model/mcpserver.go:
##########
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package model
+
+import (
+       "regexp"
+       "time"
+)
+
+// McpServerConfig MCP Server Filter configuration
+type McpServerConfig struct {
+       ServerInfo        ServerInfo               `yaml:"server_info" 
json:"server_info"`
+       Endpoint          string                   `yaml:"endpoint" 
json:"endpoint" default:"/mcp"`
+       Tools             []ToolConfig             `yaml:"tools,omitempty" 
json:"tools,omitempty"`
+       Resources         []ResourceConfig         `yaml:"resources,omitempty" 
json:"resources,omitempty"`
+       ResourceTemplates []ResourceTemplateConfig 
`yaml:"resource_templates,omitempty" json:"resource_templates,omitempty"`
+       Prompts           []PromptConfig           `yaml:"prompts,omitempty" 
json:"prompts,omitempty"`
+}
+
+// ServerInfo server information
+type ServerInfo struct {
+       Name         string `yaml:"name" json:"name" default:"Pixiu MCP Server"`
+       Version      string `yaml:"version" json:"version" default:"1.0.0"`
+       Description  string `yaml:"description,omitempty" 
json:"description,omitempty" default:"MCP Server powered by Apache 
Dubbo-go-pixiu"`
+       Instructions string `yaml:"instructions,omitempty" 
json:"instructions,omitempty" default:"Use the provided tools to interact with 
backend services."`
+}
+
+// ToolConfig tool configuration
+type ToolConfig struct {
+       Name        string        `yaml:"name" json:"name"`
+       Description string        `yaml:"description" json:"description"`
+       Cluster     string        `yaml:"cluster" json:"cluster"`
+       BackendURL  string        `yaml:"backend_url,omitempty" 
json:"backend_url,omitempty"`
+       Request     RequestConfig `yaml:"request" json:"request"`
+       Args        []ArgConfig   `yaml:"args,omitempty" json:"args,omitempty"`
+}
+
+// RequestConfig request configuration
+type RequestConfig struct {
+       Method  string            `yaml:"method" json:"method" default:"GET"`
+       Path    string            `yaml:"path" json:"path"`
+       Headers map[string]string `yaml:"headers,omitempty" 
json:"headers,omitempty"`
+       Timeout string            `yaml:"timeout,omitempty" 
json:"timeout,omitempty" default:"30s"`
+}
+
+// ArgConfig parameter configuration (simplified)
+type ArgConfig struct {
+       Name        string   `yaml:"name" json:"name"`
+       Type        string   `yaml:"type" json:"type" default:"string"`
+       In          string   `yaml:"in" json:"in"`
+       Description string   `yaml:"description,omitempty" 
json:"description,omitempty"`
+       Required    bool     `yaml:"required,omitempty" 
json:"required,omitempty"`
+       Default     any      `yaml:"default,omitempty" json:"default,omitempty"`
+       Enum        []string `yaml:"enum,omitempty" json:"enum,omitempty"`
+}
+
+// ResourceConfig resource configuration
+type ResourceConfig struct {
+       Name        string         `yaml:"name" json:"name"`
+       URI         string         `yaml:"uri" json:"uri"`
+       Description string         `yaml:"description,omitempty" 
json:"description,omitempty"`
+       MIMEType    string         `yaml:"mime_type,omitempty" 
json:"mime_type,omitempty"`
+       Source      ResourceSource `yaml:"source" json:"source"`
+}
+
+// ResourceSource resource source configuration (simplified)
+type ResourceSource struct {
+       Type     string `yaml:"type" json:"type"`
+       Path     string `yaml:"path,omitempty" json:"path,omitempty"`         
// for file type
+       URL      string `yaml:"url,omitempty" json:"url,omitempty"`           
// for url type
+       Content  string `yaml:"content,omitempty" json:"content,omitempty"`   
// for inline type
+       Template string `yaml:"template,omitempty" json:"template,omitempty"` 
// for template type
+}
+
+// ResourceTemplateConfig resource template configuration
+type ResourceTemplateConfig struct {
+       Name        string                       `yaml:"name" json:"name"`
+       URITemplate string                       `yaml:"uri_template" 
json:"uri_template"`
+       Title       string                       `yaml:"title,omitempty" 
json:"title,omitempty"`
+       Description string                       `yaml:"description,omitempty" 
json:"description,omitempty"`
+       MIMEType    string                       `yaml:"mime_type,omitempty" 
json:"mime_type,omitempty"`
+       Parameters  []ResourceTemplateParameter  `yaml:"parameters,omitempty" 
json:"parameters,omitempty"`
+       Annotations *ResourceTemplateAnnotations `yaml:"annotations,omitempty" 
json:"annotations,omitempty"`
+}
+
+// ResourceTemplateParameter resource template parameter
+type ResourceTemplateParameter struct {
+       Name        string   `yaml:"name" json:"name"`
+       Type        string   `yaml:"type" json:"type" default:"string"`
+       Description string   `yaml:"description,omitempty" 
json:"description,omitempty"`
+       Required    bool     `yaml:"required,omitempty" 
json:"required,omitempty" default:"false"`
+       Enum        []string `yaml:"enum,omitempty" json:"enum,omitempty"`
+       Default     any      `yaml:"default,omitempty" json:"default,omitempty"`
+}
+
+// ResourceTemplateAnnotations resource template annotations
+type ResourceTemplateAnnotations struct {
+       Audience     []string `yaml:"audience,omitempty" 
json:"audience,omitempty"`
+       Priority     *float64 `yaml:"priority,omitempty" 
json:"priority,omitempty"`
+       LastModified string   `yaml:"last_modified,omitempty" 
json:"last_modified,omitempty"`
+}
+
+// ComputedParameter computed parameter (for internal processing, simplified)
+type ComputedParameter struct {
+       Name        string
+       Type        string
+       In          string
+       Description string
+       Required    bool
+       Enum        []string
+       Default     any
+}
+
+// PromptConfig prompt configuration
+type PromptConfig struct {
+       Name        string                 `yaml:"name" json:"name"`
+       Title       string                 `yaml:"title,omitempty" 
json:"title,omitempty"`
+       Description string                 `yaml:"description,omitempty" 
json:"description,omitempty"`
+       Arguments   []PromptArgumentConfig `yaml:"arguments,omitempty" 
json:"arguments,omitempty"`
+       Messages    []PromptMessageConfig  `yaml:"messages" json:"messages"`
+}
+
+// PromptArgumentConfig prompt argument configuration
+type PromptArgumentConfig struct {
+       Name        string `yaml:"name" json:"name"`
+       Description string `yaml:"description,omitempty" 
json:"description,omitempty"`
+       Required    bool   `yaml:"required,omitempty" json:"required,omitempty"`
+}
+
+// PromptMessageConfig prompt message configuration
+type PromptMessageConfig struct {
+       Role    string `yaml:"role" json:"role"` // "user" or "assistant"
+       Content string `yaml:"content" json:"content"`
+}
+
+// RegistryConfig 注册表配置

Review Comment:
   Use English



##########
pkg/model/mcpserver.go:
##########
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package model
+
+import (
+       "regexp"
+       "time"
+)
+
+// McpServerConfig MCP Server Filter configuration
+type McpServerConfig struct {
+       ServerInfo        ServerInfo               `yaml:"server_info" 
json:"server_info"`
+       Endpoint          string                   `yaml:"endpoint" 
json:"endpoint" default:"/mcp"`
+       Tools             []ToolConfig             `yaml:"tools,omitempty" 
json:"tools,omitempty"`
+       Resources         []ResourceConfig         `yaml:"resources,omitempty" 
json:"resources,omitempty"`
+       ResourceTemplates []ResourceTemplateConfig 
`yaml:"resource_templates,omitempty" json:"resource_templates,omitempty"`
+       Prompts           []PromptConfig           `yaml:"prompts,omitempty" 
json:"prompts,omitempty"`
+}
+
+// ServerInfo server information
+type ServerInfo struct {
+       Name         string `yaml:"name" json:"name" default:"Pixiu MCP Server"`
+       Version      string `yaml:"version" json:"version" default:"1.0.0"`
+       Description  string `yaml:"description,omitempty" 
json:"description,omitempty" default:"MCP Server powered by Apache 
Dubbo-go-pixiu"`
+       Instructions string `yaml:"instructions,omitempty" 
json:"instructions,omitempty" default:"Use the provided tools to interact with 
backend services."`
+}
+
+// ToolConfig tool configuration
+type ToolConfig struct {
+       Name        string        `yaml:"name" json:"name"`
+       Description string        `yaml:"description" json:"description"`
+       Cluster     string        `yaml:"cluster" json:"cluster"`
+       BackendURL  string        `yaml:"backend_url,omitempty" 
json:"backend_url,omitempty"`
+       Request     RequestConfig `yaml:"request" json:"request"`
+       Args        []ArgConfig   `yaml:"args,omitempty" json:"args,omitempty"`
+}
+
+// RequestConfig request configuration
+type RequestConfig struct {
+       Method  string            `yaml:"method" json:"method" default:"GET"`
+       Path    string            `yaml:"path" json:"path"`
+       Headers map[string]string `yaml:"headers,omitempty" 
json:"headers,omitempty"`
+       Timeout string            `yaml:"timeout,omitempty" 
json:"timeout,omitempty" default:"30s"`
+}
+
+// ArgConfig parameter configuration (simplified)
+type ArgConfig struct {
+       Name        string   `yaml:"name" json:"name"`
+       Type        string   `yaml:"type" json:"type" default:"string"`
+       In          string   `yaml:"in" json:"in"`
+       Description string   `yaml:"description,omitempty" 
json:"description,omitempty"`
+       Required    bool     `yaml:"required,omitempty" 
json:"required,omitempty"`
+       Default     any      `yaml:"default,omitempty" json:"default,omitempty"`
+       Enum        []string `yaml:"enum,omitempty" json:"enum,omitempty"`
+}
+
+// ResourceConfig resource configuration
+type ResourceConfig struct {
+       Name        string         `yaml:"name" json:"name"`
+       URI         string         `yaml:"uri" json:"uri"`
+       Description string         `yaml:"description,omitempty" 
json:"description,omitempty"`
+       MIMEType    string         `yaml:"mime_type,omitempty" 
json:"mime_type,omitempty"`
+       Source      ResourceSource `yaml:"source" json:"source"`
+}
+
+// ResourceSource resource source configuration (simplified)
+type ResourceSource struct {
+       Type     string `yaml:"type" json:"type"`
+       Path     string `yaml:"path,omitempty" json:"path,omitempty"`         
// for file type
+       URL      string `yaml:"url,omitempty" json:"url,omitempty"`           
// for url type
+       Content  string `yaml:"content,omitempty" json:"content,omitempty"`   
// for inline type
+       Template string `yaml:"template,omitempty" json:"template,omitempty"` 
// for template type
+}
+
+// ResourceTemplateConfig resource template configuration
+type ResourceTemplateConfig struct {
+       Name        string                       `yaml:"name" json:"name"`
+       URITemplate string                       `yaml:"uri_template" 
json:"uri_template"`
+       Title       string                       `yaml:"title,omitempty" 
json:"title,omitempty"`
+       Description string                       `yaml:"description,omitempty" 
json:"description,omitempty"`
+       MIMEType    string                       `yaml:"mime_type,omitempty" 
json:"mime_type,omitempty"`
+       Parameters  []ResourceTemplateParameter  `yaml:"parameters,omitempty" 
json:"parameters,omitempty"`
+       Annotations *ResourceTemplateAnnotations `yaml:"annotations,omitempty" 
json:"annotations,omitempty"`
+}
+
+// ResourceTemplateParameter resource template parameter
+type ResourceTemplateParameter struct {
+       Name        string   `yaml:"name" json:"name"`
+       Type        string   `yaml:"type" json:"type" default:"string"`
+       Description string   `yaml:"description,omitempty" 
json:"description,omitempty"`
+       Required    bool     `yaml:"required,omitempty" 
json:"required,omitempty" default:"false"`
+       Enum        []string `yaml:"enum,omitempty" json:"enum,omitempty"`
+       Default     any      `yaml:"default,omitempty" json:"default,omitempty"`
+}
+
+// ResourceTemplateAnnotations resource template annotations
+type ResourceTemplateAnnotations struct {
+       Audience     []string `yaml:"audience,omitempty" 
json:"audience,omitempty"`
+       Priority     *float64 `yaml:"priority,omitempty" 
json:"priority,omitempty"`
+       LastModified string   `yaml:"last_modified,omitempty" 
json:"last_modified,omitempty"`
+}
+
+// ComputedParameter computed parameter (for internal processing, simplified)
+type ComputedParameter struct {
+       Name        string
+       Type        string
+       In          string
+       Description string
+       Required    bool
+       Enum        []string
+       Default     any
+}
+
+// PromptConfig prompt configuration
+type PromptConfig struct {
+       Name        string                 `yaml:"name" json:"name"`
+       Title       string                 `yaml:"title,omitempty" 
json:"title,omitempty"`
+       Description string                 `yaml:"description,omitempty" 
json:"description,omitempty"`
+       Arguments   []PromptArgumentConfig `yaml:"arguments,omitempty" 
json:"arguments,omitempty"`
+       Messages    []PromptMessageConfig  `yaml:"messages" json:"messages"`
+}
+
+// PromptArgumentConfig prompt argument configuration
+type PromptArgumentConfig struct {
+       Name        string `yaml:"name" json:"name"`
+       Description string `yaml:"description,omitempty" 
json:"description,omitempty"`
+       Required    bool   `yaml:"required,omitempty" json:"required,omitempty"`
+}
+
+// PromptMessageConfig prompt message configuration
+type PromptMessageConfig struct {
+       Role    string `yaml:"role" json:"role"` // "user" or "assistant"
+       Content string `yaml:"content" json:"content"`
+}
+
+// RegistryConfig 注册表配置

Review Comment:
   Use English



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to