Repository navigation
fix(dxt): apply user_config settings to the server - #86
Merged
Merged
Conversation
The DXT manifest passed WS_PORT, HTTP_PORT, ENABLE_TUNNEL and SAFETY_MODE to
the server as env variables, but server.js only reads command-line flags, so
every DXT setting was ignored and the server always started on 5555/5556
without a tunnel.
Server: read OPENDIA_WS_PORT, OPENDIA_HTTP_PORT, OPENDIA_ENABLE_TUNNEL and
OPENDIA_TOKEN as fallbacks. Flags always win (--port still sets both ports,
http = port+1). Env ports go through the same validation as the flags and a
bad value is a usage error. An empty value, or a raw ${user_config.x}
placeholder that a host left unsubstituted, counts as unset, so a blank
optional DXT field never becomes a token or a port.
DXT manifest: map the settings onto the OPENDIA_* names, add an optional
sensitive Tunnel Auth Token setting, and drop the Safety Mode setting, which
had no server code behind it. Safety Mode stays the extension popup toggle.
Extension: add a Custom HTTP Port field to the popup, saved to
storage.local.customHttpPort and probed first during port discovery, so a
server moved off the built-in port list can still be found. Shared src, so
both the Chrome and Firefox builds get it.
Tests: new test-config.js covers env ports, flag precedence, bad env ports,
tunnel and token from env, and blank token values; test-connection.js checks
the custom port is probed first. Both run in npm test and CI.
Rebuilt opendia.dxt (was a stale 1.0.5 build) and documented the env
variables and the popup field.
Fixes #85
The rebuilt bundle grew from 12.7 MB to 36 MB because build-dxt.sh packs the extension three times. Rebuild it after the build script is slimmed down in a follow-up.
This was referenced Oct 3, 2026
Merged
aaronjmars
added a commit
that referenced
this pull request
Oct 3, 2026
Ships #86 (DXT settings now reach the server, custom HTTP port in the extension popup) and #87 (slim DXT bundle). - opendia-mcp 1.1.3 -> 1.1.4 (package.json, lockfile, SERVER_VERSION) - extension 1.1.0 -> 1.1.1 (package.json, lockfile, both manifests) - opendia.dxt rebuilt at 1.1.4 - README points at the latest release zips instead of the 1.1.0 names
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.
What was broken
The Claude Desktop DXT handed its settings (WebSocket Port, HTTP Port, Auto-Tunnel, Safety Mode) to the server as
WS_PORT,HTTP_PORT,ENABLE_TUNNELandSAFETY_MODEenv variables.server.jsnever reads the environment, only command-line flags, so every DXT setting was silently ignored: the server always started on 5555/5556 with no tunnel. Safety Mode had no server code at all; it only exists as the extension popup toggle. The committedopendia.dxtwas also a stale 1.0.5 build.What changed
Server (
opendia-mcp/server.js)OPENDIA_WS_PORT,OPENDIA_HTTP_PORT,OPENDIA_ENABLE_TUNNEL(1/true/yes, any case) andOPENDIA_TOKENas fallbacks.--portstill sets both ports (http = port+1) and overrides both env ports.OPENDIA_HTTP_PORT=0x1f is not a valid port ...).OPENDIA_TOKENfeeds the same path as--token=, so it only applies when a token is required (tunnel or non-loopback bind).${user_config.x}placeholder, because some hosts pass an unset optional field through unsubstituted (fix: resolve user config placeholders modelcontextprotocol/mcpb#252). A blank optional field can never become the token.DXT manifest (
build-dxt.sh)OPENDIA_*names.safety_modesetting andSAFETY_MODEenv, since they never did anything. The field descriptions now say Safety Mode is set in the extension popup.auth_tokensetting (Tunnel Auth Token) mapped toOPENDIA_TOKEN. Leaving it blank keeps the old behavior: a fresh token is generated and printed at startup.Extension (popup + background)
storage.local.customHttpPort(blank clears it, invalid input reverts).src/, so Chrome and Firefox both get it. Storage is read with the promise form, which works on Chrome MV3 and Firefox's nativebrowser.*.Tests, docs, build
opendia-mcp/test-config.js(env ports, flag precedence, bad env ports, tunnel and token from env, blank or placeholder token). It runs innpm testand as a new CI step.test-connection.jsnow checks that the custom port is probed first.test-helpers.jsstartServeracceptsargs/env.opendia.dxtis not rebuilt here. A fresh build is 36 MB (vs 12.7 MB) becausebuild-dxt.shbundles the extension source plus bothdist/builds, each withlogo.mp4; the bundle gets slimmed and rebuilt in a follow-up PR.No version bump; recent fix PRs (#82, #83) did not bump either.
How verified
npm testinopendia-mcp: protocol, connection (including 3 new custom-port checks) and 16 new config checks all pass.OPENDIA_WS_PORT=46162 OPENDIA_HTTP_PORT=46163 node server.js->/portsreturned{"websocket":46162,"http":46163,...}--ws-port=46172 --http-port=46173->Ports resolved: WebSocket=46172, HTTP=46173OPENDIA_HTTP_PORT=0x1f node server.js->OPENDIA_HTTP_PORT=0x1f is not a valid port (expected an integer 1-65535), exit 1${user_config.auth_token}). It bound the env ports in local mode.npm run build,node build.js validateandnode test-extension.jspass.web-ext lintshows 0 errors and the same 3 warnings asmain.Fixes #85