Add tags field to Server struct in MCP model

- Introduce a new Tags field in the Server struct to allow for additional metadata.
- Update the listServers function to populate the Tags field from the server metadata, enhancing the server representation with more contextual information.
This commit is contained in:
Max 2026-03-02 15:05:11 +08:00
parent 1b60feacab
commit ccc25e7079

View file

@ -9,12 +9,13 @@ import (
// Server represents an MCP server option (from user perspective)
type Server struct {
Label string `json:"label"`
Value string `json:"value"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Transport string `json:"transport,omitempty"` // "stdio", "sse", "http"
Builtin bool `json:"builtin"` // true for system built-in, false for user-defined
Label string `json:"label"`
Value string `json:"value"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
Transport string `json:"transport,omitempty"` // "stdio", "sse", "http"
Builtin bool `json:"builtin"` // true for system built-in, false for user-defined
}
// Attach attaches the MCP server management handlers to the router with OAuth protection
@ -58,6 +59,7 @@ func listServers(c *gin.Context) {
Value: id,
Name: name,
Description: meta.Description,
Tags: meta.Tags,
Transport: transport,
Builtin: meta.Builtin,
})