Skip to content

feat: add --http-host flag for custom bind address#115

Open
r33drichards wants to merge 1 commit intomainfrom
feature/http-host-flag
Open

feat: add --http-host flag for custom bind address#115
r33drichards wants to merge 1 commit intomainfrom
feature/http-host-flag

Conversation

@r33drichards
Copy link
Copy Markdown
Owner

Summary

Adds --http-host CLI argument to allow binding the HTTP server to a specific network interface instead of the default 0.0.0.0 (all interfaces).

Changes

  • Added --http-host CLI argument (default: 0.0.0.0)
  • Updated start_streamable_http() function signature to accept host parameter
  • Modified bind address construction to use format!("{}:{}", host, port)

Usage

# Bind to localhost only (secure, local access only)
server --http-port 3456 --http-host 127.0.0.1

# Bind to specific IP (e.g., dummy interface for subnet router)
server --http-port 3456 --http-host 172.31.255.1

# Default behavior (all interfaces)
server --http-port 3456

Use Cases

  • Security: Bind to 127.0.0.1 to prevent external access
  • Network segmentation: Bind to a specific interface IP
  • Subnet router: Bind to a dummy interface for Tailscale subnet routing
  • Multi-homed hosts: Choose which interface to listen on

Testing

Code compiles successfully (requires openssl-dev for full build). Changes are minimal and follow existing patterns in the codebase.

Backward Compatibility

✅ Fully backward compatible - defaults to 0.0.0.0 (existing behavior) when --http-host is not specified.

@r33drichards r33drichards force-pushed the feature/http-host-flag branch from e23fff3 to 8e15c85 Compare April 10, 2026 03:42
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

MCP-V8 Load Test Benchmark Report

Comparison of single-node vs 3-node cluster at various request rates.

Results

Topology Target Rate Actual Iter/s HTTP Req/s Exec Avg (ms) Exec p95 (ms) Exec p99 (ms) Success % Dropped Max VUs
cluster-stateful 100/s 62 1944.8 1491.82 4372.15 4541.28 100% 2017 100
cluster-stateful 200/s 63.4 3788 2953.77 5112.32 5167.58 67.7% 7876 200
cluster-stateless 1000/s 994.3 1719.2 54.54 176.6 740.22 24.3% 343 331
cluster-stateless 100/s 99.9 300.3 51.51 52.41 52.66 100% 3 13
cluster-stateless 200/s 199.5 601.9 52.73 52.84 60.01 100% 21 38
cluster-stateless 500/s 497.3 1270 45.66 53.88 111.59 71.1% 139 112
single-stateful 100/s 21.7 1902.4 4355.08 4802.42 4835.42 100% 4599 100
single-stateful 200/s 38.2 3760.6 4960.2 5188.36 5224.72 5.2% 9517 200
single-stateless 1000/s 199.4 1421.8 4845.28 10000.29 11906.79 95.8% 47704 1000
single-stateless 100/s 99.7 302.3 53.19 52.72 114.69 100% 11 21
single-stateless 200/s 199.1 600.3 53.74 53.97 96.66 100% 42 45
single-stateless 500/s 296 1502 1574.65 2864.33 3953.52 100% 11967 500

P95 Latency

Topology Rate P95 (ms)
cluster-stateful 100/s 4372.15 ███████████████████████████
cluster-stateful 200/s 5112.32 ████████████████████████████
cluster-stateless 100/s 52.41 █████████████
cluster-stateless 200/s 52.84 █████████████
cluster-stateless 500/s 53.88 █████████████
cluster-stateless 1000/s 176.6 █████████████████
single-stateful 100/s 4802.42 ████████████████████████████
single-stateful 200/s 5188.36 ████████████████████████████
single-stateless 100/s 52.72 █████████████
single-stateless 200/s 53.97 █████████████
single-stateless 500/s 2864.33 ██████████████████████████
single-stateless 1000/s 10000.29 ██████████████████████████████

Notes

  • Target Rate: The configured constant-arrival-rate (requests/second k6 attempts)
  • Actual Iter/s: Achieved iterations per second (each iteration = 1 POST /api/exec)
  • HTTP Req/s: Total HTTP requests per second (1 per iteration)
  • Dropped: Iterations k6 couldn't schedule because VUs were exhausted (indicates server saturation)
  • Topology: single = 1 MCP-V8 node; cluster = 3 MCP-V8 nodes with Raft

Adds --http-host (short: --host, -h) CLI argument to allow binding the
HTTP server to a specific network interface instead of the default 0.0.0.0.

Usage:
  server --http-port 3456 --http-host 127.0.0.1  # long form
  server --http-port 3456 --host 127.0.0.1       # alias
  server --http-port 3456 -h 127.0.0.1           # short form
  server --http-port 3456                        # default: 0.0.0.0

This enables use cases like:
- Binding to localhost for security (only local access)
- Binding to a specific interface IP for network segmentation
- Binding to a dummy interface for subnet router scenarios
@r33drichards r33drichards force-pushed the feature/http-host-flag branch from 8e15c85 to 2990cb8 Compare April 10, 2026 03:44
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.

1 participant