Input: Design documents from /specs/027-status-command/
Prerequisites: plan.md (required), spec.md (required), research.md, data-model.md, contracts/
Tests: Included per TDD constitution principle (V).
Organization: Tasks grouped by user story for independent implementation.
- [P]: Can run in parallel (different files, no dependencies)
- [Story]: Which user story (US1, US2, US3, US4)
- Exact file paths included
Purpose: Register command and add client method
- T001 Add
GetStatus()method tocliclient.Clientininternal/cliclient/client.go- call/api/v1/status, returnmap[string]interface{} - T002 Create
cmd/mcpproxy/status_cmd.gowith Cobra command skeleton:statusCmdwith--show-key,--web-url,--reset-keyflags, register incmd/mcpproxy/main.go
Purpose: Core status data collection logic shared by all user stories
- T003 Implement
StatusInfostruct andcollectStatusFromDaemon()incmd/mcpproxy/status_cmd.go- detect socket viasocket.IsSocketAvailable(), callcliclient.GetStatus()andcliclient.GetInfo(), merge into StatusInfo - T004 Implement
collectStatusFromConfig()incmd/mcpproxy/status_cmd.go- load config viaconfig.Load(), populate StatusInfo with configured listen address, API key, constructed Web UI URL, config path - T005 Implement
maskAPIKey()incmd/mcpproxy/status_cmd.go- first4+****+last4 masking (reuse logic frommain.go:81-87) - T006 Implement
buildWebUIURL()helper incmd/mcpproxy/status_cmd.go- constructhttp://{addr}/ui/?apikey={key}, handle:portprefix case
Checkpoint: Core data collection ready - user story implementation can begin
Goal: mcpproxy status displays proxy state with masked API key and Web UI URL in both daemon and config-only modes
Independent Test: Run mcpproxy status with and without daemon, verify all fields present
- T007 [P] [US1] Unit test
TestCollectStatusFromConfigincmd/mcpproxy/status_cmd_test.go- verify config-only mode populates StatusInfo correctly with "Not running" state, masked key, config path - T008 [P] [US1] Unit test
TestMaskAPIKeyincmd/mcpproxy/status_cmd_test.go- verify masking: normal key (first4++last4), short key (), empty key - T009 [P] [US1] Unit test
TestBuildWebUIURLincmd/mcpproxy/status_cmd_test.go- verify URL construction: normal addr,:portprefix, with API key - T010 [P] [US1] Unit test
TestFormatStatusTableincmd/mcpproxy/status_cmd_test.go- verify table output contains all expected fields for both running and not-running states
- T011 [US1] Implement
formatStatusTable()incmd/mcpproxy/status_cmd.go- render StatusInfo as aligned key-value table output (State, Listen, Uptime, API Key, Web UI, Servers, Socket/Config) - T012 [US1] Implement
formatStatusJSON()incmd/mcpproxy/status_cmd.go- render StatusInfo as JSON matchingcontracts/status-response.jsonschema, support YAML via standard formatter - T013 [US1] Wire up
runStatus()incmd/mcpproxy/status_cmd.go- detect daemon mode, collect status, format with resolved output format, print to stdout
Checkpoint: mcpproxy status works in both modes with masked key
Goal: --show-key flag reveals full unmasked API key
Independent Test: Run mcpproxy status --show-key and verify full 64-char key in output
- T014 [P] [US2] Unit test
TestShowKeyFlagincmd/mcpproxy/status_cmd_test.go- verify --show-key produces full unmasked key in both table and JSON output
- T015 [US2] Add
--show-keylogic torunStatus()incmd/mcpproxy/status_cmd.go- when flag set, skip masking and include full API key in StatusInfo
Checkpoint: mcpproxy status --show-key reveals full key
Goal: --web-url outputs only the URL for piping
Independent Test: Run mcpproxy status --web-url and verify output is URL-only (no labels)
- T016 [P] [US3] Unit test
TestWebURLFlagincmd/mcpproxy/status_cmd_test.go- verify --web-url outputs only URL string with no formatting, labels, or extra newlines
- T017 [US3] Add
--web-urlearly-return logic torunStatus()incmd/mcpproxy/status_cmd.go- when flag set, print only the Web UI URL and exit (bypass all other formatting)
Checkpoint: open $(mcpproxy status --web-url) opens Web UI
Goal: --reset-key generates new key, saves to config, warns about HTTP clients
Independent Test: Run mcpproxy status --reset-key, verify new key saved and warning displayed
- T018 [P] [US4] Unit test
TestResetKeyincmd/mcpproxy/status_cmd_test.go- verify new key is generated (different from old), config file updated, warning message contains "HTTP clients" - T019 [P] [US4] Unit test
TestResetKeyWithEnvVarincmd/mcpproxy/status_cmd_test.go- verify env var override warning is shown whenMCPPROXY_API_KEYis set
- T020 [US4] Implement
resetAPIKey()incmd/mcpproxy/status_cmd.go- generate new key viacrypto/rand, save viaconfig.SaveConfig(), return new key - T021 [US4] Add
--reset-keylogic torunStatus()incmd/mcpproxy/status_cmd.go- call resetAPIKey(), print warning about HTTP client disconnection, check for env var override, display new key in full (implicit --show-key), then show updated status
Checkpoint: API key rotation works with proper warnings
Purpose: Documentation and integration
- T022 [P] Create Docusaurus documentation in
docs/cli/status-command.md- follow pattern fromdocs/cli/activity-commands.md: frontmatter, overview, usage, flags table, examples (daemon/config modes), output examples (table/JSON), edge cases, exit codes - T023 [P] Register status-command in
website/sidebars.jsunder CLI category - T024 Run
go test ./cmd/mcpproxy/ -run TestStatus -v -raceand./scripts/run-linter.shto verify all tests pass and code is lint-clean - T025 Run quickstart.md validation: build binary, test all flag combinations in both daemon and config-only modes
- Setup (Phase 1): No dependencies - start immediately
- Foundational (Phase 2): Depends on Phase 1 (T001, T002)
- US1 (Phase 3): Depends on Phase 2 (T003-T006)
- US2 (Phase 4): Depends on Phase 3 (builds on status output)
- US3 (Phase 5): Depends on Phase 2 only (URL construction is foundational)
- US4 (Phase 6): Depends on Phase 2 only (reset is independent of display)
- Polish (Phase 7): Depends on all user stories complete
- US1 (P1): Core status display - must complete first as base
- US2 (P1): Extends US1 with --show-key flag
- US3 (P2): Independent of US1/US2 (uses only URL construction from foundational)
- US4 (P3): Independent of US1/US2/US3 (config write + display)
- T007, T008, T009, T010 can all run in parallel (different test functions)
- T014, T016, T018, T019 can all run in parallel (different test functions)
- T022, T023 can run in parallel (different files)
- US3 and US4 can be developed in parallel after foundational phase
# Launch all tests for US1 together:
Task: "Unit test TestCollectStatusFromConfig in cmd/mcpproxy/status_cmd_test.go"
Task: "Unit test TestMaskAPIKey in cmd/mcpproxy/status_cmd_test.go"
Task: "Unit test TestBuildWebUIURL in cmd/mcpproxy/status_cmd_test.go"
Task: "Unit test TestFormatStatusTable in cmd/mcpproxy/status_cmd_test.go"- Complete Phase 1: Setup (T001-T002)
- Complete Phase 2: Foundational (T003-T006)
- Complete Phase 3: US1 - Quick Status Check (T007-T013)
- STOP and VALIDATE:
mcpproxy statusworks in both modes - Deploy/demo if ready
- Setup + Foundational -> Core ready
- US1 ->
mcpproxy statusworks (MVP) - US2 ->
--show-keyadded - US3 ->
--web-urladded - US4 ->
--reset-keyadded - Polish -> docs, lint, final validation
- All code in single file
cmd/mcpproxy/status_cmd.go+ test file - minimal blast radius maskAPIKey()already exists inmain.go- can reuse or duplicate (same package)cliclient.GetInfo()already exists - onlyGetStatus()needs adding- Config hot-reload handles key changes - no daemon restart needed after reset