Skip to content

feat: add Basic and Digest authentication for upstream connections - #250

Merged
sparfenyuk merged 2 commits into
sparfenyuk:mainfrom
myhomeiot:main
Oct 10, 2026
Merged

sparfenyuk merged 2 commits into
sparfenyuk:mainfrom
myhomeiot:main

Conversation

@myhomeiot

Copy link
Copy Markdown
Contributor

MCP servers behind embedded Apache (or similar built-in HTTP frontends) often require Basic or Digest authentication. Bypassing that layer is usually impractical. Basic can already be forced with a static Authorization header, but Digest needs a proper challenge/response flow — and that is where most setups fall short.

Aside from a generic reverse proxy — which is not always convenient — I could not find an MCP proxy with Digest support for upstream connections. This change would make mcp-proxy the first of its kind in that niche.

mcp-proxy already forwards httpx.Auth into the Streamable HTTP and SSE clients, with OAuth2 client credentials wired the same way. Opening Basic and Digest through the CLI is a small, natural extension — reuse the existing HTTPX capability without changing the MCP transport.

  • --username / --password → httpx.BasicAuth
  • --username / --password / --digest → httpx.DigestAuth
  • full OAuth2 (--client-id + --client-secret + --token-url) still takes priority

Uses stock httpx.DigestAuth — no custom Digest implementation.

Verified against a real Streamable HTTP MCP endpoint with both Basic and Digest, including a full handshake rather than a single HTTP request.

sparfenyuk
sparfenyuk previously approved these changes Oct 10, 2026
@codecov

codecov Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/mcp_proxy/__main__.py 25.00% 12 Missing ⚠️

❌ Your patch check has failed because the patch coverage (25.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #250      +/-   ##
==========================================
- Coverage   89.37%   88.67%   -0.71%     
==========================================
  Files          12       12              
  Lines        1318     1333      +15     
  Branches       72       75       +3     
==========================================
+ Hits         1178     1182       +4     
- Misses        121      132      +11     
  Partials       19       19              
Files with missing lines Coverage Δ
src/mcp_proxy/__main__.py 44.44% <25.00%> (-1.82%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 153a96a...fbc444b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sparfenyuk
sparfenyuk merged commit 74aa61a into sparfenyuk:main Oct 10, 2026
15 of 16 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.

2 participants