Skip to content

feat(cli): standard --read-only flag on ServerCmd (MC-46) - #29

Merged
jgangemi merged 1 commit into
mainfrom
jae/mc46-readonly-flag
Jul 12, 2026
Merged

jgangemi merged 1 commit into
mainfrom
jae/mc46-readonly-flag

Conversation

@jgangemi

Copy link
Copy Markdown
Member
  • register --read-only (bool, default false) unconditionally on ServerCmd,
    unlike --http/--stateless which are gated on Server.HTTP != nil, since it
    gates tool registration rather than transport
  • in RunE, before the transport starts, --read-only calls
    App.Gate(mcpkit.ReadOnlyMode()) so write/destructive tools are never
    registered
  • reserve the read-only flag name the same way as http/stateless: register
    it on cmd.Flags() before Server.Flags runs, so a colliding Server.Flags
    registration panics via pflag at construction
  • UseAsDefault's existing flag-copy makes --read-only work on both
    myapp server --read-only and bare myapp --read-only
  • update package/doc comments and regenerate cli/README.md

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

- register --read-only (bool, default false) unconditionally on ServerCmd,
unlike --http/--stateless which are gated on Server.HTTP != nil, since it
gates tool registration rather than transport
- in RunE, before the transport starts, --read-only calls
App.Gate(mcpkit.ReadOnlyMode()) so write/destructive tools are never
registered
- reserve the read-only flag name the same way as http/stateless: register
it on cmd.Flags() before Server.Flags runs, so a colliding Server.Flags
registration panics via pflag at construction
- UseAsDefault's existing flag-copy makes --read-only work on both
`myapp server --read-only` and bare `myapp --read-only`
- update package/doc comments and regenerate cli/README.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jgangemi
jgangemi enabled auto-merge (squash) July 12, 2026 20:33
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 29207952449

Coverage increased (+0.02%) to 96.192%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 8 of 8 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1497
Covered Lines: 1440
Line Coverage: 96.19%
Coverage Strength: 1.11 hits per line

💛 - Coveralls

@jgangemi
jgangemi merged commit e0d537b into main Jul 12, 2026
4 checks passed
@jgangemi
jgangemi deleted the jae/mc46-readonly-flag branch July 12, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants