MCPcopy Create free account
hub / github.com/github/gh-aw / addMCPScriptsConfig

Function addMCPScriptsConfig

pkg/parser/mcp.go:148–174  ·  view source on GitHub ↗
(frontmatter map[string]any, serverFilter string, configs *[]RegistryMCPServerConfig)

Source from the content-addressed store, hash-verified

146}
147
148func 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
176func serverFilterMatches(serverName, serverFilter string) bool {
177 return serverFilter == "" || strings.Contains(strings.ToLower(serverName), strings.ToLower(serverFilter))

Callers 1

ExtractMCPConfigurationsFunction · 0.85

Calls 3

serverFilterMatchesFunction · 0.85
PrintMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected