feat: mcp create + plural --channel; mcp create polish#11
Open
ysyneu wants to merge 6 commits into
Open
Conversation
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.
Two-step on-box diagnostics surface: `catalog` discovers tools per target via /monit/tools/catalog, `invoke` runs up to 8 of them concurrently via /monit/tools/invoke. --tool-spec uses StringArray so params=<json> bodies with commas survive intact. Side-fix: extend test-helper resetFlagSet to also clear stringSlice and stringArray flags between execCommand calls; without it, a later test sees leftover repeated --flag entries from earlier ones.
CI failures since Phase 1 (commit f86006c) traced to a local-path replace directive that pointed at /Users/ysy/go/src/github.com/flashcatcloud/ flashduty-sdk — fine for the workstation that authored it, fatal for GitHub Actions runners that have no such path. The CLI legitimately depends on unreleased SDK methods (Phase 1's CreateMCPServer + Phase 2's MonitQuery / MonitAgent). Until both underlying SDK PRs (#12 mcp-server-create, #13 monit-types) merge and a v0.10.0 tag ships, we pin to a pseudo-version of the integration branch flashduty-sdk@dev/sdk-cli-phase2-deps (HEAD 3203385), which merges both feature branches together. Resolves to: v0.9.1-0.20260527160039-3203385df5ad When SDK v0.10.0 tags, the next commit on this PR just bumps the require to v0.10.0 and we delete the integration branch — no other CLI code change needed. The replace directive does not return.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 createnew command under a newmcpgroup. Registers an MCP server viaflashduty-sdk.CreateMCPServer. 11 flags:--server-name --description --transport --command --args --env --url --headers --connect-timeout --call-timeout --team-id.--envand--headersaccept repeatableKEY=VALUEparsed via a new sharedparseKVSlicehelper. Pre-flight rejects empty--server-nameinside therunCommandclosure to match the canonical project convention.change list --channelmigrated from singularInt64Varto comma-separatedStringVar, routed through the SDK's primaryListChangesInput.ChannelIDs []int64. Mirrorsalert list --channel(which already used the plural form) so both commands have identical filter semantics and match the MCPquery_changes.channel_idsschema.mcp create: validation moved insiderunCommandfor uniform error rendering; test migrated to thesaveAndResetGlobals+mockClientfixture so it exercises the actualRunEpath;parseKVSlicegets 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 onmain; no change needed there.Test plan
go test ./internal/cli -count=1greenmake checkclean (fmt + lint + test + build)make build && bin/flashduty mcp create --helpshows all 11 flagsbin/flashduty change list --channel 100,200 --since 1h --jsonagainst a dev account routes throughchannel_ids(notchannel_id)GOOS=linux GOARCH=amd64 make build && file bin/flashdutyreportsELF 64-bit ... x86-64— needed by the fc-safari sandbox image bake