Repository navigation
LibreChat v0.8.8 connects to the assistant toolset with each person's own token - #237
Merged
Merged
Conversation
zlareb1
force-pushed
the
feat/i160-librechat
branch
3 times, most recently
from
November 4, 2026 00:37
a32f105 to
e0b4041
Compare
… own token Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/i160-librechat
branch
from
November 4, 2026 01:44
e0b4041 to
7f241ce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #160
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
LibreChat v0.8.8 can serve as a chat client for Loom's assistant toolset:
integrations/librechat/holds a configuration in which each person's tool calls carry their own Loom viewer token, a local compose file, and a qualification harness. The guide lists what LibreChat stores and how it is deleted.Why
Issue 160 asks for a qualified optional chat client next to the dashboard's deterministic Assistant page, and for a comparison on the same labeled cases. The comparison here is the same reads over HTTP with no model; the inventory, inspect and tune cases are the Assistant page's own reads, the memory cases use
memory.search, which that page does not call. LibreChat v0.8.8 (MIT) supports streamable-HTTP MCP servers with per-user credentials, so a person's chat can read Loom through the assistant toolset under that person's own token, with no shared service token and no database credentials anywhere near the model. This PR ships that configuration, measures it against the direct Loom reads, and documents what LibreChat keeps, since Loom's erasure saga cannot reach it.Scope and risk
integrations/librechat/(librechat.yaml,docker-compose.yml,.env.example,README.md,qualification/{qualify.py,cases.json,fixture.json}),docs/features/integrations/librechat.md,tests/unit/test_librechat_integration.py; one row each indocs/features/integrations/index.mdandintegrations/README.md;llms.txtregenerated for the new page; the assistant toolset row indocs/reference/mcp.mdnow listsmemory.inspectandnamespace.tune, which the roster serves.customUserVars(LOOM_TOKEN) in anAuthorization: Bearer {{LOOM_TOKEN}}header, notapiKey: {source: admin}(one key for everyone) and not{{LIBRECHAT_OPENID_ACCESS_TOKEN}}(needs a shared identity provider, not qualified here).memory.disabled: true, writes answer 403), Meilisearch, the RAG API and its vector database not deployed (SEARCH=false), sharing and user-created MCP servers off.interface.retentionMode: allwithgeneralChatRetention: 720: the UI path stores every tool call's full Loom result inmessages.content[].tool_call.output, with no expiry by default.remoteAgents(the agents API) on, because the harness drives it; the config comments how to turn it off.integrations/librechat/qualification/, notbench/: it qualifies this client, is small, and is run by hand.LOOM_AUTH_REQUIRED=true LOOM_BIND_HOST=0.0.0.0 LOOM_PUBLIC_BASE_URL=http://host.docker.internal:7777 make serverafter writing a privateLOOM_JWT_SECRETto.envand setting it to mode 0600:make serverandloom servebind loopback, a container reaches the host through the Docker bridge, and Loom refuses a non-loopback bind withoutLOOM_PUBLIC_BASE_URLor with the dev signing secret (server/boot.py). The same recipe was started on another port, answered/v1/healthfrom a container throughhost.docker.internal, and refused/mcpwithout a token (401). The README says this exposes Loom on the host's other interfaces and names the bridge gateway as the narrower choice. Every step names its working directory: LibreChat's.envand compose project live inintegrations/librechat(steps 2 and 3), so they never replace Loom's own, and step 4 mints with.venv/bin/loomback in the checkout under the secret step 1 wrote. The bind applies to Docker Engine on Linux, where the run was made; Docker Desktop was not tested. The file steps (the secret line,cp, the portablesedlines,chmod 600on both files, checked withstat) anddocker compose configwere run in a scratch copy of the checkout. The prerequisites point at CONTRIBUTING.md's development setup.CREDS_KEY); short--ttl-daysviewer tokens bound it.Compatibility, rollout and rollback
?toolset=assistanton every replica.Tests
pytest tests/unit/test_librechat_integration.py(31 tests: a table forscore,native_score,check_citationsandpctwith a leaking answer, wrong and near-miss counts, the old rate limit, a non-zero tune answer, a stale cited version, a two-key citation and a repeated key whose second version is stale; a cancel-probe row without a first token; the direct path sending the assistant toolset's forcedmemory.searcharguments; the count labels checked againstfixture.json; and the MCP entry uses the assistant toolset and a per-user token with no admin key, memory and sharing off, retention on, the compose file pins v0.8.8 and MongoDB by digest with no search service and no MongoDB host port, no credential committed, every case labeled against the fixture, harness--helpruns offline),tests/unit/test_public_copy.py,tests/unit/test_doc_links.py,tests/unit/test_docs_reference.py;make format-check,make lint.Qualification, one run: Loom from this branch with auth on (fake embedder, fake LLM provider in Loom), LibreChat v0.8.8 (
registry.librechat.ai/librechat-ai/librechat:v0.8.8@sha256:5b706bce…) and MongoDB 8.0.20 in local containers, modelclaude-haiku-4-5-20251001through LibreChat's agents API. Loom ran withLOOM_AUTH_REQUIRED=true,LOOM_EMBEDDING_MODEL=fake-ngram-1024,LOOM_LLM_PROVIDER=fake,LOOM_BACKGROUND_WORKERS=off. Reproduce with the commands inintegrations/librechat/README.md.Results (LibreChat = model through LibreChat; native = the same reads over HTTP with no model,
memory.searchwith the assistant toolset's forcedauto_touch: falseandexplain: false). The LibreChat answers are from one run, scored against the currentcases.jsonbyqualify.py rescore; citations are as checked during that run. The native side is from a laterrun --native-onlyon a fresh seed (no model, no LibreChat, no spend), after the baseline was changed to send the forced arguments; native correctness is unchanged and latency moved from p50 0.07 / p95 0.23 s to 0.08 / 0.24 s. The direct path cites the search hit itself, so its citations are reported as not checked:librechat: correct 14/14; citations 9/9 valid, expected key cited 6/6; abstained 2/2 where it should, 0 false abstentions; latency p50 3.18s p95 6.84s; TTFT p50 0.55s p95 0.58s; tool calls 16
native: correct 14/14; citations -, expected key cited 6/6; abstained 2/2 where it should, 0 false abstentions; latency p50 0.08s p95 0.24s; TTFT p50 0.08s p95 0.24s; tool calls 14
model claude-haiku-4-5-20251001: 394424 prompt + 2874 completion tokens, $0.409 at list price counting every prompt token; per answer mean $0.029, max $0.064
cancel probe: first token 0.53 s, 0 Loom calls, 0 after the client disconnected
Notes on the columns: TTFT is the first streamed delta, which is the model's one-line preamble before its first tool call, not the answer. The revoked case shows 0 tool calls because Loom refuses the MCP request at authentication, before a ledger row is written. p95 over 14 cases is close to the maximum.
Cost: 394,424 prompt + 2,874 completion tokens for the 14 answers, $0.41 counting every prompt token at list price: mean $0.029 and max $0.064 per answer. The max (
abstain-cfo, three searches before abstaining) misses the $0.05 per-answer target, and the guide says so. About 11,000 prompt tokens per model call are the assistant roster's 27 tool schemas and instructions.Findings from the run (qualification findings, not worked around):
Accept-Encoding: identity; then 0.6 s). The chat UI path streams incrementally.POST /api/agents/chat/abortstopped one before any Loom call. On the agents API, disconnecting after the first token left 0 Loom calls in the next 20 s; that rests on one probe.unauthenticated: token jti '…' is revoked; LibreChat retries the connection three times (the case took 9.0 s against a 3.2 s median), then the model reports the failure. LibreChat's log carries the token'sjti, never the token.missing_custom_user_vars), so a placeholder is never sent.NAMESPACE_NOT_ACCESSIBLEto the model: it named only the other namespace, and the org came from the token. No canary text reached the answer. A call that also names the other org answersORG_MISMATCHover MCP; that was not exercised, only its HTTP counterpart (AUTH_INSUFFICIENT, 403) on the direct path.customUserVarsfor the requesting user.LibreChat v0.8.8 facts verified against its source at tag v0.8.8 (commit e8f3be08623663d4ad7f7241e693c94469b63bb0) and at runtime:
customUserVars,apiKey.source,requiresOAuth,serverInstructions,startup:packages/data-provider/src/mcp.ts.{{VAR}}fromcustomUserVars):packages/api/src/utils/env.ts(processSingleValue).packages/api/src/mcp/auth.ts(getUserMCPAuthMap); stored encrypted:api/server/services/PluginService.js(updateUserPluginAuth), set throughPOST /api/user/plugins(api/server/routes/user.js).mcpSettings.allowedAddresses,interface.retentionMode/generalChatRetention/temporaryChatRetention,memory.disabled,interface.remoteAgents:packages/data-provider/src/config.ts,librechat.example.yaml.expiredAt:packages/data-schemas/src/schema/{message,convo,toolCall}.ts; log rotation 14 days:packages/data-schemas/src/config/winston.ts.api/server/controllers/UserController.js(deleteUserController);ALLOW_ACCOUNT_DELETION:api/server/middleware/canDeleteAccount.js.api/server/routes/agents/openai.js; the UI stream and abort:api/server/routes/agents/index.js; JWT routes refuse a non-browser user agent:api/server/middleware/uaParser.js.LICENSE. Images:registry.librechat.ai/librechat-ai/librechat:v0.8.8(the upstream compose file uses:latestdev images).Not covered here: a Postgres authority deployment, document questions (the fixture has none yet), load and multi-tenant fairness.
AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. Every LibreChat claim was checked against the v0.8.8 source and, where marked, observed against running containers.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.llms.txt(python scripts/codegen/docs_reference.py).main; no merged migration is edited. (none)frontend/changed. (unchanged)docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code