Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Truncate default MCP token name when hostname exceeds 100-char limit

Cursor Agentc3b16f569280
diff --git a/cli/beacon/cmd/mcp_token.go b/cli/beacon/cmd/mcp_token.go
index d3fdcc76..81aad96a 100644
--- a/cli/beacon/cmd/mcp_token.go
+++ b/cli/beacon/cmd/mcp_token.go
@@ -71,7 +71,11 @@ func runMCPTokenCreate(cmd *cobra.Command, args []string) error {
if name == "" {
name = "beacon-cli"
if host, err := mcpTokenHostname(); err == nil && host != "" {
- name = "beacon-cli on " + host
+ candidate := "beacon-cli on " + host
+ if runes := []rune(candidate); len(runes) > account.MaxMCPTokenNameRunes {
+ candidate = string(runes[:account.MaxMCPTokenNameRunes])
+ }
+ name = candidate
}
}
req := account.MCPTokenRequest{Name: name, ExpiresInDays: mcpTokenOpts.expiresInDays}
diff --git a/cli/beacon/internal/account/mcp_token.go b/cli/beacon/internal/account/mcp_token.go
index 49ca4abb..c7de4266 100644
--- a/cli/beacon/internal/account/mcp_token.go
+++ b/cli/beacon/internal/account/mcp_token.go
@@ -17,7 +17,8 @@ const (
// MaxMCPTokenExpiryDays is the longest lifetime beacon.sh accepts; 0 means the token never
// expires.
MaxMCPTokenExpiryDays = 366
- maxMCPTokenNameLength = 100
+ MaxMCPTokenNameRunes = 100
+ maxMCPTokenNameLength = MaxMCPTokenNameRunes
mcpTokenPrefix = "bcn_mcp_"
)