Skip to content

fix(cli): modify exp mcp configure to also read claude API key from CLAUDE_API_KEY env #17229

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 3 commits into from
Apr 3, 2025

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Apr 2, 2025

Currently you have to set CODER_MCP_CLAUDE_API_KEY, which can be obnoxious.

@johnstcn johnstcn requested review from kylecarbs and Copilot April 2, 2025 16:36
@johnstcn johnstcn self-assigned this Apr 2, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the CLI configuration for Claude Code to support reading the API key from the canonical CLAUDE_API_KEY environment variable rather than only CODER_MCP_CLAUDE_API_KEY.

  • Renames apiKey to claudeAPIKey and introduces a deprecated alias variable (claudeAPIKeyAlt) for backwards compatibility.
  • Updates warning messages and command flag configurations to reflect the new canonical environment variable.
Comments suppressed due to low confidence (2)

cli/exp_mcp.go:144

  • Consider implementing a fallback assignment where if claudeAPIKey is empty but claudeAPIKeyAlt is provided, claudeAPIKey is set to claudeAPIKeyAlt. This change would allow users to rely on the deprecated alias during the transition period.
if claudeAPIKey == "" && claudeAPIKeyAlt == "" {

cli/exp_mcp.go:114

  • [nitpick] Consider renaming 'claudeAPIKeyAlt' to 'deprecatedClaudeAPIKey' to more clearly indicate that this alias is temporary and will be removed in a future version.
claudeAPIKeyAlt     string

@johnstcn johnstcn changed the title fix(cli): exp mcp configure: also read claude API key from canonical CLAUDE_API_KEY env fix(cli): modify exp mcp configure to also read claude API key from CLAUDE_API_KEY env Apr 2, 2025
@johnstcn johnstcn merged commit 4aa45a5 into main Apr 3, 2025
29 checks passed
@johnstcn johnstcn deleted the cj/exp-mcp-configure-api-key-arg branch April 3, 2025 08:45
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants