{"record":{"id":"adebfc9a08eec54b","repo":"googleapis/mcp-toolbox","slug":"multiple-authservices-with-mcpenabled-true-detecte","errorCode":null,"errorMessage":"multiple authServices with mcpEnabled=true detected: %s. Only one MCP authorization server is currently supported","messagePattern":"multiple authServices with mcpEnabled=true detected: (.+?)\\. Only one MCP authorization server is currently supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/config.go","lineNumber":498,"sourceCode":"\t\t\t}\n\t\t}\n\t}\n\n\t// If conflicts were detected, return an error\n\tif len(conflicts) > 0 {\n\t\treturn Config{}, fmt.Errorf(\"resource conflicts detected:\\n  - %s\\n\\nPlease ensure each source, authService, tool, prompt and group has a unique name across all files\", strings.Join(conflicts, \"\\n  - \"))\n\t}\n\n\t// Ensure only one authService has mcpEnabled = true\n\tvar mcpEnabledAuthServers []string\n\tfor name, authService := range merged.AuthServices {\n\t\t// Only generic type has McpEnabled right now\n\t\tif genericService, ok := authService.(generic.Config); ok && genericService.McpEnabled {\n\t\t\tmcpEnabledAuthServers = append(mcpEnabledAuthServers, name)\n\t\t}\n\t}\n\tif len(mcpEnabledAuthServers) > 1 {\n\t\treturn Config{}, fmt.Errorf(\"multiple authServices with mcpEnabled=true detected: %s. Only one MCP authorization server is currently supported\", strings.Join(mcpEnabledAuthServers, \", \"))\n\t}\n\n\treturn merged, nil\n}\n\n// LoadAndMergeConfigs loads multiple YAML files and merges them\nfunc (p *ConfigParser) LoadAndMergeConfigs(ctx context.Context, filePaths []string) (Config, error) {\n\tvar configs []Config\n\n\tfor _, filePath := range filePaths {\n\t\tbuf, err := os.ReadFile(filePath)\n\t\tif err != nil {\n\t\t\treturn Config{}, fmt.Errorf(\"unable to read config file at %q: %w\", filePath, err)\n\t\t}\n\n\t\tconfig, err := p.ParseConfig(ctx, buf)\n\t\tif err != nil {\n\t\t\treturn Config{}, fmt.Errorf(\"unable to parse config file at %q: %w\", filePath, err)","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/cmd/internal/config.go#L480-L516","documentation":"Only one MCP authorization server may have mcpEnabled=true. mergeConfigs scans all generic authServices after merging and throws this error listing every authService with mcpEnabled=true when more than one is found.","triggerScenarios":"Two or more files passed to LoadAndMergeConfigs each define a generic authService with mcpEnabled: true.","commonSituations":"Splitting config across files where each file's author enabled mcpEnabled on their authService; copying an authService block (with mcpEnabled: true) into an additional config file.","solutions":["Set mcpEnabled: true on only one authService and false (or omit) on all others","Remove the redundant authService with mcpEnabled: true","Merge the auth configuration into a single authService definition"],"exampleFix":"// before\nauthServices:\n  a: {kind: generic, mcpEnabled: true}\n  b: {kind: generic, mcpEnabled: true}\n// after\nauthServices:\n  a: {kind: generic, mcpEnabled: true}\n  b: {kind: generic}","handlingStrategy":"validation","validationCode":"count := 0\nfor _, c := range configs {\n  for name, s := range c.AuthServices {\n    if g, ok := s.(generic.Config); ok && g.McpEnabled {\n      count++\n      if count > 1 { return fmt.Errorf(\"multiple mcpEnabled authServices\") }\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"cfg, err := parser.LoadAndMergeConfigs(ctx, files)\nif err != nil {\n  if strings.Contains(err.Error(), \"mcpEnabled=true\") {\n    // disable mcpEnabled on all but one authService\n  }\n  return err\n}","preventionTips":["Enable mcpEnabled on exactly one authService, ideally in a single dedicated file","Grep configs for 'mcpEnabled: true' before deploying","Document which authService owns MCP authorization"],"tags":["auth","config-merge","multi-file"],"backgroundTag":"duplicate-mcp-auth-server","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}