Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4aa45a5

Browse files
authored
fix(cli): modifyexp mcp configure to also read claude API key from CLAUDE_API_KEY env (#17229)
Currently you have to set `CODER_MCP_CLAUDE_API_KEY`, which can beobnoxious.
1 parent998724d commit4aa45a5

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

‎cli/exp_mcp.go

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,14 @@ func (*RootCmd) mcpConfigureClaudeDesktop() *serpent.Command {
110110

111111
func (*RootCmd)mcpConfigureClaudeCode()*serpent.Command {
112112
var (
113-
apiKeystring
113+
claudeAPIKeystring
114114
claudeConfigPathstring
115115
claudeMDPathstring
116116
systemPromptstring
117117
appStatusSlugstring
118118
testBinaryNamestring
119+
120+
deprecatedCoderMCPClaudeAPIKeystring
119121
)
120122
cmd:=&serpent.Command{
121123
Use:"claude-code <project-directory>",
@@ -140,6 +142,14 @@ func (*RootCmd) mcpConfigureClaudeCode() *serpent.Command {
140142
}else {
141143
configureClaudeEnv["CODER_AGENT_TOKEN"]=agentToken
142144
}
145+
ifclaudeAPIKey=="" {
146+
ifdeprecatedCoderMCPClaudeAPIKey=="" {
147+
cliui.Warnf(inv.Stderr,"CLAUDE_API_KEY is not set.")
148+
}else {
149+
cliui.Warnf(inv.Stderr,"CODER_MCP_CLAUDE_API_KEY is deprecated, use CLAUDE_API_KEY instead")
150+
claudeAPIKey=deprecatedCoderMCPClaudeAPIKey
151+
}
152+
}
143153
ifappStatusSlug!="" {
144154
configureClaudeEnv["CODER_MCP_APP_STATUS_SLUG"]=appStatusSlug
145155
}
@@ -151,7 +161,7 @@ func (*RootCmd) mcpConfigureClaudeCode() *serpent.Command {
151161
iferr:=configureClaude(fs,ClaudeConfig{
152162
// TODO: will this always be stable?
153163
AllowedTools: []string{`mcp__coder__coder_report_task`},
154-
APIKey:apiKey,
164+
APIKey:claudeAPIKey,
155165
ConfigPath:claudeConfigPath,
156166
ProjectDirectory:projectDirectory,
157167
MCPServers:map[string]ClaudeConfigMCP{
@@ -191,11 +201,18 @@ func (*RootCmd) mcpConfigureClaudeCode() *serpent.Command {
191201
Default:filepath.Join(os.Getenv("HOME"),".claude","CLAUDE.md"),
192202
},
193203
{
194-
Name:"api-key",
195-
Description:"The API key to use for the Claude Code server.",
196-
Env:"CODER_MCP_CLAUDE_API_KEY",
204+
Name:"claude-api-key",
205+
Description:"The API key to use for the Claude Code server. This is also read from CLAUDE_API_KEY.",
206+
Env:"CLAUDE_API_KEY",
197207
Flag:"claude-api-key",
198-
Value:serpent.StringOf(&apiKey),
208+
Value:serpent.StringOf(&claudeAPIKey),
209+
},
210+
{
211+
Name:"mcp-claude-api-key",
212+
Description:"Hidden alias for CLAUDE_API_KEY. This will be removed in a future version.",
213+
Env:"CODER_MCP_CLAUDE_API_KEY",
214+
Value:serpent.StringOf(&deprecatedCoderMCPClaudeAPIKey),
215+
Hidden:true,
199216
},
200217
{
201218
Name:"system-prompt",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp