No Way to Pass Custom Headers (e.g., Authorization) When Using go-sdk to Connect to MCP Server
When using the go-sdk to communicate with an MCP server that requires authentication, there is currently no documented or supported way to pass custom HTTP headers (e.g., Authorization, x-api-key, etc.) during the connection or request initialization.
Right now, this is done with a custom HTTP client. #595 is an in-progress PR with an example, but per @jba's comment, we updated the experimental client-side oauth support to make this example more ergonomic.
Leaving this open to track documentation.
@findleyr Could you please share me example on how to do pass custom headers with custom HTTP client ?
@NiharDoshi99 I also was wondering the same, I saw an example somewhere but I'm unable to find it again for now.
But you might find my implementation here helpful. It is not the best though.