Skip to content

[FEATURE]: Add HTTP/SOCKS5 proxy support for outbound requests #37036

Closed

Description

@0x80x

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem

OpenCode doesn't support HTTP/HTTPS or SOCKS5 proxies. Users behind corporate firewalls can't use it with LLM providers, the webfetch tool, or any other outbound feature. The existing proxy-env.ts reads HTTP_PROXY but only applies it to WebSocket connections.

Solution

Add proxy support to opencode.json (fallback to env vars):

{
  "proxy": {
    "url": "http://proxy:8080",
    // or "socks5://proxy:1080"
    "noProxy": ["localhost", "*.internal.com"]
  }
}

Wire it into all outbound paths via a single proxy-aware fetch wrapper:

  • LLM API calls (both AI SDK and native runtime) — via options.fetch / FetchHttpClient
  • webfetch tool, config fetching, session instructions — via HttpClient
  • WebSocket connections — extend existing proxy-env.ts with SOCKS5
  • Direct fetch() calls (LSP downloads, auth, CLI) — via global fetch wrapper
  • MCP servers — pass proxy env vars to child processes

Implementation

  1. proxy-fetch.ts — proxy-aware fetch wrapper (HTTP via undici, SOCKS5 via socks-proxy-agent)
  2. Add proxy field to config schema
  3. Inject proxy fetch into provider options and FetchHttpClient service
  4. Extend proxy-env.ts with SOCKS5 parsing
  5. Pass proxy env to MCP child processes
    No new deps for HTTP proxy. SOCKS5 is optional.

Activity

  1. github-actions commented on Jul 15, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review these issues to see if your request is already tracked. If your issue covers something not addressed there, consider adding a comment to the most relevant open issue instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions