8000 fix(cli): exp mcp: remove unnecessary cli flag (#17190) · coder/coder@27d2343 · GitHub
[go: up one dir, main page]

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

Appearance settings

Commit 27d2343

Browse files
authored
fix(cli): exp mcp: remove unnecessary cli flag (#17190)
1 parent 037dbc8 commit 27d2343

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

cli/exp_mcp.go

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"path/filepath"
99

1010
"github.com/mark3labs/mcp-go/server"
11-
"golang.org/x/xerrors"
1211

1312
"cdr.dev/slog"
1413
"cdr.dev/slog/sloggers/sloghuman"
@@ -195,16 +194,15 @@ func (*RootCmd) mcpConfigureCursor() *serpent.Command {
195194

196195
func (r *RootCmd) mcpServer() *serpent.Command {
197196
var (
198-
client = new(codersdk.Client)
199-
instructions string
200-
allowedTools []string
201-
appStatusSlug string
202-
mcpServerAgent bool
197+
client = new(codersdk.Client)
198+
instructions string
199+
allowedTools []string
200+
appStatusSlug string
203201
)
204202
return &serpent.Command{
205203
Use: "server",
206204
Handler: func(inv *serpent.Invocation) error {
207-
return mcpServerHandler(inv, client, instructions, allowedTools, appStatusSlug, mcpServerAgent)
205+
return mcpServerHandler(inv, client, instructions, allowedTools, appStatusSlug)
208206
},
209207
Short: "Start the Coder MCP server.",
210208
Middleware: serpent.Chain(
@@ -233,18 +231,11 @@ func (r *RootCmd) mcpServer() *serpent.Command {
233231
Value: serpent.StringOf(&appStatusSlug),
234232
Default: "",
235233
},
236-
{
237-
Flag: "agent",
238-
Env: "CODER_MCP_SERVER_AGENT",
239-
Description: "Start the MCP server in agent mode, with a different set of tools.",
240-
Value: serpent.BoolOf(&mcpServerAgent),
241-
},
242234
},
243235
}
244236
}
245237

246-
//nolint:revive // control coupling
247-
func mcpServerHandler(inv *serpent.Invocation, client *codersdk.Client, instructions string, allowedTools []string, appStatusSlug string, mcpServerAgent bool) error {
238+
func mcpServerHandler(inv *serpent.Invocation, client *codersdk.Client, instructions string, allowedTools []string, appStatusSlug string) error {
248239
ctx, cancel := context.WithCancel(inv.Context())
249240
defer cancel()
250241

@@ -290,13 +281,15 @@ func mcpServerHandler(inv *serpent.Invocation, client *codersdk.Client, instruct
290281
AgentClient: agentsdk.New(client.URL),
291282
}
292283

293-
if mcpServerAgent {
294-
// Get the workspace agent token from the environment.
295-
agentToken, ok := os.LookupEnv("CODER_AGENT_TOKEN")
296-
if !ok || agentToken == "" {
297-
return xerrors.New("CODER_AGENT_TOKEN is not set")
298-
}
284+
// Get the workspace agent token from the environment.
285+
agentToken, ok := os.LookupEnv("CODER_AGENT_TOKEN")
286+
if ok && agentToken != "" {
299287
toolDeps.AgentClient.SetSessionToken(agentToken)
288+
} else {
289+
cliui.Warnf(inv.Stderr, "CODER_AGENT_TOKEN is not set, task reporting will not be available")
290+
}
291+
if appStatusSlug == "" {
292+
cliui.Warnf(inv.Stderr, "CODER_MCP_APP_STATUS_SLUG is not set, task reporting will not be available.")
300293
}
301294

302295
// Register tools based on the allowlist (if specified)

0 commit comments

Comments
 (0)
0