Add $PORT env var overrides for MCP agent port assignment #1
Reference in New Issue
Block a user
Delete Branch "port-env-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary\n\n- Add
$PORTand$PORT_GRPCenvironment variable support toconfig.Load\n- After TOML and generic env overrides, checks$PORT→ overridesServer.ListenAddr,$PORT_GRPC→ overridesServer.GRPCAddr\n- Takes precedence over all other config sources (agent-assigned authoritative binding)\n- Handles bothconfig.Baseembedding (MCR, MCNS, MCAT) and directServerConfigembedding (Metacrypt) via struct tree walking\n\n## Test plan\n\n- [x]TestPortEnvOverridesListenAddr— $PORT sets listen addr\n- [x]TestPortGRPCEnvOverridesGRPCAddr— $PORT_GRPC sets gRPC addr\n- [x]TestPortEnvOverridesTOMLValue— $PORT wins over TOML\n- [x]TestPortEnvOverridesGenericEnv— $PORT wins over generic env overrides\n- [x]TestNoPortEnvNoChange— no $PORT leaves values unchanged\n- [x]TestPortEnvDirectServerConfig— works with Metacrypt-style embedding\n- [x] All 20 config tests pass