LibreChat/api
Danny Avila 24c76c6cb9
🛜 feat: Support Legacy OAuth Servers without .well-known Metadata (#10917)
Adds support for MCP servers like StackOverflow that use OAuth but don't
provide standard discovery metadata at .well-known endpoints.

Changes:
- Add fallback OAuth endpoints (/authorize, /token, /register) when
  discoverAuthorizationServerMetadata returns undefined
- Add POST fallback in OAuth detection when HEAD returns non-401
  (StackOverflow returns 405 for HEAD, 401 for POST)
- Detect OAuth requirement from WWW-Authenticate: Bearer header even
  without resource_metadata URL
- Add fallback /token endpoint for token refresh when metadata
  discovery fails
- Add registration_endpoint to OAuthMetadata type

This mirrors the MCP SDK's behavior where it gracefully falls back to
default OAuth endpoint paths when .well-known metadata isn't available.

Tests:
- Add unit tests for detectOAuth.ts (POST fallback, Bearer detection)
- Add unit tests for handler.ts (fallback metadata, fallback refresh)
- Add StackOverflow to integration test servers

Fixes OAuth flow for servers that:
- Return 405 for HEAD requests (only support POST)
- Return 401 with simple "Bearer" in WWW-Authenticate
- Don't have .well-known/oauth-authorization-server endpoint
- Use standard /authorize, /token, /register paths
2025-12-11 12:31:24 -05:00
..
app 📑 refactor: File Search Citations Dual-Format Unicode Handling (#10888) 2025-12-10 13:25:56 -05:00
cache 🔄 refactor: Migrate Cache Logic to TypeScript (#9771) 2025-10-02 09:33:58 -04:00
config 📜 feat: Configurable Debug Message Length for Logs (#10447) 2025-11-10 21:40:37 -05:00
db 🔀 refactor: Only Cleanup Meili Sync if actually Synced 2025-10-05 22:41:40 -04:00
lib/utils 🏗️ refactor: Extract DB layers to data-schemas for shared use (#7650) 2025-05-30 22:18:13 -04:00
models refactor: Optimize & Standardize Tokenizer Usage (#10777) 2025-12-02 12:22:04 -05:00
server 🛜 feat: Support Legacy OAuth Servers without .well-known Metadata (#10917) 2025-12-11 12:31:24 -05:00
strategies 📬 refactor: Normalize Email Handling in User Methods (#10743) 2025-12-01 09:41:25 -05:00
test 🆔 feat: Add OpenID Connect Federated Provider Token Support (#9931) 2025-11-21 09:51:11 -05:00
utils 🤖 feat: Tool Calling Support for DeepSeek V3.2 + OpenRouter Reasoning (#10752) 2025-12-01 14:27:08 -05:00
jest.config.js 🏪 feat: Agent Marketplace 2025-08-13 16:24:18 -04:00
jsconfig.json feat(api): initial Redis support; fix(SearchBar): proper debounce (#1039) 2023-10-11 17:05:47 -04:00
package.json v0.8.1 (#10882) 2025-12-10 09:06:01 -05:00
typedefs.js 🤖 refactor: Improve Agent Handoff Context Tracking (#10553) 2025-11-17 16:57:51 -05:00