feat: configurable listen port/host and proxy auto-start#21
Open
Arkptz wants to merge 1 commit into
Open
Conversation
Add --port/--host (MITMPROXY_PORT/MITMPROXY_HOST) and --auto-start (MITMPROXY_AUTO_START) so the proxy can bind a chosen port and come up on server startup instead of waiting for the start_proxy tool call. start_proxy() now falls back to the configured default port when called without one, so a wrapper can pin a per-agent port that the browser also targets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds CLI flags and environment variables to configure the proxy listen
address and to auto-start the proxy on server boot, instead of requiring
a
start_proxytool call.Changes
--port/MITMPROXY_PORT— proxy listen port (default 8080)--host/MITMPROXY_HOST— proxy listen host (default 127.0.0.1)--auto-start/MITMPROXY_AUTO_START— start the proxy immediately onstartup via a FastMCP
lifespan, stopped cleanly on shutdownstart_proxy(port=None)now falls back to the configured default port, so asingle configured port is honored whether the proxy is started lazily (tool
call) or eagerly (auto-start)
Motivation
Running multiple MCP server instances side by side requires pinning each to its
own listen port and bringing the proxy up without an explicit tool call. Keeping
the default port in one place means
start_proxyand auto-start always agree, soany client pointed at the configured port connects regardless of how the proxy
was started.
Testing
--dump-filestart_proxybehavior unchanged when a port is passed explicitlyNotes