From bb64267c4db9f8150aad89108f5a47d58600b5d7 Mon Sep 17 00:00:00 2001 From: gpt-5-codex Date: Sat, 11 Oct 2025 07:52:25 +0200 Subject: [PATCH] fix: respect user config in ngrok helper --- docs/NGROK.md | 8 ++++---- scripts/run_mcp_ngrok.sh | 24 +++++------------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/docs/NGROK.md b/docs/NGROK.md index fc9c9ad..58cdbe0 100644 --- a/docs/NGROK.md +++ b/docs/NGROK.md @@ -1,10 +1,10 @@ # Publishing mcp-browser with ngrok The `scripts/run_mcp_ngrok.sh` helper launches `mcp-browser` in -streamable-http mode and exposes it through an ngrok tunnel. If you do not -provide `--config`, the script spins up an ephemeral config that exposes only -the built-in tools. Otherwise it will respect your chosen server (or the -default entry in your config). +streamable-http mode and exposes it through an ngrok tunnel. By default it +uses whatever server is marked as the default in your existing config (the same +behaviour as running `mcp-browser` directly). Provide `--config` or `--server` +if you want to publish a different profile. ```bash ./scripts/run_mcp_ngrok.sh \ diff --git a/scripts/run_mcp_ngrok.sh b/scripts/run_mcp_ngrok.sh index 51f8b05..73d1d01 100755 --- a/scripts/run_mcp_ngrok.sh +++ b/scripts/run_mcp_ngrok.sh @@ -54,7 +54,6 @@ NGROK_OAUTH_SCOPES=() NGROK_INSPECT="false" MCP_EXTRA_ARGS=() NGROK_EXTRA_ARGS=() -TEMP_CONFIG="" while [[ $# -gt 0 ]]; do case "$1" in @@ -105,21 +104,6 @@ while [[ $# -gt 0 ]]; do esac done -if [[ -z "$CONFIG_PATH" ]]; then - TEMP_CONFIG=$(mktemp -t mcp-ngrok-config.XXXXXX.yaml) - cat <<'EOF' > "$TEMP_CONFIG" -servers: - builtin-only: - name: builtin-only - command: null -default_server: builtin-only -sparse_mode: true -enable_builtin_servers: true -EOF - CONFIG_PATH="$TEMP_CONFIG" - [[ -z "$SERVER_NAME" ]] && SERVER_NAME="builtin-only" -fi - if ! command -v "$MCP_BIN" >/dev/null 2>&1; then echo "Error: mcp-browser binary '$MCP_BIN' not found" >&2 exit 1 @@ -165,7 +149,6 @@ NGROK_LOG=$(mktemp -t ngrok-mcp.XXXXXX.log) cleanup() { [[ -n "${NGROK_PID:-}" ]] && kill "$NGROK_PID" >/dev/null 2>&1 || true [[ -n "${MCP_PID:-}" ]] && kill "$MCP_PID" >/dev/null 2>&1 || true - [[ -n "$TEMP_CONFIG" && -f "$TEMP_CONFIG" ]] && rm -f "$TEMP_CONFIG" } trap cleanup EXIT INT TERM @@ -175,7 +158,9 @@ MCP_PID=$! ready=0 for _ in {1..60}; do if ! kill -0 "$MCP_PID" >/dev/null 2>&1; then - echo "mcp-browser exited early. See $MCP_LOG" >&2 + echo "mcp-browser exited early. Recent log output:" >&2 + tail -n 40 "$MCP_LOG" >&2 || true + wait "$MCP_PID" >/dev/null 2>&1 || true exit 1 fi if grep -q "Streamable HTTP gateway listening" "$MCP_LOG"; then @@ -186,7 +171,8 @@ for _ in {1..60}; do done if [[ $ready -ne 1 ]]; then - echo "Gateway did not become ready. See $MCP_LOG" >&2 + echo "Gateway did not become ready within timeout. Recent log output:" >&2 + tail -n 40 "$MCP_LOG" >&2 || true exit 1 fi