Skip to content

Commit 56724c7

Browse files
committed
Configure LLM agent URL
1 parent c7904ad commit 56724c7

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

cli/exp_mcp.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ func (r *RootCmd) mcpConfigureClaudeCode() *serpent.Command {
126126
coderPrompt string
127127
appStatusSlug string
128128
testBinaryName string
129+
llmAgentURL url.URL
129130

130131
deprecatedCoderMCPClaudeAPIKey string
131132
)
@@ -164,6 +165,9 @@ func (r *RootCmd) mcpConfigureClaudeCode() *serpent.Command {
164165
if appStatusSlug != "" {
165166
configureClaudeEnv[envAppStatusSlug] = appStatusSlug
166167
}
168+
if llmAgentURL.String() != "" {
169+
configureClaudeEnv[envLLMAgentURL] = llmAgentURL.String()
170+
}
167171
if deprecatedSystemPromptEnv, ok := os.LookupEnv("SYSTEM_PROMPT"); ok {
168172
cliui.Warnf(inv.Stderr, "SYSTEM_PROMPT is deprecated, use CODER_MCP_CLAUDE_SYSTEM_PROMPT instead")
169173
systemPrompt = deprecatedSystemPromptEnv
@@ -262,6 +266,12 @@ func (r *RootCmd) mcpConfigureClaudeCode() *serpent.Command {
262266
Flag: "claude-app-status-slug",
263267
Value: serpent.StringOf(&appStatusSlug),
264268
},
269+
{
270+
Flag: "llm-agent-url",
271+
Description: "The URL of the LLM agent API, used to listen for status updates.",
272+
Env: envLLMAgentURL,
273+
Value: serpent.URLOf(&llmAgentURL),
274+
},
265275
{
266276
Name: "test-binary-name",
267277
Description: "Only used for testing.",
@@ -446,7 +456,9 @@ func (r *RootCmd) mcpServer() *serpent.Command {
446456
defer srv.queue.Close()
447457

448458
cliui.Infof(inv.Stderr, "Failed to watch screen events")
449-
// Start the reporter, watcher, and server.
459+
// Start the reporter, watcher, and server. These are all tied to the
460+
// lifetime of the MCP server, which is itself tied to the lifetime of the
461+
// LLM agent.
450462
if srv.agentClient != nil && appStatusSlug != "" {
451463
srv.startReporter(ctx, inv)
452464
if srv.llmClient != nil {

cli/exp_mcp_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ test-system-prompt
365365
"env": {
366366
"CODER_AGENT_URL": "%s",
367367
"CODER_AGENT_TOKEN": "test-agent-token",
368-
"CODER_MCP_APP_STATUS_SLUG": "some-app-name"
368+
"CODER_MCP_APP_STATUS_SLUG": "some-app-name",
369+
"CODER_MCP_LLM_AGENT_URL": http://localhost:3284
369370
}
370371
}
371372
}
@@ -390,6 +391,7 @@ test-system-prompt
390391
"--claude-test-binary-name=pathtothecoderbinary",
391392
"--agent-url", client.URL.String(),
392393
"--agent-token", "test-agent-token",
394+
"--llm-agent-url", "http://localhost:3284",
393395
)
394396
clitest.SetupConfig(t, client, root)
395397

0 commit comments

Comments
 (0)