feat: support initial connection type via query param and CLI flag#1498
Open
marc-antoinejean-optable wants to merge 1 commit into
Open
Conversation
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 an "initial connection type" configuration knob (
"direct"or"proxy"), mirroring the existingtransport/serverUrlplumbing already supported onmain:?connectionType=direct|proxyquery param (URL-mode)--connection-type <direct|proxy>CLI flag, forwarded byclient/bin/start.jsdefaultConnectionTypefield on the/configresponse, consumed by the clientValues are whitelisted to
"direct" | "proxy"at every read site (getInitialConnectionTypeand the/confighandler). Unknown values fall through to the previous behavior:localStorage.lastConnectionType, defaulting to"proxy"— so there is no behavior change unless a user opts in.This is parity work, not a new concept: the same plumbing was added for
transport/serverUrlin 7ea47c0.Type of Change
Changes Made
server/src/index.ts: register--connection-typeinparseArgs; exposedefaultConnectionTypeon the/configresponse.client/bin/start.js: accept--connection-typeCLI flag; forward asMCP_CONNECTION_TYPEenv var in dev mode and as--connection-type=...arg in prod mode (matching the existingtransport/serverUrlhandling).client/src/utils/configUtils.ts: newgetInitialConnectionType()helper — reads?connectionType=query param, falls back tolocalStorage.lastConnectionType, defaults to"proxy".client/src/App.tsx: usegetInitialConnectionTypeas theuseStateinitializer; applydefaultConnectionTypefrom/configwhen valid ("direct" | "proxy"only).README.md: document the newconnectionTypequery param.Related Issues
None found
Testing
--transportor--server-urlTest Results and/or Instructions
npm run devChecklist
npm run prettier-fix)Breaking Changes
None
Additional Context
This is additive UX and not a strict bug fix or spec-compliance change, so I understand if it's deferred to V2. Framing the diff as a extension of an existing pattern (
transport/serverUrl->connectionType).