mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-09-22 16:15:34 +00:00
* fix: resolve customUserVars before first post-OAuth-callback MCP reconnect
The OAuth callback route reconnects the user's MCP connection immediately
after storing new tokens, but never resolves customUserVars before doing
so - unlike the /reinitialize route a few hundred lines below, which does.
As a result, headers/oauth_headers templates like `{{MY_KEY}}` are sent
to the MCP server literally, unsubstituted, on this first connection
attempt, even though the user's value is already saved. The upstream
server rejects it as an invalid credential.
Fixes #14537
* refactor: share getServerCustomUserVars reader from @librechat/api
The mcp_-prefixed key shape was built by getUserMCPAuthMap but re-derived
by hand at each read site (a private helper in services/MCP.js, and the
new callback-route extraction). Export a reader from the same module that
owns the writer and reuse it at both sites, so the key shape has a single
source of truth.
* chore: sort destructured require members in routes/mcp.js
---------
Co-authored-by: Danny Avila <danny@librechat.ai>
|
||
|---|---|---|
| .. | ||
| __tests__ | ||
| oauth | ||
| registry | ||
| types | ||
| auth.ts | ||
| cache.ts | ||
| connection.ts | ||
| ConnectionsRepository.ts | ||
| context.ts | ||
| enum.ts | ||
| errors.ts | ||
| mcpConfig.ts | ||
| MCPConnectionFactory.ts | ||
| MCPManager.ts | ||
| parsers.ts | ||
| request.ts | ||
| tools.spec.ts | ||
| tools.ts | ||
| UserConnectionManager.ts | ||
| utils.ts | ||
| zod.ts | ||