Trim whitespace from token file in CLI
Token files with trailing newlines caused gRPC "non-printable ASCII characters" errors in the authorization header. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
mcpv1 "git.wntrmute.dev/kyle/mcp/gen/mcp/v1"
|
||||
"git.wntrmute.dev/kyle/mcp/internal/config"
|
||||
@@ -68,5 +69,5 @@ func loadBearerToken(cfg *config.CLIConfig) (string, error) {
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("read token from %q: %w (run 'mcp login' first)", cfg.Auth.TokenPath, err)
|
||||
}
|
||||
return string(token), nil
|
||||
return strings.TrimSpace(string(token)), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user