Skip to content

CLI version and unknown flags exit silently #309

Description

@SyntaxHQDEV

The published @notionhq/notion-mcp-server@2.2.1 binary supports --help, but --version and unknown top-level flags both exit successfully without printing anything. This makes local MCP setup harder to inspect and makes typos look like successful no-op commands.

Reproduction on Windows/PowerShell:

$work = Join-Path $env:TEMP "notion-mcp-cli-flag-repro"
Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Path $work | Out-Null
Set-Location $work
npm init -y | Out-Null
npm install --ignore-scripts --no-audit --no-fund @notionhq/notion-mcp-server@2.2.1
$cmd = Join-Path $work "node_modules\.bin\notion-mcp-server.cmd"
$out = & $cmd --help 2>&1; "help_exit=$LASTEXITCODE help_len=$(($out -join "`n").Length)"
$out = & $cmd --version 2>&1; "version_exit=$LASTEXITCODE version_len=$(($out -join "`n").Length)"
$out = & $cmd --definitely-not-a-real-flag 2>&1; "invalid_exit=$LASTEXITCODE invalid_len=$(($out -join "`n").Length)"

Observed:

help_exit=0 help_len=1445
version_exit=0 version_len=0
invalid_exit=0 invalid_len=0

Expected behavior:

  • notion-mcp-server --version / -v should exit 0 and print the installed package version, 2.2.1 for this package.
  • Unknown top-level flags should print a concise unknown-option error and exit non-zero.
  • Existing --help behavior should remain unchanged.

Likely source area:

  • package.json exposes bin: { "notion-mcp-server": "bin/cli.mjs" } and version 2.2.1.
  • bin/cli.mjs already implements --help, so the fix should be near the same argument preflight/parser path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions