fix tools when auth is disabled + log notifications to console

This commit is contained in:
dswbx
2025-08-09 15:07:20 +02:00
parent ad04d5273e
commit 822e6fd644
5 changed files with 27 additions and 7 deletions

View File

@@ -121,9 +121,10 @@ export class ModuleHelper {
invariant(c.context.app, "app is not available in mcp context");
invariant(c.raw instanceof Request, "request is not available in mcp context");
const user = await c.context.app.module.auth.authenticator.resolveAuthFromRequest(
c.raw as Request,
);
const auth = c.context.app.module.auth;
if (!auth.enabled) return;
const user = await auth.authenticator?.resolveAuthFromRequest(c.raw as Request);
if (!this.ctx.guard.granted(permission, user)) {
throw new Exception(