(frontmatter map[string]any, serverFilter string, configs *[]RegistryMCPServerConfig)
| 146 | } |
| 147 | |
| 148 | func addMCPScriptsConfig(frontmatter map[string]any, serverFilter string, configs *[]RegistryMCPServerConfig) { |
| 149 | mcpScriptsSection, hasMCPScripts := frontmatter["mcp-scripts"] |
| 150 | if !hasMCPScripts { |
| 151 | return |
| 152 | } |
| 153 | mcpLog.Print("Found mcp-scripts configuration") |
| 154 | if !serverFilterMatches(constants.MCPScriptsMCPServerID.String(), serverFilter) { |
| 155 | return |
| 156 | } |
| 157 | |
| 158 | config := RegistryMCPServerConfig{ |
| 159 | BaseMCPServerConfig: types.BaseMCPServerConfig{ |
| 160 | Type: "http", |
| 161 | Command: "", |
| 162 | Env: make(map[string]string), |
| 163 | }, |
| 164 | Name: constants.MCPScriptsMCPServerID.String(), |
| 165 | } |
| 166 | if mcpScriptsMap, ok := mcpScriptsSection.(map[string]any); ok { |
| 167 | for toolName := range mcpScriptsMap { |
| 168 | if toolName != "mode" { |
| 169 | config.Allowed = append(config.Allowed, toolName) |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | *configs = append(*configs, config) |
| 174 | } |
| 175 | |
| 176 | func serverFilterMatches(serverName, serverFilter string) bool { |
| 177 | return serverFilter == "" || strings.Contains(strings.ToLower(serverName), strings.ToLower(serverFilter)) |
no test coverage detected