LibreChat/api/server/controllers
Danny Avila fb3b299de6
🪪 feat: Add Agent Identity to Provider and MCP Header Templates (#18113)
* feat: resolve executing agent ids in MCP header templates

* test: preserve MCP config source literal types

* 🪪 feat: Forward the Active Agent Id in Request Header Placeholders

A gateway in front of LibreChat sees the user, the conversation and the
message, but not which agent is running — so it cannot attribute spend per
agent, apply per-agent limits, or tell agent traffic from plain chat. Adds
`{{LIBRECHAT_AGENT_ID}}` as its own namespace beside the user / body / OpenID
ones, resolving wherever the existing request placeholders already work.

The value is the primary agent's, derived once per run, so subagent steps and
auxiliary calls (summarization, titles, activity labels, memory extraction)
forward the id of the turn they belong to rather than their own. Only
persisted agents resolve: ephemeral ids embed user-authored preset text that
is unsafe in a header value, so ephemeral runs and non-agent requests resolve
to an empty value rather than forwarding literal template text.

No behaviour change unless the placeholder is configured. The MCP surface
(#14303) is not covered — its connection classification derives from
`ALLOWED_BODY_FIELDS`, so a new namespace needs a follow-up.

(cherry picked from commit 8a3f1016f0)

* test: cover shared provider and MCP agent header resolution

* docs: clarify absent agent placeholder resolution

* fix: preserve agent header boundaries across transport lifecycles

* fix: retain Google header provenance during agent resolution

---------

Co-authored-by: Jiří Krejčí <51734696+krejcji@users.noreply.github.com>
2026-11-13 13:02:39 -05:00
..
__tests__ 🚜 feat: Support Native PostgreSQL Tool Favorites (#18032) 2026-11-11 12:07:07 -05:00
agents 🪪 feat: Add Agent Identity to Provider and MCP Header Templates (#18113) 2026-11-13 13:02:39 -05:00
assistants 🛝 perf: Render Chats Independently of Catalog Discovery (#17692) 2026-11-09 11:11:22 -05:00
auth ⚡ fix: Parallelize Setup Cancel Lookups and Keep Attachment Drafts on Reload (#17963) 2026-11-09 21:57:01 +01:00
AuthController.js 🛂 fix: Only Hand Out OpenID Access Tokens the Bearer Verifier Accepts (#17904) 2026-11-08 23:40:21 +01:00
AuthController.spec.js 🛂 fix: Only Hand Out OpenID Access Tokens the Bearer Verifier Accepts (#17904) 2026-11-08 23:40:21 +01:00
avatar.contentFilter.spec.js 🛍️ fix: Discover Managed Agents in Marketplace Search (#16324) 2026-09-24 22:48:56 -04:00
Balance.js 📏 fix: Measure Usage Percent Against the Allowance Each Period Granted (#17850) 2026-11-09 08:27:13 -05:00
Balance.spec.js 📏 fix: Measure Usage Percent Against the Allowance Each Period Granted (#17850) 2026-11-09 08:27:13 -05:00
EndpointController.js
FavoritesController.js
FavoritesController.spec.js
mcp.js 🔐 fix: Fence ACL Viewers and Surface Revocation Failures When Removing Shared MCP Servers (#17506) 2026-10-28 00:37:07 +01:00
mcpApps.js 🐛 fix: Restore MCP App Rendering and Actions (#16382) 2026-10-16 13:27:29 -07:00
mcpApps.test.js 🐛 fix: Restore MCP App Rendering and Actions (#16382) 2026-10-16 13:27:29 -07:00
ModelController.js 🛝 perf: Render Chats Independently of Catalog Discovery (#17692) 2026-11-09 11:11:22 -05:00
ModelController.spec.js 🧭 perf: Validate Agent Models Against Their Own Endpoint Catalog (#17972) 2026-11-10 17:33:29 +01:00
PermissionsController.js 🥸 fix: Resolve Directory Principals Through Trusted Integration Data (#17825) 2026-11-10 09:22:08 -05:00
PluginController.js 🔭 feat: Admin Config Read APIs (Resolved and Effective Config, Scope Catalog, Env Status) (#17383) 2026-10-24 09:23:22 +02:00
PluginController.spec.js 🪦 refactor: Remove Dead Legacy API Modules and Root Tooling (#17114) 2026-10-15 12:25:24 +02:00
ReasoningCapabilitiesController.js 🎚️ feat: Filter OpenRouter Reasoning Efforts by the Selected Model (#16808) 2026-10-08 18:04:13 +02:00
SkillStatesController.js 🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043) 2026-10-16 09:05:05 -07:00
TokenConfigController.js 🛝 perf: Render Chats Independently of Catalog Discovery (#17692) 2026-11-09 11:11:22 -05:00
tools.js 🪦 chore: Retire the DALL-E 3 Tool (#17205) 2026-10-17 18:24:22 +02:00
TwoFactorController.js 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
UserController.js 🚜 feat: Support Native PostgreSQL Tool Favorites (#18032) 2026-11-11 12:07:07 -05:00
UserController.spec.js 🚜 feat: Support Native PostgreSQL Tool Favorites (#18032) 2026-11-11 12:07:07 -05:00