Skip to content

fix(mcp): honour --proxy in OAuth well-known JSON fetcher - #5

Open
hannanmax wants to merge 1 commit into
hackwither:mainfrom
hannanmax:fix/proxy-well-known
Open

hannanmax wants to merge 1 commit into
hackwither:mainfrom
hannanmax:fix/proxy-well-known

Conversation

@hannanmax

@hannanmax hannanmax commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Problem

fetchWellKnownJSON created its own http.Client with a hardcoded 10-second timeout, bypassing the httpx.Client that --proxy, --insecure, --timeout, --rate-limit, and the global retry policy are all threaded through.

This meant the two OAuth metadata checks (mcp-oauth-metadata-posture and mcp-redirect-uri-laxity) silently skipped the proxy — breaking interception with Burp Suite or mitmproxy and ignoring the user's --timeout setting.

Fix

  • Accept *httpx.Client in fetchWellKnownJSON and call client.HTTP().Do(req) instead of a locally-constructed client
  • Thread the client through BuiltinProbes(client *httpx.Client) to the two probe structs that call the fetcher
  • Remove the now-unused time import
  • Update cli.go to pass opts.client at the registration site

This matches the existing pattern in internal/probe/transport, where BuiltinProbes(client) already accepted the client for the same reason.

fetchWellKnownJSON created its own http.Client with a hardcoded 10s
timeout, bypassing the httpx.Client that --proxy, --insecure,
--timeout, --rate-limit, and the global retry policy are all threaded
through. This meant OAuth metadata checks silently skipped the proxy,
which broke interception with Burp or mitmproxy.

- Accept *httpx.Client in fetchWellKnownJSON and use client.HTTP().Do()
- Thread the client through BuiltinProbes(client) to the two probe
  structs that call the fetcher
- Update cli.go to pass opts.client at the registration site
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.

1 participant