googleapis/mcp-toolbox · error

MCP Auth cannot be enabled together with the legacy HTTP API

Error message

MCP Auth cannot be enabled together with the legacy HTTP API (EnableAPI)

What it means

Error "MCP Auth cannot be enabled together with the legacy HTTP API (EnableAPI)" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/server/server.go:85

	PrimitiveMgr        *primitives.PrimitiveManager
	mcpPrmFile          string
	httpMaxRequestBytes int64
	enableDraftSpecs    bool
}

func InitializeConfigs(ctx context.Context, cfg ServerConfig) (
	map[string]sources.Source,
	map[string]auth.AuthService,
	map[string]embeddingmodels.EmbeddingModel,
	map[string]tools.Tool,
	map[string]prompts.Prompt,
	map[string]group.Group,
	error,
) {
	if cfg.EnableAPI {
		for _, sc := range cfg.AuthServiceConfigs {
			if sc.IsMCPEnabled() {
				return nil, nil, nil, nil, nil, nil, fmt.Errorf("MCP Auth cannot be enabled together with the legacy HTTP API (EnableAPI)")
			}
		}
	}

	metadataStr := cfg.Version
	if len(cfg.UserAgentMetadata) > 0 {
		metadataStr += "+" + strings.Join(cfg.UserAgentMetadata, "+")
	}
	ctx = util.WithUserAgent(ctx, metadataStr)
	instrumentation, err := util.InstrumentationFromContext(ctx)
	if err != nil {
		return nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get instrumentation from context: %w", err)
	}

	l, err := util.LoggerFromContext(ctx)
	if err != nil {
		return nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get logger from context: %w", err)
	}

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/server/server.go:85 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/d949ea20371166fc. Report an issue: GitHub.