github/github-mcp-server · error

choose exactly one authentication mode: a static Token, OAut

Error message

choose exactly one authentication mode: a static Token, OAuthManager, or TokenProvider

What it means

Error "choose exactly one authentication mode: a static Token, OAuthManager, or TokenProvider" thrown in github/github-mcp-server.

Source

Thrown at internal/ghmcp/server.go:279

	// the scope set for tool filtering: tools requiring a scope outside this set
	// are hidden. The default set is the full supported list, which hides
	// nothing; an explicit, narrower list filters accordingly.
	OAuthScopes []string

	// TokenProvider supplies a token for each GitHub API request.
	TokenProvider func() string
}

// RunStdioServer is not concurrent safe.
func RunStdioServer(cfg StdioServerConfig) error {
	authModes := 0
	for _, on := range []bool{cfg.Token != "", cfg.OAuthManager != nil, cfg.TokenProvider != nil} {
		if on {
			authModes++
		}
	}
	if authModes > 1 {
		return fmt.Errorf("choose exactly one authentication mode: a static Token, OAuthManager, or TokenProvider")
	}

	// Create app context
	ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
	defer stop()

	t, dumpTranslations := translations.TranslationHelper()

	var slogHandler slog.Handler
	var logOutput io.Writer
	if cfg.LogFilePath != "" {
		file, err := os.OpenFile(cfg.LogFilePath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
		if err != nil {
			return fmt.Errorf("failed to open log file: %w", err)
		}
		logOutput = file
		slogHandler = slog.NewTextHandler(logOutput, &slog.HandlerOptions{Level: slog.LevelDebug})
	} else {

View on GitHub (pinned to 0ea1f775a7)

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/9f96eea2603c77db. Report an issue: GitHub.