LibreChat/packages/api/src/mcp
Danny Avila d7d02766ea
🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095)
* feat: Add conversation ID support to custom endpoint headers

- Add LIBRECHAT_CONVERSATION_ID to customUserVars when provided
- Pass conversation ID to header resolution for dynamic headers
- Add comprehensive test coverage

Enables custom endpoints to access conversation context using {{LIBRECHAT_CONVERSATION_ID}} placeholder.

* fix: filter out unresolved placeholders from headers (thanks @MrunmayS)

* feat: add support for request body placeholders in custom endpoint headers

- Add {{LIBRECHAT_BODY_*}} placeholders for conversationId, parentMessageId, messageId
- Update tests to reflect new body placeholder functionality

* refactor resolveHeaders

* style: minor styling cleanup

* fix: type error in unit test

* feat: add body to other endpoints

* feat: add body for mcp tool calls

* chore: remove changes that unnecessarily increase scope after clarification of requirements

* refactor: move http.ts to packages/api and have RequestBody intersect with Express request body

* refactor: processMCPEnv now uses single object argument pattern

* refactor: update processMCPEnv to use 'options' parameter and align types across MCP connection classes

* feat: enhance MCP connection handling with dynamic request headers to pass request body fields

---------

Co-authored-by: Gopal Sharma <gopalsharma@gopal.sharma1>
Co-authored-by: s10gopal <36487439+s10gopal@users.noreply.github.com>
Co-authored-by: Dustin Healy <dustinhealy1@gmail.com>
2025-08-16 20:45:55 -04:00
..
__tests__ 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
oauth ♻️ refactor: MCPManager for Scalability, Fix App-Level Detection, Add Lazy Connections (#8930) 2025-08-13 11:45:06 -04:00
types 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
auth.ts 🐛 fix: MCP Name Normalization breaking User Provided Variables (#8644) 2025-07-24 10:44:58 -04:00
connection.ts 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
ConnectionsRepository.ts 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
enum.ts 🪐 feat: MCP OAuth 2.0 Discovery Support (#7924) 2025-06-17 13:50:33 -04:00
mcpConfig.ts ♻️ refactor: MCPManager for Scalability, Fix App-Level Detection, Add Lazy Connections (#8930) 2025-08-13 11:45:06 -04:00
MCPConnectionFactory.ts 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
MCPManager.ts 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
MCPServersRegistry.ts 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
parsers.ts 🔄 fix: Add Azure to Recognized and Content array providers for MCP Tool Calls (#9092) 2025-08-16 12:44:12 -04:00
UserConnectionManager.ts 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
utils.ts 🗝️ feat: User Provided Credentials for MCP Servers (#7980) 2025-06-19 18:27:55 -04:00
zod.ts 🔳 fix: Bare Object MCP Tool Schemas as Passthrough (#8637) 2025-07-24 00:11:20 -04:00