Skip to content

Conversation

@Josbleuet
Copy link
Contributor

Fixes the bug where secret references (e.g., ${env:CONTEXT7_API_KEY}) in HTTP headers were not being resolved before passing to upstream servers.

The resolution logic existed for environment variables and arguments but was missing for headers, causing raw placeholder strings to be sent in HTTP requests instead of actual secret values.

Changes:

  • Added header secret resolution in NewClientWithOptions after args resolution
  • Mirrors the same pattern used for env vars and args resolution
  • Added comprehensive test suite with 4 test cases covering:
    • Single secret resolution in headers
    • Multiple secrets in different headers
    • No headers (nil) case
    • Static headers without secret references

This fix enables proper authentication with services like Context7 that require API keys in headers using the secret management system.

Pull Request

Description

Brief description of the changes in this PR.

Testing

  • I have tested these changes locally
  • I have added/updated tests that prove my fix is effective or my feature works
  • All existing tests pass

Fixes the bug where secret references (e.g., ${env:CONTEXT7_API_KEY})
in HTTP headers were not being resolved before passing to upstream servers.

The resolution logic existed for environment variables and arguments but
was missing for headers, causing raw placeholder strings to be sent in
HTTP requests instead of actual secret values.

Changes:
- Added header secret resolution in NewClientWithOptions after args resolution
- Mirrors the same pattern used for env vars and args resolution
- Added comprehensive test suite with 4 test cases covering:
  * Single secret resolution in headers
  * Multiple secrets in different headers
  * No headers (nil) case
  * Static headers without secret references

This fix enables proper authentication with services like Context7 that
require API keys in headers using the secret management system.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Contributor

@Dumbris Dumbris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!
This is a clear improvement to the UX.

@Dumbris Dumbris merged commit 05fc9b1 into smart-mcp-proxy:main Jan 29, 2026
22 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