feat: add built-in MCP service support

This commit is contained in:
AndyYang
2026-03-05 20:31:29 +08:00
committed by lyingbug
parent ead6712955
commit 6dde1330c2
14 changed files with 257 additions and 9 deletions
+16
View File
@@ -32,6 +32,7 @@ type MCPService struct {
AdvancedConfig *MCPAdvancedConfig `json:"advanced_config" gorm:"type:json"`
StdioConfig *MCPStdioConfig `json:"stdio_config,omitempty" gorm:"type:json"` // Required for stdio transport
EnvVars MCPEnvVars `json:"env_vars,omitempty" gorm:"type:json"` // Environment variables for stdio
IsBuiltin bool `json:"is_builtin" gorm:"default:false"` // Whether this is a builtin MCP service (visible to all tenants)
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
@@ -217,6 +218,21 @@ func (m *MCPService) MaskSensitiveData() {
}
}
// HideSensitiveInfo returns a copy of the MCP service with sensitive fields cleared for builtin services
func (m *MCPService) HideSensitiveInfo() *MCPService {
if !m.IsBuiltin {
return m
}
copy := *m
copy.URL = nil
copy.AuthConfig = nil
copy.Headers = nil
copy.EnvVars = nil
copy.StdioConfig = nil
return &copy
}
// maskString masks a string, showing only first 4 and last 4 characters
func maskString(s string) string {
if len(s) <= 8 {