Skip to content

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

Open
Maanik23 wants to merge 1 commit intogetzep:mainfrom
Maanik23:fix/cli-host-port-flags
Open

fix: apply --host and --port CLI flags in apply_cli_overrides#1376
Maanik23 wants to merge 1 commit intogetzep:mainfrom
Maanik23:fix/cli-host-port-flags

Conversation

@Maanik23
Copy link
Copy Markdown

@Maanik23 Maanik23 commented Apr 4, 2026

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)

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
Copy link
Copy Markdown
Member

danielchalef commented Apr 4, 2026

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

@Maanik23
Copy link
Copy Markdown
Author

Maanik23 commented Apr 4, 2026

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

danielchalef added a commit that referenced this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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