Skip to content

fix: apply --host and --port CLI flags in apply_cli_overrides - #1376

Merged
danielchalef merged 2 commits into
getzep:mainfrom
Maanik23:fix/cli-host-port-flags
Jun 8, 2026
Merged

fix: apply --host and --port CLI flags in apply_cli_overrides#1376
danielchalef merged 2 commits into
getzep:mainfrom
Maanik23:fix/cli-host-port-flags

Conversation

@Maanik23

@Maanik23 Maanik23 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #1333

Summary

The --host and --port CLI flags for graphiti-mcp-server were parsed by argparse but never applied to the ServerConfig, causing the server to always bind to 0.0.0.0:8000 regardless of what was passed.

Root Cause

apply_cli_overrides() in mcp_server/src/config/schema.py handled transport, LLM, embedder, database, and graphiti overrides but skipped host and port.

Changes

  • mcp_server/src/config/schema.py: Added host and port overrides in apply_cli_overrides(), placed right after the existing transport override since they're all ServerConfig fields
    • Used args.port is not None (not args.port) to correctly handle port 0 as a valid value
  • mcp_server/tests/test_configuration.py: Added assertions for host and port override, plus a separate test case verifying defaults are preserved when CLI flags are omitted

Verification

# Before: always binds to 0.0.0.0:8000
graphiti-mcp-server --transport sse --host 127.0.0.1 --port 9999

# After: correctly binds to 127.0.0.1:9999

Test plan

  • Existing CLI override test updated with host/port assertions
  • Added MinimalArgs test to verify defaults are preserved when flags are None
  • Verified port=0 edge case is handled correctly (is not None vs truthy check)

@danielchalef

danielchalef commented Apr 4, 2026

Copy link
Copy Markdown
Member

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Maanik23

Maanik23 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

danielchalef added a commit that referenced this pull request Apr 4, 2026
@Maanik23
Maanik23 force-pushed the fix/cli-host-port-flags branch 2 times, most recently from f9d5ce5 to f0ebd29 Compare April 25, 2026 12:12
@Maanik23
Maanik23 force-pushed the fix/cli-host-port-flags branch from f0ebd29 to e07a126 Compare May 7, 2026 13:31
@danielchalef
danielchalef force-pushed the fix/cli-host-port-flags branch from e07a126 to 1df3c9f Compare June 7, 2026 00:31
The --host and --port flags were parsed by argparse but never applied
to the ServerConfig, causing the server to always bind to 0.0.0.0:8000.

Added the missing overrides in apply_cli_overrides() and updated tests
to verify both the override behavior and default preservation.

Fixes getzep#1333
@danielchalef
danielchalef force-pushed the fix/cli-host-port-flags branch from 1df3c9f to c1e358a Compare June 8, 2026 01:46
@danielchalef

Copy link
Copy Markdown
Member

Rebased onto current main (post the MCP modernization/parity merges) — clean, no conflicts. Reviewed: the fix correctly adds host/port handling to apply_cli_overrides (the flags were parsed and consumed at graphiti_mcp_server.py but never applied to config), mirroring the existing override pattern; tests assert both the override and default-preservation paths (5 passing). CLA is signed. LGTM — ready to merge.

danielchalef added a commit that referenced this pull request Jun 8, 2026
The live MCP test self-skips when prerequisites are absent — notably on fork
PRs, which get no OPENAI_API_KEY (environment secret), and when FalkorDB is
unreachable. pytest then collects 0 tests and exits 5, which GitHub marks as a
failed check (seen on fork PR #1376). Wrap the run so exit 5 is treated as
success; a real failure (exit 1) still fails the job.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@danielchalef danielchalef left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution!

@danielchalef
danielchalef merged commit 92b617b into getzep:main Jun 8, 2026
14 checks passed
@zep-cla-assistant zep-cla-assistant Bot locked and limited conversation to collaborators Jun 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: --host and --port CLI flags ignored by apply_cli_overrides

2 participants