Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- Lint GV005 gives `fix` advice that fits what wraps the filtered column and names the real column: a date range for date and time functions, moving the calculation to the constant side for arithmetic (`amount > 100 / 1.2`), a case-insensitive comparison or normalized column for `UPPER`/`LOWER`/`TRIM`, the NULL case written out for `COALESCE`, and a neutral sentence for anything else, instead of the same date-range example every time. Rule id, severity, message and the date autofix are unchanged. Thanks to @dianatofficial! (#158, #174)
- Lint GV005 no longer suggests a rewrite that changes results in three cases: a `COALESCE` whose first argument is not a plain column or whose default or compared value is not a literal, `/` on Postgres (integer division), and `TRIM`/`LTRIM`/`RTRIM`, which now get trimmed-column advice instead of case-folding advice. Thanks to @dianatofficial! (#191, #193)
- Lint GV005 no longer suggests a truncating division on Postgres: for `amount * 2 >= 11` the advice is the generic sentence instead of `amount >= 11 / 2`, which returns different rows, while exact and decimal divisions keep their concrete rewrite. Thanks to @tyza66! (#195, #196)
- `gulliver-mcp --port` and `gulliver mcp --port` refuse a value outside 0-65535 with a one-line `gulliver-mcp: port must be 0-65535` message and exit 2, instead of an `OverflowError` traceback. `--port 0` stays valid. Thanks to @HarshRajSinghania! (#113, #114)

### Added
- Lint rule GV020 `null-comparison`: warns on `= NULL`, `<> NULL` and `!= NULL` in either operand order, including joins and CASE expressions. Suggests NULL predicates without an autofix because results change Thanks to @amritkang165! (#129, #137)
Expand Down
4 changes: 4 additions & 0 deletions src/gulliver/mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ def main(argv: list[str] | None = None) -> None:
"of those and tool names. Fewer tools = a smaller schema in the agent's context.")
parser.add_argument("--version", action="version", version=f"gulliver-mcp {__version__}")
args = parser.parse_args(argv)
if not 0 <= args.port <= 65535:
print("gulliver-mcp: port must be 0-65535", file=sys.stderr)
raise SystemExit(2)

_ARGS.update(config=args.config, dsn=args.dsn)
try:
load_settings(config_path=args.config, dsn=args.dsn)
Expand Down
21 changes: 21 additions & 0 deletions tests/test_mcp_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,3 +533,24 @@ def test_server_filled_parameters_have_no_none_default():
checked += 1
assert param.default is not None, f"{tool.name}.{name} has a None default (breaks Python 3.10)"
assert checked >= 2 # gulliver_run's probe and answer

def test_mcp_port_out_of_range(capsys):
"""Bad --port values must fail cleanly before any server starts."""
from gulliver.mcp_server import main as mcp_main
for bad in ["-1", "70000", "65536"]:
with pytest.raises(SystemExit) as exc:
mcp_main(["--http", "--port", bad])
assert exc.value.code == 2
err = capsys.readouterr().err
assert "port must be 0-65535" in err
assert "OverflowError" not in err

def test_cli_mcp_port_out_of_range(capsys):
"""The gulliver mcp subcommand forwards the same check."""
for bad in ["-1", "70000"]:
with pytest.raises(SystemExit) as exc:
main(["mcp", "--http", "--port", bad])
assert exc.value.code == 2
err = capsys.readouterr().err
assert "port must be 0-65535" in err

Loading