This commit adds dynamic OAuth client registration capability to the proxy.ts implementation, bringing it in line with the client.ts functionality. The proxy can now successfully connect to MCP servers that require dynamic client registration. The changes include:
- Adding client registration check and flow to connectToRemoteServer
- Safely handling optional saveClientInformation method
- Proper error handling for auth providers that don't support registration
- Consistent logging throughout the registration process
Previously, the proxy would fail to connect to servers requiring dynamic registration, while the client worked fine. This change ensures both components have the same capabilities for OAuth authentication.
This commit adds dynamic OAuth client registration capability to the proxy.ts implementation, bringing it in line with the client.ts functionality. The proxy can now successfully connect to MCP servers that require dynamic client registration. The changes include:
- Adding client registration check and flow to connectToRemoteServer
- Safely handling optional saveClientInformation method
- Proper error handling for auth providers that don't support registration
- Consistent logging throughout the registration process
Previously, the proxy would fail to connect to servers requiring dynamic registration, while the client worked fine. This change ensures both components have the same capabilities for OAuth authentication.
When using Bearer token authentication, the Authorization header was not being properly forwarded to SSE connections, causing 401 Unauthorized errors. This fix adds a custom EventSource initialization that explicitly includes the Authorization header in all SSE requests, allowing proper authentication with remote servers.