Skip to content

fix: mute Claude API key warning if Bedrock in use #18988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions cli/exp_mcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func (r *RootCmd) mcpConfigureClaudeCode() *serpent.Command {
appStatusSlug string
testBinaryName string
aiAgentAPIURL url.URL
claudeUseBedrock string

deprecatedCoderMCPClaudeAPIKey string
)
Expand Down Expand Up @@ -154,14 +155,15 @@ func (r *RootCmd) mcpConfigureClaudeCode() *serpent.Command {
configureClaudeEnv[envAgentURL] = agentClient.SDK.URL.String()
configureClaudeEnv[envAgentToken] = agentClient.SDK.SessionToken()
}
if claudeAPIKey == "" {
if deprecatedCoderMCPClaudeAPIKey == "" {
cliui.Warnf(inv.Stderr, "CLAUDE_API_KEY is not set.")
} else {
cliui.Warnf(inv.Stderr, "CODER_MCP_CLAUDE_API_KEY is deprecated, use CLAUDE_API_KEY instead")
claudeAPIKey = deprecatedCoderMCPClaudeAPIKey
}

if deprecatedCoderMCPClaudeAPIKey != "" {
cliui.Warnf(inv.Stderr, "CODER_MCP_CLAUDE_API_KEY is deprecated, use CLAUDE_API_KEY instead")
claudeAPIKey = deprecatedCoderMCPClaudeAPIKey
}
if claudeAPIKey == "" && claudeUseBedrock != "1" {
cliui.Warnf(inv.Stderr, "CLAUDE_API_KEY is not set.")
}

if appStatusSlug != "" {
configureClaudeEnv[envAppStatusSlug] = appStatusSlug
}
Expand Down Expand Up @@ -280,6 +282,14 @@ func (r *RootCmd) mcpConfigureClaudeCode() *serpent.Command {
Value: serpent.StringOf(&testBinaryName),
Hidden: true,
},
{
Name: "claude-code-use-bedrock",
Description: "Use Amazon Bedrock.",
Env: "CLAUDE_CODE_USE_BEDROCK",
Flag: "claude-code-use-bedrock",
Value: serpent.StringOf(&claudeUseBedrock),
Hidden: true,
},
},
}
return cmd
Expand Down
Loading