fix: respect user config in ngrok helper
This commit is contained in:
parent
49963ca58f
commit
bb64267c4d
|
|
@ -1,10 +1,10 @@
|
||||||
# Publishing mcp-browser with ngrok
|
# Publishing mcp-browser with ngrok
|
||||||
|
|
||||||
The `scripts/run_mcp_ngrok.sh` helper launches `mcp-browser` in
|
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
|
streamable-http mode and exposes it through an ngrok tunnel. By default it
|
||||||
provide `--config`, the script spins up an ephemeral config that exposes only
|
uses whatever server is marked as the default in your existing config (the same
|
||||||
the built-in tools. Otherwise it will respect your chosen server (or the
|
behaviour as running `mcp-browser` directly). Provide `--config` or `--server`
|
||||||
default entry in your config).
|
if you want to publish a different profile.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/run_mcp_ngrok.sh \
|
./scripts/run_mcp_ngrok.sh \
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ NGROK_OAUTH_SCOPES=()
|
||||||
NGROK_INSPECT="false"
|
NGROK_INSPECT="false"
|
||||||
MCP_EXTRA_ARGS=()
|
MCP_EXTRA_ARGS=()
|
||||||
NGROK_EXTRA_ARGS=()
|
NGROK_EXTRA_ARGS=()
|
||||||
TEMP_CONFIG=""
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
@ -105,21 +104,6 @@ while [[ $# -gt 0 ]]; do
|
||||||
esac
|
esac
|
||||||
done
|
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
|
if ! command -v "$MCP_BIN" >/dev/null 2>&1; then
|
||||||
echo "Error: mcp-browser binary '$MCP_BIN' not found" >&2
|
echo "Error: mcp-browser binary '$MCP_BIN' not found" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -165,7 +149,6 @@ NGROK_LOG=$(mktemp -t ngrok-mcp.XXXXXX.log)
|
||||||
cleanup() {
|
cleanup() {
|
||||||
[[ -n "${NGROK_PID:-}" ]] && kill "$NGROK_PID" >/dev/null 2>&1 || true
|
[[ -n "${NGROK_PID:-}" ]] && kill "$NGROK_PID" >/dev/null 2>&1 || true
|
||||||
[[ -n "${MCP_PID:-}" ]] && kill "$MCP_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
|
trap cleanup EXIT INT TERM
|
||||||
|
|
||||||
|
|
@ -175,7 +158,9 @@ MCP_PID=$!
|
||||||
ready=0
|
ready=0
|
||||||
for _ in {1..60}; do
|
for _ in {1..60}; do
|
||||||
if ! kill -0 "$MCP_PID" >/dev/null 2>&1; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
if grep -q "Streamable HTTP gateway listening" "$MCP_LOG"; then
|
if grep -q "Streamable HTTP gateway listening" "$MCP_LOG"; then
|
||||||
|
|
@ -186,7 +171,8 @@ for _ in {1..60}; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $ready -ne 1 ]]; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue