@lenne.tech/nest-server 12.8.5 → 12.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/.claude/rules/configurable-features.md +2 -1
  2. package/.claude/rules/testing.md +3 -3
  3. package/FRAMEWORK-API.md +1 -1
  4. package/dist/core/common/interfaces/server-options.interface.d.ts +1 -0
  5. package/dist/core/modules/ai/core-ai-mcp.controller.d.ts +1 -0
  6. package/dist/core/modules/ai/core-ai-mcp.controller.js +11 -0
  7. package/dist/core/modules/ai/core-ai-mcp.controller.js.map +1 -1
  8. package/dist/core/modules/ai/helpers/ai-mcp-oauth-consent.helper.d.ts +33 -0
  9. package/dist/core/modules/ai/helpers/ai-mcp-oauth-consent.helper.js +74 -9
  10. package/dist/core/modules/ai/helpers/ai-mcp-oauth-consent.helper.js.map +1 -1
  11. package/dist/core/modules/ai/index.d.ts +2 -2
  12. package/dist/core/modules/ai/index.js +1 -1
  13. package/dist/core/modules/ai/index.js.map +1 -1
  14. package/dist/core/modules/ai/services/core-ai-mcp-oauth.service.d.ts +17 -1
  15. package/dist/core/modules/ai/services/core-ai-mcp-oauth.service.js +124 -8
  16. package/dist/core/modules/ai/services/core-ai-mcp-oauth.service.js.map +1 -1
  17. package/docs/REQUEST-LIFECYCLE.md +1 -1
  18. package/migration-guides/12.8.5-to-12.8.6.md +144 -0
  19. package/package.json +1 -1
  20. package/src/core/common/interfaces/server-options.interface.ts +18 -0
  21. package/src/core/modules/ai/INTEGRATION-CHECKLIST.md +8 -0
  22. package/src/core/modules/ai/README.md +66 -0
  23. package/src/core/modules/ai/core-ai-mcp.controller.ts +17 -0
  24. package/src/core/modules/ai/helpers/ai-mcp-oauth-consent.helper.ts +150 -11
  25. package/src/core/modules/ai/index.ts +5 -1
  26. package/src/core/modules/ai/services/core-ai-mcp-oauth.service.ts +222 -8
@@ -352,7 +352,8 @@ This pattern is currently applied to:
352
352
  | Outbound URL Guard (SSRF) | `security.allowPrivateOutboundTargets` | Explicit Boolean with DERIVED default | **Opt-in helper for URLs a USER entered** (webhooks, export targets, ERP addresses) — `outboundFetch()`, `assertOutboundUrlAllowed()`, `createOutboundDispatcher()` in `common/helpers/outbound-url.helper.ts` (11.42.0). Nothing is applied globally: configured targets (AI providers, SMTP, S3, Redis, Brevo) never go through it. Refuses loopback, RFC 1918, link-local incl. `169.254.169.254`, CGNAT, `0/8`, benchmarking, multicast/reserved, IPv6 unspecified/loopback/IPv4-compatible (`::/96`), NAT64, ULA, link-local and multicast, and IPv4-mapped IPv6 in every notation (canonicalised through the URL parser). Checked TWICE: on the URL before sending (readable `OutboundUrlBlockedError`) and on every connection through an undici `Agent` with a guarded connector — the only place that sees a redirect's next hop and a DNS answer at connect time (rebinding). **Unset → derived from the environment**: allowed in `local`, `e2e`, `ci`, refused everywhere else — deliberately including `test`, a DEPLOYED stage in starter-based projects; `true`/`false` (also the strings, from `NSC__SECURITY__ALLOW_PRIVATE_OUTBOUND_TARGETS`) decide explicitly. Per call, `allowedHosts` frees single internal hosts (`'erp.local:8443'` = that port, `'erp.local'` = any port) without opening the rest — re-checked per connection, so a redirect does not inherit it. `outboundFetch()` uses undici's OWN `fetch` (runtime dependency `undici` since 11.42.0), because Node 22's built-in fetch bundles a different undici major than the agent |
353
353
  | AI Egress Allowlist (SSRF) | `ai.allowedBaseUrlHosts` | Explicit Value — **unset = permissive**, malformed = INTERPRETED or reported, never silently off | `undefined` → no restriction, so a local provider (Ollama on `localhost:11434`) works out of the box. Set → only those hosts are reachable, matched against `URL.host` (incl. port) and `URL.hostname`. **Accepts an array OR a comma-separated string, and the string form is not a convenience** — it is what the framework's own env mapping produces: `NSC__AI__ALLOWED_BASE_URL_HOSTS` becomes `{ ai: { allowedBaseUrlHosts: '<string>' } }` and lodash `merge` assigns that scalar straight over a configured array. Until 11.39.x a bare `!Array.isArray(...) -> return` read that as "not configured" and skipped the check entirely, so the canonical `NSC__` spelling silently disabled SSRF egress control with no log line at all. Entries are trimmed, lowercased and stripped of a fully-qualifying trailing dot, and the SAME normalisation is applied to the URL, so neither side wins by spelling one DNS name differently; a bare hostname entry matches any port, and an entry naming the scheme's default port (`example.com:443` on https) also matches the portless URL. A value that is neither array nor string carries no hostnames — the allowlist is then inactive and that is LOGGED as an error, because from the outside it looks exactly like "correctly unset". Enforced on **all three** outbound paths (`chat()`, the capability `probe()`, and `probeContextWindow()` — the last was unguarded before 11.39.x and is reachable from an ordinary user prompt via `detectAndPersistCapabilities()`, before the rate limit). Implementation: `openai-compatible.provider.ts` → `assertBaseUrlAllowed()` / `resolveAllowedBaseUrlHosts()` |
354
354
  | AI Run Time Limit | `ai.maxRunMs` | **Numeric Sentinel — Family A** (`0` = no limit) | `0` (omitted = unbounded, the previous behaviour). Wall-clock ceiling for ONE prompt run, checked before each agent-loop iteration; once exceeded the run stops and answers with whatever it has. **Without it a run's only bound is `maxIterations` MULTIPLIED BY the connection's per-call timeout** — 8 iterations at the 120s default is a request that can legitimately hold a socket, its message buffer and a request context for 16 minutes, and compaction can add a call per iteration on top. Guarded as `maxRunMs > 0`, never `<= 0`: a value arriving as a non-numeric string through `NSC__AI__MAX_RUN_MS` (the reader coerces only `'true'`, `'false'` and numbers) yields `NaN`, and `NaN > 0` is `false`, so a misconfiguration degrades to "no limit" rather than to an instantly-expired deadline that would break every prompt. Set it to something a client would actually wait for. Implementation: `core-ai.service.ts` -> `runDeadlineExceeded()` |
355
- | AI Assistant | `ai` | Presence Implies Enabled | Core: `maxIterations: 5`, `defaultMode: 'auto'` (or `'plan'`), `rateLimit` (presence implies enabled: `max: 20`, `windowSeconds: 60`), `systemPrompt`, `documentation` (injected into the system prompt), `encryptionSecret`. **DB-backed LLM connections** (`aiConnections`, admin CRUD) with AES-256-GCM-encrypted API keys (`AiCryptoService`, secret from `ai.encryptionSecret` / `NSC__AI__ENCRYPTION_SECRET` / `SECRETS_ENCRYPTION_KEY`; `apiKeyEncrypted` is a global `secretFields` entry, never returned — only `hasApiKey`); optional `defaultConnection` one-time seed. **Provider abstraction** (`ILlmProvider`, default `OpenAiCompatibleProvider` for any OpenAI-compatible endpoint via `fetch`; per-connection `supportsNativeTools`/`supportsJsonResponse` capabilities, emulated tool calling when native tools are unavailable). **Tool registry** (`AiToolRegistry`, tools self-register, role-filtered — under multi-tenancy (11.42.0+) a tool's roles resolve like `@Roles()` in `CoreTenantGuard`: global roles against `user.roles`, tenant roles against the request's membership role, ADMIN bypass only where `adminBypass` grants it, so chat and MCP never exceed the user's own rights; an MCP session reads the user per request, so a revoked role stops working without a reconnect; tools may be `mutating`/`destructive` and define `authorize()` for pre-flight data-level checks). **Plan mode** (`input.mode: 'plan'`): full plan → pre-flight authorize ALL steps → all-or-nothing execution with a translated (de/en) error when any step is not permitted. **Confirmation policy**: `confirmation.mutating: { default, enforced }` + client `input.requireConfirmation` (ignored when enforced); `destructive` always confirms. **Client metadata** (`input.metadata`: URL/nav/console logs, untrusted+capped). **Multi-turn conversations** (`aiConversations`, owner-scoped). **SSE streaming** (`POST /ai/stream`). **Audit** (`audit: false` → persist to `aiInteractions`, admin-readable). **Token budgets** (`budget: { period: 'day'|'month'|'none', user: { maxTokens?, maxPrompts? }, tenant: { maxTokens?, maxPrompts? } }`, requires audit): per-user AND per-tenant limits with config defaults; admins override per user/tenant at runtime (`aiBudgetLimits`, `CoreAiBudgetService`). Resolution: override → default → unlimited (missing/0 = unlimited). Enforced before the run (HTTP 429 + translated). Each response carries a compact `budget` summary (promptTokens, usedTokens, remainingTokens, resetAt); full breakdown via `aiUsage` query / `GET /ai/usage`. **Self-optimizing prompts**: the system prompt is assembled from keyed fragments (`CoreAiPromptBuilderService` ships built-in defaults; works with zero rows). Admin-editable overrides per slot (`aiSlots`, admin CRUD, `/ai/slots`) scoped by `key`/`locale`/`capability`/`tenantId`, with tenant override/reset semantics and placeholder tokens resolved at run time via the placeholder registry. **Governed learning loop** (`promptLearning: { enabled: true, autoApply: false }`): tool errors record `suggested` hints (`aiPromptHints`, admin CRUD, `/ai/prompt-hints`) that only reach the prompt once admin-approved (or auto-approved when `autoApply`); hints only ADD guidance, never relax permissions. **Context window** (`contextWindow`, default 8192 — the fallback for connections without a window of their own; native tool definitions count against the input budget and a system prompt plus tools above half of it is warned about once per connection since 12.3.0; auto-detected per connection via `ILlmProvider.detectContextWindow()` — Ollama `/api/show` probe / known-model table / Claude alias — and persisted): per-user/session history is trimmed (oldest non-system turns dropped, last truncated) and tool-results capped to `maxToolResultChars` (default 12000) so a session never overflows the model. A connection's window can be seeded via `ai.defaultConnection.contextWindow` (validated: a non-positive/non-integer value is dropped with a warning). **Capability drift check** (`capabilityDriftCheck`, default `false`): opt-in boot self-check that probes each enabled connection with an EXPLICIT `supportsNativeTools`/`supportsJsonResponse` (built with those flags cleared so the endpoint is actually re-probed) and logs a warning on mismatch — the stored value is never changed. OFF by default because it makes outbound calls to the LLM endpoints on every boot; also skipped in the ci/e2e runners. **Deferred tool schemas** (`deferToolSchemas`, default `false`): the system-prompt tool catalog then lists only tool NAMES + descriptions instead of full JSON schemas, and the model fetches a schema on demand via the built-in `search_tools` meta-tool — with a large registry the schemas alone can dominate a small context window. `deferToolSummaryChars` (default `0` = untruncated) additionally caps each description in that DEFERRED catalog: whole sentences up to the cap (always at least the first), word-boundary cut when the first sentence already exceeds it, and a `…` marker appended ON TOP of the cap. The default of `0` keeps the saving opt-in, so enabling `deferToolSchemas` alone never changes what a description says; set roughly 200–400 alongside it to actually reclaim the context. Both apply to EMULATED providers only — a connection with `supportsNativeTools: true` receives every full description + schema via `buildToolSchemas()` regardless, so truncation and the banner are skipped there rather than asserting a cut the tool payload contradicts. **Native catalog** (`nativeToolCatalog`, 12.3.0+): such a connection's prompt catalog lists names only (`'names'`, default) instead of repeating what the payload carries; `'full'` restores it. Emulated connections and plan mode keep the full catalog. The omitted tail is where preconditions and role restrictions usually live — the catalog banner tells the model to fetch the full text via `search_tools` first, but this is model GUIDANCE only: authorization is enforced server-side by the registry's role filter (`forUser()`), the execution-time re-check, and the `mutating`/`destructive` flags read by the confirmation gate — never by what the catalog shows. (`AiTool.authorize()` runs before EVERY execution since 12.3.0 — auto mode, plan mode, MCP — on the arguments after the PreToolUse hooks, fail-closed; a refusal is `TOOL_NOT_AVAILABLE` with its reason and no learning signal, and `data` reaches `execute()` as `context.authorization.data`. Data access in `execute()` still goes through `CrudService` with `context.serviceOptions`.) **MCP server** (`mcp: false` → `/ai/mcp` Streamable HTTP, Bearer auth, lazy `@modelcontextprotocol/sdk`; since 12.3.0 `tools/call` applies the admin's tool policies (`deny` refuses, `ask` asks), `authorize()` and the confirmation of `destructive` tools (and `mutating` ones under `ai.confirmation.mutating`) through MCP elicitation — only an explicit yes runs the tool, a client without elicitation gets a refusal; `mcp.confirmation` (`true` default, `false`, `{ default, enforced }`, only `false` / `enforced: true` count) is the default each user may switch for themselves like a "bypass permissions" mode via `GET/PUT /ai/settings` / `aiSettings` / `updateAiSettings` (stored in `aiUserSettings`, 403 `#LTNS_0609` while enforced); `tools/list` annotates `destructive` / `mutating` tools (`destructiveHint`, `readOnlyHint: false`), an unflagged tool gets none — never advertised as read-only; `mcp.stateless: true` (12.3.0+, default `false`) serves `/ai/mcp` without sessions — a server and transport per POST, no `mcp-session-id`, a sent one ignored, GET / DELETE 405 with `Allow: POST`, auth and tenant per request — so any replica answers and no sticky sessions are needed; no server-initiated messages or requests there, so no elicitation: a tool that needs confirmation is refused unless the user or `mcp.confirmation` switched the question off; the consent page's wording and CSS change through `renderMcpOAuthConsentPage(view, { texts, styles })` from an overridden `renderConsentPage()` (code/config only; a `<` in styles is neutralized, CSP blocks external loads); `mcp: { oauth: true, oauthSecret }` adds OAuth 2.1 — HMAC tokens + PKCE S256 + dynamic registration. **Since 11.43.0 `CoreAiMcpOAuthInitializer` mounts the endpoints during `app.init()` (`onModuleInit`)** — behind the Nest middleware and routes, ahead of Nest's not-found handler; `mountAiMcpOAuth(app)` after `app.init()`, the documented way before, sat behind that handler and answered 404 everywhere, and is a no-op now. The protected resource is described at the path Nest registered `/ai/mcp` at (global prefix + exclusions, URI versioning, `RouterModule`, via Nest's own `RoutePathFactory`), and the MCP 401 names that metadata URL — plain `Bearer` without OAuth. Issuer: `mcp.oauthBaseUrl` (its origin is added to Better-Auth's `trustedOrigins`, explicit list included, via `withMcpOAuthIssuerOrigin()`), else `baseUrl`; a deployed environment with neither fails the boot. Signing secret required everywhere except `local` / `ci` / `e2e` (`allowsDevelopmentSecret()` → `isLocalEnv`), deployed `develop` / `test` stages included. Under a global prefix the consent page resolves the session itself (the Better-Auth middleware runs below the prefix only) and signs in at the prefixed IAM path. Express only (boot error otherwise); an application context without HTTP server mounts nothing. Consent: a built-in page (`authorizeConsent()` default) — sign-in through Better-Auth on the API origin (password + TOTP/backup code; passkey/social via `mcp.oauthLoginUrl`, default `<appUrl>/auth/login`), then Allow/Deny as a form POST with a CSRF token signed and bound to user, client, redirect URI and PKCE challenge (10 min); Allow is `disabled` until a nonce'd guard arms it and counts a click only after intent (visible + focused + pointer move / key / touch ≥ 600 ms later — against double-clickjacking); the account is shown first with "use another account"; own CSP with nonces + `frame-ancestors 'none'`, everything escaped; boot warning without Better-Auth; restyle via `renderConsentPage()`, replace via the `mcpOAuthService` override. A code saved while answering a GET to `/authorize` is refused for every consent implementation. Since 12.3.0 an error the SDK finds before the provider's `authorize` runs (a malformed request) is answered with 400 instead of a 302 to the client's self-registered redirect URI — that was an open redirect on the API domain (RFC 9700 §4.11.2); registration stays open (no redirect-URI allowlist, claude.ai / ChatGPT / Cursor / Claude Code register their own), and the built-in Deny needs the consent token like Allow (`mountAiMcpOAuthRouter()` wraps the SDK router, `authorizeConsent()`). Refusals are SDK `OAuthError` classes (`invalid_grant` etc.), never a plain `Error`, which the SDK answers as 500). Overrides via `CoreModule.forRoot(env, { ai: { budgetService, connectionResolver, connectionService, controller, conversationService, interactionService, mcpClientService, mcpOAuthService, modeService, placeholderRegistry, preferenceService, promptBuilder, promptHintService, promptService, resolver, service, slotService, toolGrantService, toolPolicyService, userSettingService } })` |
355
+ | AI Assistant | `ai` | Presence Implies Enabled | Core: `maxIterations: 5`, `defaultMode: 'auto'` (or `'plan'`), `rateLimit` (presence implies enabled: `max: 20`, `windowSeconds: 60`), `systemPrompt`, `documentation` (injected into the system prompt), `encryptionSecret`. **DB-backed LLM connections** (`aiConnections`, admin CRUD) with AES-256-GCM-encrypted API keys (`AiCryptoService`, secret from `ai.encryptionSecret` / `NSC__AI__ENCRYPTION_SECRET` / `SECRETS_ENCRYPTION_KEY`; `apiKeyEncrypted` is a global `secretFields` entry, never returned — only `hasApiKey`); optional `defaultConnection` one-time seed. **Provider abstraction** (`ILlmProvider`, default `OpenAiCompatibleProvider` for any OpenAI-compatible endpoint via `fetch`; per-connection `supportsNativeTools`/`supportsJsonResponse` capabilities, emulated tool calling when native tools are unavailable). **Tool registry** (`AiToolRegistry`, tools self-register, role-filtered — under multi-tenancy (11.42.0+) a tool's roles resolve like `@Roles()` in `CoreTenantGuard`: global roles against `user.roles`, tenant roles against the request's membership role, ADMIN bypass only where `adminBypass` grants it, so chat and MCP never exceed the user's own rights; an MCP session reads the user per request, so a revoked role stops working without a reconnect; tools may be `mutating`/`destructive` and define `authorize()` for pre-flight data-level checks). **Plan mode** (`input.mode: 'plan'`): full plan → pre-flight authorize ALL steps → all-or-nothing execution with a translated (de/en) error when any step is not permitted. **Confirmation policy**: `confirmation.mutating: { default, enforced }` + client `input.requireConfirmation` (ignored when enforced); `destructive` always confirms. **Client metadata** (`input.metadata`: URL/nav/console logs, untrusted+capped). **Multi-turn conversations** (`aiConversations`, owner-scoped). **SSE streaming** (`POST /ai/stream`). **Audit** (`audit: false` → persist to `aiInteractions`, admin-readable). **Token budgets** (`budget: { period: 'day'|'month'|'none', user: { maxTokens?, maxPrompts? }, tenant: { maxTokens?, maxPrompts? } }`, requires audit): per-user AND per-tenant limits with config defaults; admins override per user/tenant at runtime (`aiBudgetLimits`, `CoreAiBudgetService`). Resolution: override → default → unlimited (missing/0 = unlimited). Enforced before the run (HTTP 429 + translated). Each response carries a compact `budget` summary (promptTokens, usedTokens, remainingTokens, resetAt); full breakdown via `aiUsage` query / `GET /ai/usage`. **Self-optimizing prompts**: the system prompt is assembled from keyed fragments (`CoreAiPromptBuilderService` ships built-in defaults; works with zero rows). Admin-editable overrides per slot (`aiSlots`, admin CRUD, `/ai/slots`) scoped by `key`/`locale`/`capability`/`tenantId`, with tenant override/reset semantics and placeholder tokens resolved at run time via the placeholder registry. **Governed learning loop** (`promptLearning: { enabled: true, autoApply: false }`): tool errors record `suggested` hints (`aiPromptHints`, admin CRUD, `/ai/prompt-hints`) that only reach the prompt once admin-approved (or auto-approved when `autoApply`); hints only ADD guidance, never relax permissions. **Context window** (`contextWindow`, default 8192 — the fallback for connections without a window of their own; native tool definitions count against the input budget and a system prompt plus tools above half of it is warned about once per connection since 12.3.0; auto-detected per connection via `ILlmProvider.detectContextWindow()` — Ollama `/api/show` probe / known-model table / Claude alias — and persisted): per-user/session history is trimmed (oldest non-system turns dropped, last truncated) and tool-results capped to `maxToolResultChars` (default 12000) so a session never overflows the model. A connection's window can be seeded via `ai.defaultConnection.contextWindow` (validated: a non-positive/non-integer value is dropped with a warning). **Capability drift check** (`capabilityDriftCheck`, default `false`): opt-in boot self-check that probes each enabled connection with an EXPLICIT `supportsNativeTools`/`supportsJsonResponse` (built with those flags cleared so the endpoint is actually re-probed) and logs a warning on mismatch — the stored value is never changed. OFF by default because it makes outbound calls to the LLM endpoints on every boot; also skipped in the ci/e2e runners. **Deferred tool schemas** (`deferToolSchemas`, default `false`): the system-prompt tool catalog then lists only tool NAMES + descriptions instead of full JSON schemas, and the model fetches a schema on demand via the built-in `search_tools` meta-tool — with a large registry the schemas alone can dominate a small context window. `deferToolSummaryChars` (default `0` = untruncated) additionally caps each description in that DEFERRED catalog: whole sentences up to the cap (always at least the first), word-boundary cut when the first sentence already exceeds it, and a `…` marker appended ON TOP of the cap. The default of `0` keeps the saving opt-in, so enabling `deferToolSchemas` alone never changes what a description says; set roughly 200–400 alongside it to actually reclaim the context. Both apply to EMULATED providers only — a connection with `supportsNativeTools: true` receives every full description + schema via `buildToolSchemas()` regardless, so truncation and the banner are skipped there rather than asserting a cut the tool payload contradicts. **Native catalog** (`nativeToolCatalog`, 12.3.0+): such a connection's prompt catalog lists names only (`'names'`, default) instead of repeating what the payload carries; `'full'` restores it. Emulated connections and plan mode keep the full catalog. The omitted tail is where preconditions and role restrictions usually live — the catalog banner tells the model to fetch the full text via `search_tools` first, but this is model GUIDANCE only: authorization is enforced server-side by the registry's role filter (`forUser()`), the execution-time re-check, and the `mutating`/`destructive` flags read by the confirmation gate — never by what the catalog shows. (`AiTool.authorize()` runs before EVERY execution since 12.3.0 — auto mode, plan mode, MCP — on the arguments after the PreToolUse hooks, fail-closed; a refusal is `TOOL_NOT_AVAILABLE` with its reason and no learning signal, and `data` reaches `execute()` as `context.authorization.data`. Data access in `execute()` still goes through `CrudService` with `context.serviceOptions`.) **MCP server** (`mcp: false` → `/ai/mcp` Streamable HTTP, Bearer auth, lazy `@modelcontextprotocol/sdk`; since 12.3.0 `tools/call` applies the admin's tool policies (`deny` refuses, `ask` asks), `authorize()` and the confirmation of `destructive` tools (and `mutating` ones under `ai.confirmation.mutating`) through MCP elicitation — only an explicit yes runs the tool, a client without elicitation gets a refusal; `mcp.confirmation` (`true` default, `false`, `{ default, enforced }`, only `false` / `enforced: true` count) is the default each user may switch for themselves like a "bypass permissions" mode via `GET/PUT /ai/settings` / `aiSettings` / `updateAiSettings` (stored in `aiUserSettings`, 403 `#LTNS_0609` while enforced); `tools/list` annotates `destructive` / `mutating` tools (`destructiveHint`, `readOnlyHint: false`), an unflagged tool gets none — never advertised as read-only; `mcp.stateless: true` (12.3.0+, default `false`) serves `/ai/mcp` without sessions — a server and transport per POST, no `mcp-session-id`, a sent one ignored, GET / DELETE 405 with `Allow: POST`, auth and tenant per request — so any replica answers and no sticky sessions are needed; no server-initiated messages or requests there, so no elicitation: a tool that needs confirmation is refused unless the user or `mcp.confirmation` switched the question off; the consent page's wording and CSS change through `renderMcpOAuthConsentPage(view, { texts, styles })` from an overridden `renderConsentPage()` (code/config only; a `<` in styles is neutralized, CSP blocks external loads); who may use MCP at all is `ai.mcp.roles` (12.8.6+; see the MCP Access row) or an overridden `mayUseMcp()`, and a project's own notice on the consent route goes through `sendConsentNotice(res, { title, message })` — the framework applies the page's security headers, which stay unexported; `mcp: { oauth: true, oauthSecret }` adds OAuth 2.1 — HMAC tokens + PKCE S256 + dynamic registration. **Since 11.43.0 `CoreAiMcpOAuthInitializer` mounts the endpoints during `app.init()` (`onModuleInit`)** — behind the Nest middleware and routes, ahead of Nest's not-found handler; `mountAiMcpOAuth(app)` after `app.init()`, the documented way before, sat behind that handler and answered 404 everywhere, and is a no-op now. The protected resource is described at the path Nest registered `/ai/mcp` at (global prefix + exclusions, URI versioning, `RouterModule`, via Nest's own `RoutePathFactory`), and the MCP 401 names that metadata URL — plain `Bearer` without OAuth. Issuer: `mcp.oauthBaseUrl` (its origin is added to Better-Auth's `trustedOrigins`, explicit list included, via `withMcpOAuthIssuerOrigin()`), else `baseUrl`; a deployed environment with neither fails the boot. Signing secret required everywhere except `local` / `ci` / `e2e` (`allowsDevelopmentSecret()` → `isLocalEnv`), deployed `develop` / `test` stages included. Under a global prefix the consent page resolves the session itself (the Better-Auth middleware runs below the prefix only) and signs in at the prefixed IAM path. Express only (boot error otherwise); an application context without HTTP server mounts nothing. Consent: a built-in page (`authorizeConsent()` default) — sign-in through Better-Auth on the API origin (password + TOTP/backup code; passkey/social via `mcp.oauthLoginUrl`, default `<appUrl>/auth/login`), then Allow/Deny as a form POST with a CSRF token signed and bound to user, client, redirect URI and PKCE challenge (10 min); Allow is `disabled` until a nonce'd guard arms it and counts a click only after intent (visible + focused + pointer move / key / touch ≥ 600 ms later — against double-clickjacking); the account is shown first with "use another account"; own CSP with nonces + `frame-ancestors 'none'`, everything escaped; boot warning without Better-Auth; restyle via `renderConsentPage()`, replace via the `mcpOAuthService` override. A code saved while answering a GET to `/authorize` is refused for every consent implementation. Since 12.3.0 an error the SDK finds before the provider's `authorize` runs (a malformed request) is answered with 400 instead of a 302 to the client's self-registered redirect URI — that was an open redirect on the API domain (RFC 9700 §4.11.2); registration stays open (no redirect-URI allowlist, claude.ai / ChatGPT / Cursor / Claude Code register their own), and the built-in Deny needs the consent token like Allow (`mountAiMcpOAuthRouter()` wraps the SDK router, `authorizeConsent()`). Refusals are SDK `OAuthError` classes (`invalid_grant` etc.), never a plain `Error`, which the SDK answers as 500). Overrides via `CoreModule.forRoot(env, { ai: { budgetService, connectionResolver, connectionService, controller, conversationService, interactionService, mcpClientService, mcpOAuthService, modeService, placeholderRegistry, preferenceService, promptBuilder, promptHintService, promptService, resolver, service, slotService, toolGrantService, toolPolicyService, userSettingService } })` |
356
+ | MCP Access | `ai.mcp.roles` | Explicit Value — **unset = everyone**, invalid = BOOT ERROR (never "everyone") | **Unset → every signed-in user may use MCP, as before 12.8.6.** An array of role names or a comma-separated string (`NSC__AI__MCP__ROLES=admin,support`) limits MCP to users whose own (global) `roles` hold one of them — never a tenant membership role; list `admin` too if administrators should. Checked by `CoreAiMcpOAuthService.checkMcpAccess()` → `mayUseMcp(user, req)` on EVERY request to `/ai/mcp` (POST, GET, DELETE; the user's session token or JWT as bearer and MCP OAuth access tokens alike → 403, so an open session ends with its next request), on the consent route (the refusal notice of `consentRefusal()`, 403, instead of the form) and on `/token` (authorization code and refresh token → `invalid_grant`, the rotated refresh token is revoked; the user's roles come from `loadUser()`, a user it cannot load counts as holding none). Exists because until 12.8.5 there was no account-level rule: a refusal a project built into `authorizeConsent()` was bypassed with the user's own session or JWT as bearer, which never passes `/authorize`, and earlier grants kept refreshing. A value that names no role (`[]`, `''`, an empty entry, a non-string) or a system role fails the boot in `onModuleInit()` and refuses at runtime for a subclass that skips it. Any other rule: override `mayUseMcp()` in the `mcpOAuthService` subclass — only an explicit `true` admits, a throw refuses and is logged. Pinned by `tests/unit/ai-mcp-access.spec.ts` (mutations `mcp-route-skips-access-check`, `mcp-consent-ignores-access`, `mcp-refresh-ignores-access`). Implementation: `core-ai-mcp-oauth.service.ts`, `core-ai-mcp.controller.ts` |
356
357
  | Swagger | `swagger` | Explicit Boolean with DERIVED default | **Unset → served only in `local` / `ci` / `e2e` (`isLocalEnv()`), off everywhere else (12.7.0+)**; `true` serves everywhere, `false` nowhere; a non-boolean value counts as not set (`NSC__SWAGGER=true`). `setupSwagger()` asks `isSwaggerEnabled()` (`common/helpers/swagger-enabled.helper.ts`) before mounting anything: off mounts NONE of the four paths (`/swagger`, `/swagger-api-tokens`, `/api-docs-json`, `/api-docs-api-tokens-json`, or the paths given) and logs one line. Before 12.7.0 every project that called `setupSwagger()` published the full API description on every stage, production included. Same shape as `configEndpoint`. Pinned by `tests/unit/swagger-switch.spec.ts` (mutations `swagger-default-on-everywhere`, `swagger-string-switches-on`, `swagger-mounted-when-off`) |
357
358
  | Swagger API-Token View | `setupSwagger(app, { apiTokenView })` (helper option, not server config) | Boolean Shorthand / Presence Implies Enabled | **Off without the option** (11.42.7+). `true` / `{}` serves a second document with only the routes that release a scope via `@ApiTokenScopes()`: UI at `swagger-api-tokens`, JSON at `/api-docs-api-tokens-json`, title `<title> — API tokens`, bearer as the only scheme, unused schemas pruned; the tenant header stays while `apiTokens.userTokens` is on (a personal token chooses the company like a session) and is dropped with company tokens only. Keep its path OUTSIDE the full UI's path: Swagger UI serves its assets below its own path. The full document's enrichment (global bearer + session-cookie requirement, `security: []` on public routes, `x-api-token-scopes` + description line, `TenantHeader` parameter) is not optional — it is what `setupSwagger()` is for, and it reads the same metadata as the guards. Implementation: `common/helpers/swagger.helper.ts` **Better-Auth routes (11.42.9):** the full document also lists every route Better-Auth serves itself under the base path — whatever the configured plugins add — from Better-Auth's own generator, under the project's Better-Auth controller (its tags and `operationTags`, ids `<Controller>_betterAuth_<id>`, schemas prefixed `BetterAuth`, OpenAPI 3.1 constructs converted to 3.0). Their security is what Better-Auth enforces, not the generator's blanket bearer-only: a route behind one of Better-Auth's session middlewares (or one of the three social-account routes in `HANDLER_SESSION_PATHS`, which check in the handler) gets the global requirement, every other route `security: []` — except routes of plugins nest-server does not register itself (`BUILT_IN_BETTER_AUTH_PLUGIN_IDS`), which always keep the global requirement — and if the instance's middlewares cannot be identified (two copies of better-auth), all of them keep the global requirement rather than risk documenting a session route as public. They carry the "not allowed" API-token line, and never reach the API-token view. The `openAPI()` plugin this needs is registered internally; its routes answer 404 (see `.claude/rules/better-auth.md` §9). **Only usable operations (11.42.9):** an operation that answers an error to every caller under the running configuration is left out — `@ApiMethods()` on `@All()` handlers (TUS), legacy `/auth/*` while `auth.legacyEndpoints` keeps REST closed, Better-Auth routes refused by the configuration or the live instance, Hub endpoints of switched-off panels. `/ai/mcp` and the MCP OAuth endpoints that are actually mounted are documented. An explicit `@ApiBearerAuth()` keeps a guard-public route from being documented as public. Rules: `isSwitchedOffOperation()` in `swagger.helper.ts` |
358
359
 
@@ -412,7 +412,7 @@ pnpm run check:mutations -- --id=<id> # one mutation
412
412
  pnpm run check:mutations -- --list # the registry, without running anything
413
413
  pnpm run check:mutations -- --allow-dirty # when the fix and its evidence share a working tree
414
414
  pnpm run check:mutations -- --jobs=4 # N mutations at a time (default: 2, or 4 on >=12 cores)
415
- pnpm run check:mutations -- --no-infra # only the 406 that need no MongoDB
415
+ pnpm run check:mutations -- --no-infra # only the 410 that need no MongoDB
416
416
  pnpm run check:mutations -- --since=<ref> # only mutations touching files changed since <ref>
417
417
  pnpm run check:mutations -- --shard=2/4 # this job's quarter of the selection (CI splits the full run)
418
418
  ```
@@ -432,7 +432,7 @@ when the registry, a vitest config or a setup file changed, since those can move
432
432
  commit, and in CI alongside the publish without blocking it. The price of caching is a cache that
433
433
  has to model each spec's full dependency closure correctly, and getting that wrong produces a stale
434
434
  PASS for a test that has since gone vacuous — exactly what the gate is there to prevent. Bad trade
435
- at 641 mutations.
435
+ at 645 mutations.
436
436
 
437
437
  **Decided 2026-10-03 (repo owner): keep the full run.** Measured at 128 mutations, the CI job for
438
438
  11.41.6 took **14 minutes**. The trigger to revisit is that wall time, not the mutation count —
@@ -505,7 +505,7 @@ exactly the environment where the answer matters.
505
505
 
506
506
  Worth knowing before optimising the wrong thing: the specs behind all 235 e2e mutations add up to
507
507
  **~40 seconds**. The step takes ~740s. The remaining ~700s is paying vitest's startup — process
508
- spawn, transform, module graph, mongod connect, DB create and drop — once per mutation, 641 times.
508
+ spawn, transform, module graph, mongod connect, DB create and drop — once per mutation, 645 times.
509
509
  That work is largely single-threaded I/O and barely scales with cores: the full registry measures
510
510
  **744s on a 12-core laptop and 777s on a 4-vCPU CI runner**.
511
511
 
package/FRAMEWORK-API.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @lenne.tech/nest-server — Framework API Reference
2
2
 
3
- > Auto-generated from source code as of 2026-11-09 (v12.8.5)
3
+ > Auto-generated from source code as of 2026-11-10 (v12.8.6)
4
4
  > File: `FRAMEWORK-API.md` — compact, machine-readable API surface for Claude Code
5
5
 
6
6
  ## CoreModule.forRoot()
@@ -271,6 +271,7 @@ export interface IAi {
271
271
  oauthBaseUrl?: string;
272
272
  oauthLoginUrl?: string;
273
273
  oauthSecret?: string;
274
+ roles?: string | string[];
274
275
  stateless?: boolean;
275
276
  };
276
277
  rateLimit?: IAiRateLimit;
@@ -41,6 +41,7 @@ export declare class CoreAiMcpController implements OnModuleDestroy {
41
41
  protected foreignSession(res: Response, owner: string): void;
42
42
  private mcpUnavailable;
43
43
  private unauthorized;
44
+ private forbidden;
44
45
  private evictIfNeeded;
45
46
  private evictOldestOf;
46
47
  }
@@ -45,6 +45,10 @@ let CoreAiMcpController = CoreAiMcpController_1 = class CoreAiMcpController {
45
45
  this.unauthorized(res);
46
46
  return;
47
47
  }
48
+ if (!(await this.oauthService.checkMcpAccess(user, req))) {
49
+ this.forbidden(res);
50
+ return;
51
+ }
48
52
  if (this.statelessEnabled()) {
49
53
  await this.handleStatelessPost(req, res, user);
50
54
  return;
@@ -190,6 +194,10 @@ let CoreAiMcpController = CoreAiMcpController_1 = class CoreAiMcpController {
190
194
  this.unauthorized(res);
191
195
  return;
192
196
  }
197
+ if (!(await this.oauthService.checkMcpAccess(user, req))) {
198
+ this.forbidden(res);
199
+ return;
200
+ }
193
201
  if (this.statelessEnabled()) {
194
202
  res.status(405).set('Allow', 'POST').json({ error: 'Method not allowed: this MCP server is stateless' });
195
203
  return;
@@ -300,6 +308,9 @@ let CoreAiMcpController = CoreAiMcpController_1 = class CoreAiMcpController {
300
308
  .set({ 'WWW-Authenticate': oauth ? `Bearer resource_metadata="${oauth.resourceMetadataUrl}"` : 'Bearer' })
301
309
  .json({ error: 'Unauthorized: a valid Bearer token is required' });
302
310
  }
311
+ forbidden(res) {
312
+ res.status(403).json({ error: 'Forbidden: this account may not use MCP' });
313
+ }
303
314
  evictIfNeeded(ownerId) {
304
315
  const perUser = new Map();
305
316
  for (const [key, value] of this.transports) {
@@ -1 +1 @@
1
- {"version":3,"file":"core-ai-mcp.controller.js","sourceRoot":"","sources":["../../../../src/core/modules/ai/core-ai-mcp.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAmB,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5G,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,4CAA4C,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE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,GAAG,EAAE,CAAA;IAAgB,WAAA,GAAG,EAAE,CAAA;;;;qDAwG3C;AAOK;IALL,YAAY,CAAC;QACZ,WAAW,EAAE,gGAAgG;QAC7G,OAAO,EAAE,kBAAkB;KAC5B,CAAC;IACD,GAAG,EAAE;IACW,WAAA,GAAG,EAAE,CAAA;IAAgB,WAAA,GAAG,EAAE,CAAA;;;;oDAE1C;AAOK;IALL,YAAY,CAAC;QACZ,WAAW,EAAE,yEAAyE;QACtF,OAAO,EAAE,iBAAiB;KAC3B,CAAC;IACD,MAAM,EAAE;IACW,WAAA,GAAG,EAAE,CAAA;IAAgB,WAAA,GAAG,EAAE,CAAA;;;;uDAE7C;AA5KU,mBAAmB;IAJ/B,aAAa,CAAC,QAAQ,CAAC;IACvB,OAAO,CAAC,QAAQ,CAAC;IACjB,UAAU,CAAC,QAAQ,CAAC;IACpB,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC;IAyCtB,WAAA,QAAQ,EAAE,CAAA;qCAFkB,gBAAgB;QACd,qBAAqB;QACN,gBAAgB;GAxCrD,mBAAmB,CAslB/B"}
@@ -84,6 +84,10 @@ declare const TEXTS: {
84
84
  warning: string;
85
85
  };
86
86
  };
87
+ export declare function mcpOAuthConsentRefusalTexts(locale: McpOAuthConsentLocale): {
88
+ message: string[];
89
+ title: string;
90
+ };
87
91
  export declare function mcpOAuthConsentLocale(acceptLanguage: unknown): McpOAuthConsentLocale;
88
92
  export declare function mcpOAuthConsentHeaders(nonce: string): Record<string, string>;
89
93
  export type McpOAuthConsentTexts = (typeof TEXTS)[McpOAuthConsentLocale];
@@ -92,6 +96,35 @@ export interface IMcpOAuthConsentPageOptions {
92
96
  texts?: Partial<Record<McpOAuthConsentLocale, Partial<McpOAuthConsentTexts>>>;
93
97
  }
94
98
  export declare function renderMcpOAuthConsentPage(view: IMcpOAuthConsentView, options?: IMcpOAuthConsentPageOptions): string;
99
+ export interface IMcpOAuthConsentNotice {
100
+ link?: {
101
+ href: string;
102
+ label: string;
103
+ };
104
+ locale?: McpOAuthConsentLocale;
105
+ message: string | string[];
106
+ status?: number;
107
+ switchAccount?: boolean;
108
+ title: string;
109
+ }
110
+ export interface IMcpOAuthConsentNoticeView {
111
+ appHost: string;
112
+ authBasePath?: string;
113
+ link?: {
114
+ href: string;
115
+ label: string;
116
+ };
117
+ locale: McpOAuthConsentLocale;
118
+ message: string[];
119
+ nonce: string;
120
+ title: string;
121
+ user?: {
122
+ email?: string;
123
+ name?: string;
124
+ };
125
+ }
126
+ export declare function renderMcpOAuthConsentNoticePage(view: IMcpOAuthConsentNoticeView, options?: IMcpOAuthConsentPageOptions): string;
127
+ export declare function consentNoticeLinkHref(href: unknown): string | undefined;
95
128
  export declare const MCP_OAUTH_CONSENT_GUARD_SCRIPT = "(function () {\n var allow = document.getElementById('lt-mcp-allow');\n if (allow) {\n var since = 0;\n var armed = false;\n var reset = function () { since = 0; armed = false; };\n var watch = function () {\n if (document.visibilityState === 'visible' && document.hasFocus()) { if (!since) { since = Date.now(); } } else { reset(); }\n };\n var intent = function (event) {\n watch();\n var stationaryClick = event.type === 'pointerdown' && event.pointerType === 'mouse';\n if (since && !stationaryClick && Date.now() - since >= 600) { armed = true; }\n };\n window.addEventListener('blur', reset);\n window.addEventListener('focus', watch);\n document.addEventListener('visibilitychange', function () { if (document.visibilityState === 'visible') { watch(); } else { reset(); } });\n document.addEventListener('pointermove', intent);\n document.addEventListener('pointerdown', intent);\n document.addEventListener('keydown', intent);\n allow.addEventListener('click', function (event) { if (!armed) { event.preventDefault(); } });\n allow.disabled = false;\n watch();\n }\n var other = document.getElementById('lt-mcp-switch');\n if (other) {\n other.addEventListener('click', function (event) {\n event.preventDefault();\n var done = function () { location.reload(); };\n fetch(other.getAttribute('data-sign-out'), { body: '{}', credentials: 'same-origin', headers: { 'content-type': 'application/json' }, method: 'POST' }).then(done, done);\n });\n }\n})();";
96
129
  export declare const MCP_OAUTH_CONSENT_SCRIPT = "(function () {\n var root = document.getElementById('lt-mcp-signin');\n if (!root) { return; }\n var base = root.getAttribute('data-auth-base');\n var passwordForm = document.getElementById('lt-mcp-password');\n var factorForm = document.getElementById('lt-mcp-second-factor');\n var error = document.getElementById('lt-mcp-error');\n // Both forms are rendered hidden and with method=\"post\": without this script nothing can be\n // submitted, and nothing would ever put the password into a URL.\n passwordForm.hidden = false;\n function fail(message) { error.textContent = message; error.hidden = false; }\n function post(path, body) {\n return fetch(base + path, {\n body: JSON.stringify(body),\n credentials: 'same-origin',\n headers: { 'content-type': 'application/json' },\n method: 'POST'\n }).then(function (response) {\n return response.json().then(function (json) { return json; }, function () { return {}; }).then(function (json) {\n return { body: json || {}, ok: response.ok };\n });\n });\n }\n passwordForm.addEventListener('submit', function (event) {\n event.preventDefault();\n error.hidden = true;\n post('/sign-in/email', { email: passwordForm.elements.email.value, password: passwordForm.elements.password.value })\n .then(function (result) {\n if (result.body.requiresTwoFactor || result.body.twoFactorRedirect) {\n passwordForm.hidden = true;\n factorForm.hidden = false;\n return;\n }\n if (!result.ok) { fail(root.getAttribute('data-sign-in-failed')); return; }\n location.reload();\n }, function () { fail(root.getAttribute('data-sign-in-failed')); });\n });\n factorForm.addEventListener('submit', function (event) {\n event.preventDefault();\n error.hidden = true;\n var path = factorForm.elements.backup.checked ? '/two-factor/verify-backup-code' : '/two-factor/verify-totp';\n post(path, { code: factorForm.elements.code.value })\n .then(function (result) {\n if (!result.ok) { fail(root.getAttribute('data-code-failed')); return; }\n location.reload();\n }, function () { fail(root.getAttribute('data-code-failed')); });\n });\n})();";
97
130
  export {};
@@ -58,6 +58,26 @@ const TEXTS = {
58
58
  warning: 'Only allow access if you just started this connection yourself.',
59
59
  },
60
60
  };
61
+ const REFUSAL_TEXTS = {
62
+ de: {
63
+ message: [
64
+ 'Dieses Konto darf keine MCP-Clients verbinden.',
65
+ 'Melde dich mit einem anderen Konto an oder wende dich an die Administration.',
66
+ ],
67
+ title: 'Kein Zugriff über MCP',
68
+ },
69
+ en: {
70
+ message: [
71
+ 'This account may not connect MCP clients.',
72
+ 'Sign in with another account or contact your administrator.',
73
+ ],
74
+ title: 'No MCP access',
75
+ },
76
+ };
77
+ export function mcpOAuthConsentRefusalTexts(locale) {
78
+ const texts = REFUSAL_TEXTS[locale] ?? REFUSAL_TEXTS.en;
79
+ return { message: [...texts.message], title: texts.title };
80
+ }
61
81
  export function mcpOAuthConsentLocale(acceptLanguage) {
62
82
  const first = typeof acceptLanguage === 'string' ? acceptLanguage.split(',')[0].trim().toLowerCase() : '';
63
83
  return first.startsWith('de') ? 'de' : 'en';
@@ -74,10 +94,48 @@ export function mcpOAuthConsentHeaders(nonce) {
74
94
  };
75
95
  }
76
96
  export function renderMcpOAuthConsentPage(view, options = {}) {
77
- const t = { ...TEXTS[view.locale], ...options.texts?.[view.locale] };
97
+ const t = pageTexts(view.locale, options);
78
98
  const clientName = view.client.name?.trim() || t.unnamedClient;
79
99
  const fill = (text) => escapeHtml(text).replace(/\{(client|app)\}/g, (_, key) => `<strong>${escapeHtml(key === 'client' ? clientName : view.appHost)}</strong>`);
80
100
  const body = view.user ? consentView(view, t, fill) : signInView(view, t, fill);
101
+ return pageDocument(view, t.title, body, pageScript(view), options);
102
+ }
103
+ export function renderMcpOAuthConsentNoticePage(view, options = {}) {
104
+ const t = pageTexts(view.locale, options);
105
+ const account = accountLine(view.user, view.authBasePath, t);
106
+ const href = consentNoticeLinkHref(view.link?.href);
107
+ const link = href
108
+ ? `<div class="other"><a href="${escapeHtml(href)}">${escapeHtml(view.link?.label || href)}</a></div>`
109
+ : '';
110
+ const body = `<h1>${escapeHtml(view.title)}</h1>
111
+ ${account}
112
+ ${view.message.map((paragraph) => `<p>${escapeHtml(paragraph)}</p>`).join('\n')}
113
+ ${link}`;
114
+ const script = account.includes('id="lt-mcp-switch"')
115
+ ? `<script nonce="${escapeHtml(view.nonce)}">${MCP_OAUTH_CONSENT_GUARD_SCRIPT}</script>`
116
+ : '';
117
+ return pageDocument(view, view.title, body, script, options);
118
+ }
119
+ export function consentNoticeLinkHref(href) {
120
+ if (typeof href !== 'string') {
121
+ return undefined;
122
+ }
123
+ const value = href.trim();
124
+ if ([...value].some((char) => char.charCodeAt(0) < 0x20 || char.charCodeAt(0) === 0x7f)) {
125
+ return undefined;
126
+ }
127
+ if (value.startsWith('/')) {
128
+ return /^\/[/\\]/.test(value) ? undefined : value;
129
+ }
130
+ try {
131
+ const url = new URL(value);
132
+ return url.protocol === 'https:' || url.protocol === 'http:' ? url.href : undefined;
133
+ }
134
+ catch {
135
+ return undefined;
136
+ }
137
+ }
138
+ function pageDocument(view, title, body, script, options) {
81
139
  return `<!doctype html>
82
140
  <html lang="${view.locale}">
83
141
  <head>
@@ -85,18 +143,30 @@ export function renderMcpOAuthConsentPage(view, options = {}) {
85
143
  <meta name="viewport" content="width=device-width, initial-scale=1">
86
144
  <meta name="robots" content="noindex">
87
145
  <link rel="icon" href="data:,">
88
- <title>${escapeHtml(t.title)} – ${escapeHtml(view.appHost)}</title>
146
+ <title>${escapeHtml(title)} – ${escapeHtml(view.appHost)}</title>
89
147
  <style nonce="${escapeHtml(view.nonce)}">${STYLES}${confinedStyles(options.styles)}</style>
90
148
  </head>
91
149
  <body>
92
150
  <main class="card">
93
151
  ${body}
94
152
  </main>
95
- ${pageScript(view)}
153
+ ${script}
96
154
  </body>
97
155
  </html>
98
156
  `;
99
157
  }
158
+ function pageTexts(locale, options) {
159
+ return { ...TEXTS[locale], ...options.texts?.[locale] };
160
+ }
161
+ function accountLine(user, authBasePath, t) {
162
+ const who = user?.email || user?.name;
163
+ if (!who) {
164
+ return '';
165
+ }
166
+ return `<p class="account">${escapeHtml(t.signedInAs).replace('{user}', () => `<strong>${escapeHtml(who)}</strong>`)}${authBasePath
167
+ ? `<a href="" id="lt-mcp-switch" class="switch" data-sign-out="${escapeHtml(`${authBasePath}/sign-out`)}">${escapeHtml(t.switchAccount)}</a>`
168
+ : ''}</p>`;
169
+ }
100
170
  function confinedStyles(styles) {
101
171
  return typeof styles === 'string' ? styles.replace(/</g, '\\3c ') : '';
102
172
  }
@@ -104,15 +174,10 @@ function consentView(view, t, fill) {
104
174
  const target = view.redirect.loopback
105
175
  ? `${escapeHtml(t.loopback)} (${escapeHtml(view.redirect.host)})`
106
176
  : escapeHtml(view.redirect.host);
107
- const who = view.user?.email || view.user?.name;
108
177
  const hidden = Object.entries(view.oauthParams)
109
178
  .map(([name, value]) => `<input type="hidden" name="${escapeHtml(name)}" value="${escapeHtml(value)}">`)
110
179
  .join('\n');
111
- const account = who
112
- ? `<p class="account">${escapeHtml(t.signedInAs).replace('{user}', () => `<strong>${escapeHtml(who)}</strong>`)}${view.authBasePath
113
- ? `<a href="" id="lt-mcp-switch" class="switch" data-sign-out="${escapeHtml(`${view.authBasePath}/sign-out`)}">${escapeHtml(t.switchAccount)}</a>`
114
- : ''}</p>`
115
- : '';
180
+ const account = accountLine(view.user, view.authBasePath, t);
116
181
  return `<h1>${escapeHtml(t.title)}</h1>
117
182
  ${account}
118
183
  ${view.notice === 'expired' ? `<p class="notice" role="alert">${escapeHtml(t.expired)}</p>` : ''}
@@ -1 +1 @@
1
- {"version":3,"file":"ai-mcp-oauth-consent.helper.js","sourceRoot":"","sources":["../../../../../src/core/modules/ai/helpers/ai-mcp-oauth-consent.helper.ts"],"names":[],"mappings":"AAwCA,MAAM,CAAC,MAAM,gCAAgC,GAAG,gBAAgB,CAAC;AAEjE,MAAM,CAAC,MAAM,6BAA6B,GAAG,aAAa,CAAC;AAE3D,MAAM,KAAK,GAAG;IACZ,EAAE,EAAE;QACF,KAAK,EAAE,UAAU;QACjB,eAAe,EAAE,0CAA0C;QAC3D,UAAU,EAAE,uBAAuB;QACnC,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,wBAAwB;QACpC,QAAQ,EAAE,gDAAgD;QAC1D,OAAO,EAAE,YAAY;QACrB,QAAQ,EAAE,mCAAmC;QAC7C,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE,+DAA+D;QACxE,KAAK,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,CAAC,IAAI,CAAC,YAAY,CAAC,0BAA0B,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,uBAAuB,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;;SAEjK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;SACnB,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;wCACS,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;;;mBAGzC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;SAChC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;8DACmC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;wCAC9C,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC;;;;EAI3D,KAAK,EAAE,CAAC;AACV,CAAC;AAaD,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgCxC,CAAC;AAQP,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+ClC,CAAC;AAGP,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBd,CAAC"}
@@ -1,8 +1,8 @@
1
1
  export * from './core-ai-mcp-oauth.initializer.js';
2
2
  export * from './core-ai-mcp.controller.js';
3
3
  export * from './helpers/ai-mcp-oauth.helper.js';
4
- export { MCP_OAUTH_CONSENT_DECISION_FIELD, MCP_OAUTH_CONSENT_TOKEN_FIELD, mcpOAuthConsentLocale, renderMcpOAuthConsentPage, } from './helpers/ai-mcp-oauth-consent.helper.js';
5
- export type { IMcpOAuthConsentPageOptions, IMcpOAuthConsentView, McpOAuthConsentLocale, McpOAuthConsentTexts, } from './helpers/ai-mcp-oauth-consent.helper.js';
4
+ export { MCP_OAUTH_CONSENT_DECISION_FIELD, MCP_OAUTH_CONSENT_TOKEN_FIELD, mcpOAuthConsentLocale, renderMcpOAuthConsentNoticePage, renderMcpOAuthConsentPage, } from './helpers/ai-mcp-oauth-consent.helper.js';
5
+ export type { IMcpOAuthConsentNotice, IMcpOAuthConsentNoticeView, IMcpOAuthConsentPageOptions, IMcpOAuthConsentView, McpOAuthConsentLocale, McpOAuthConsentTexts, } from './helpers/ai-mcp-oauth-consent.helper.js';
6
6
  export * from './helpers/ai-tool-authorization.helper.js';
7
7
  export * from './core-ai.controller.js';
8
8
  export * from './core-ai.module.js';
@@ -1,7 +1,7 @@
1
1
  export * from './core-ai-mcp-oauth.initializer.js';
2
2
  export * from './core-ai-mcp.controller.js';
3
3
  export * from './helpers/ai-mcp-oauth.helper.js';
4
- export { MCP_OAUTH_CONSENT_DECISION_FIELD, MCP_OAUTH_CONSENT_TOKEN_FIELD, mcpOAuthConsentLocale, renderMcpOAuthConsentPage, } from './helpers/ai-mcp-oauth-consent.helper.js';
4
+ export { MCP_OAUTH_CONSENT_DECISION_FIELD, MCP_OAUTH_CONSENT_TOKEN_FIELD, mcpOAuthConsentLocale, renderMcpOAuthConsentNoticePage, renderMcpOAuthConsentPage, } from './helpers/ai-mcp-oauth-consent.helper.js';
5
5
  export * from './helpers/ai-tool-authorization.helper.js';
6
6
  export * from './core-ai.controller.js';
7
7
  export * from './core-ai.module.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/modules/ai/index.ts"],"names":[],"mappings":"AACA,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AAE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iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qDAAqD,CAAC;AACpE,cAAc,mDAAmD,CAAC;AAClE,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Logger, OnModuleInit } from '@nestjs/common';
2
2
  import type { Connection } from 'mongoose';
3
3
  import type { DataStore } from '../../../common/persistence/data-store.interface.js';
4
- import { IMcpOAuthConsentView } from '../helpers/ai-mcp-oauth-consent.helper.js';
4
+ import { type IMcpOAuthConsentNotice, type IMcpOAuthConsentNoticeView, IMcpOAuthConsentView } from '../helpers/ai-mcp-oauth-consent.helper.js';
5
5
  export interface IMcpOAuthErrorClass {
6
6
  new (message: string, errorUri?: string): Error & {
7
7
  readonly errorCode: string;
@@ -62,6 +62,15 @@ export declare class CoreAiMcpOAuthService implements OnModuleInit {
62
62
  protected allowsDevelopmentSecret(): boolean;
63
63
  isOAuthEnabled(): boolean;
64
64
  usesBuiltInConsent(): boolean;
65
+ mayUseMcp(user: {
66
+ id: string;
67
+ roles?: string[];
68
+ }, _req?: any): Promise<boolean>;
69
+ checkMcpAccess(user: {
70
+ id: string;
71
+ roles?: string[];
72
+ } | null | undefined, req?: any): Promise<boolean>;
73
+ protected mcpAccessRoles(): string[] | undefined;
65
74
  protected oauthEnabled(): boolean;
66
75
  protected resolveSecret(): string | undefined;
67
76
  signAccessToken(userId: string, clientId: string, ttlSeconds?: number): string;
@@ -96,6 +105,8 @@ export declare class CoreAiMcpOAuthService implements OnModuleInit {
96
105
  newToken: string;
97
106
  userId: string;
98
107
  } | null>;
108
+ protected grantMayUseMcp(userId: string): Promise<boolean>;
109
+ protected revokeRefreshToken(token: string): Promise<void>;
99
110
  loadUser(userId: string): Promise<{
100
111
  id: string;
101
112
  roles: string[];
@@ -104,16 +115,21 @@ export declare class CoreAiMcpOAuthService implements OnModuleInit {
104
115
  protected readonly consentTokenTtlSeconds = 600;
105
116
  protected authorizeConsent(client: any, params: any, res: any): Promise<void>;
106
117
  protected renderConsentPage(view: IMcpOAuthConsentView): string;
118
+ protected sendConsentNotice(res: any, notice: IMcpOAuthConsentNotice): Promise<void>;
119
+ protected renderConsentNoticePage(view: IMcpOAuthConsentNoticeView): string;
120
+ protected consentRefusal(req: any): IMcpOAuthConsentNotice;
107
121
  protected consentUser(req: any): Promise<{
108
122
  email?: string;
109
123
  id: string;
110
124
  name?: string;
125
+ roles?: string[];
111
126
  } | undefined>;
112
127
  protected buildConsentView(req: any, client: any, params: any, user: {
113
128
  email?: string;
114
129
  id: string;
115
130
  name?: string;
116
131
  } | undefined, notice?: IMcpOAuthConsentView['notice']): IMcpOAuthConsentView;
132
+ protected consentAuthBasePath(): string | undefined;
117
133
  protected consentAppHost(): string;
118
134
  protected consentLoginUrl(req: any): IMcpOAuthConsentView['loginUrl'];
119
135
  protected signConsentToken(binding: IAiMcpOAuthConsentBinding): string;