MCP OAuth Authentication - HTTP 401 invalid_token Error with Streamable-HTTP Transport #9588
-
What happened?After updating to the latest LibreChat version that includes commit 51f2d43, MCP servers using streamable-http transport with OAuth authentication are failing with HTTP 401 "invalid_token" errors. The OAuth token storage/retrieval mechanism appears to be broken, preventing successful authentication even when OAuth flow is completed. - Reverting back to before this commit allows it to work again. Version Informationghcr.io/danny-avila/librechat-dev-api latest 33b56b43d848 2 hours ago 1.27GB Steps to Reproduce
Google-Workspace:
What browsers are you seeing the problem on?No response Relevant log output{
"level": "error",
"message": "[MCP][User: 6809a0d05c439320acaa9969][Google-Workspace] Connection failed: Error POSTing to endpoint (HTTP 401): {\"error\": \"invalid_token\", \"error_description\": \"Authentication required\"}",
"stack": "Error: Error POSTing to endpoint (HTTP 401): {\"error\": \"invalid_token\", \"error_description\": \"Authentication required\"}\n at StreamableHTTPClientTransport.send (/app/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js:288:23)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
"timestamp": "2025-09-12T01:15:08.636Z"
} ScreenshotsNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
This MCP server behaves the same for me before and after the commit. Without any walkthrough on setting this up, I can't properly test this and troubleshoot. Seems to be different here than the repo you linked suggests. |
Beta Was this translation helpful? Give feedback.
-
This should fix it: #9589 Looks like cleaning up OAuth flow at connection change is a bit too strict as implemented in 51f2d43 and won't work for all MCP servers. |
Beta Was this translation helpful? Give feedback.
This should fix it: #9589
Looks like cleaning up OAuth flow at connection change is a bit too strict as implemented in 51f2d43 and won't work for all MCP servers.