Skip to content

feat: mcp create + plural --channel; mcp create polish#11

Open
ysyneu wants to merge 3 commits into
mainfrom
feat/cli-phase1-gaps
Open

feat: mcp create + plural --channel; mcp create polish#11
ysyneu wants to merge 3 commits into
mainfrom
feat/cli-phase1-gaps

Conversation

@ysyneu
Copy link
Copy Markdown
Contributor

@ysyneu ysyneu commented May 27, 2026

Summary

Three changes that close MCP feature parity for the fc-safari ai-sre agent path (see fc-safari PR for the consumer side).

  • mcp create new command under a new mcp group. Registers an MCP server via flashduty-sdk.CreateMCPServer. 11 flags: --server-name --description --transport --command --args --env --url --headers --connect-timeout --call-timeout --team-id. --env and --headers accept repeatable KEY=VALUE parsed via a new shared parseKVSlice helper. Pre-flight rejects empty --server-name inside the runCommand closure to match the canonical project convention.
  • change list --channel migrated from singular Int64Var to comma-separated StringVar, routed through the SDK's primary ListChangesInput.ChannelIDs []int64. Mirrors alert list --channel (which already used the plural form) so both commands have identical filter semantics and match the MCP query_changes.channel_ids schema.
  • Quality polish on mcp create: validation moved inside runCommand for uniform error rendering; test migrated to the saveAndResetGlobals + mockClient fixture so it exercises the actual RunE path; parseKVSlice gets an 8-case table-driven test covering nil / empty / single / multi / value-with-equals / empty-value / empty-key / missing-equals.

alert events <alert_id> was already on main; no change needed there.

Test plan

  • go test ./internal/cli -count=1 green
  • make check clean (fmt + lint + test + build)
  • Smoke: make build && bin/flashduty mcp create --help shows all 11 flags
  • Smoke: bin/flashduty change list --channel 100,200 --since 1h --json against a dev account routes through channel_ids (not channel_id)
  • Cross-build for linux/amd64: GOOS=linux GOARCH=amd64 make build && file bin/flashduty reports ELF 64-bit ... x86-64 — needed by the fc-safari sandbox image bake

ysyneu added 3 commits May 27, 2026 15:15
Migrate from singular Int64Var to StringVar + parseIntSlice, routing
through ListChangesInput.ChannelIDs []int64 to match the MCP surface
and mirror the existing alert list --channel pattern.
Move --server-name empty-check inside runCommand closure to match the
project convention established in alert.go (validation flows through the
same error formatter as all other business-logic errors).

Rewrite TestMCPCreateRejectsEmptyServerName to use execCommand +
mockClient injection so it survives the guard moving inside runCommand
without depending on real config or network.

Add TestParseKVSlice table-driven tests covering nil/empty/single/multi/
value-with-equals/empty-value/empty-key/missing-equals cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant