Skip to content

feat: add HTTP/HTTPS proxy support via undici ProxyAgent#126

Merged
RyanLee-Dev merged 1 commit intomainfrom
feat/proxy-support
May 11, 2026
Merged

feat: add HTTP/HTTPS proxy support via undici ProxyAgent#126
RyanLee-Dev merged 1 commit intomainfrom
feat/proxy-support

Conversation

@RyanLee-Dev
Copy link
Copy Markdown
Collaborator

Summary

  • Use undici ProxyAgent + setGlobalDispatcher at startup — all fetch() calls go through proxy automatically, zero call-site changes
  • Support config file proxy: mmx config set --key proxy --value http://HOST:PORT
  • Proxy priority: HTTPS_PROXY > HTTP_PROXY > ALL_PROXY > config file
  • Improve network error hints to guide users toward proxy setup instead of misleading "check proxy settings"

Supersedes #101, closes #96

Changes

File What
main.ts Inject ProxyAgent at startup
config/schema.ts Add proxy field to ConfigFile
commands/config/set.ts Allow mmx config set --key proxy with URL validation
commands/config/show.ts Display configured proxy
errors/handler.ts Honest network error hints
build.ts Mark undici as external
package.json Add undici dependency

Why not PR #101's approach

PR #101 adds 120-line custom proxy module + replaces every fetch() call site (12 files, +655/-32). This PR achieves the same with setGlobalDispatcher — 8 files, +45/-7, zero invasiveness.

Test plan

  • HTTPS_PROXY=http://127.0.0.1:7890 mmx quota show — traffic goes through proxy (verified via local CONNECT proxy)
  • mmx config set --key proxy --value http://127.0.0.1:7890 then mmx quota show — same
  • No proxy configured — direct connection, no warnings
  • TypeScript typecheck passes
  • 143 tests pass

Use undici's ProxyAgent + setGlobalDispatcher to inject proxy at
startup — all fetch calls go through it automatically without
touching any call site.

Proxy priority: HTTPS_PROXY > HTTP_PROXY > ALL_PROXY > config file.
Users can also persist via: mmx config set --key proxy --value URL

Supersedes #101, closes #96
@RyanLee-Dev RyanLee-Dev merged commit 5d7813d into main May 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mmx CLI does not respect HTTP_PROXY / HTTPS_PROXY environment variables

1 participant