@hed-hog/core 0.0.349 → 0.0.351
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.
- package/dist/access-log/access-log.controller.d.ts +16 -0
- package/dist/access-log/access-log.controller.d.ts.map +1 -0
- package/dist/access-log/access-log.controller.js +44 -0
- package/dist/access-log/access-log.controller.js.map +1 -0
- package/dist/access-log/access-log.interceptor.d.ts +9 -0
- package/dist/access-log/access-log.interceptor.d.ts.map +1 -0
- package/dist/access-log/access-log.interceptor.js +46 -0
- package/dist/access-log/access-log.interceptor.js.map +1 -0
- package/dist/access-log/access-log.module.d.ts +3 -0
- package/dist/access-log/access-log.module.d.ts.map +1 -0
- package/dist/access-log/access-log.module.js +29 -0
- package/dist/access-log/access-log.module.js.map +1 -0
- package/dist/access-log/access-log.service.d.ts +47 -0
- package/dist/access-log/access-log.service.d.ts.map +1 -0
- package/dist/access-log/access-log.service.js +113 -0
- package/dist/access-log/access-log.service.js.map +1 -0
- package/dist/access-log/dto/query-access-log.dto.d.ts +8 -0
- package/dist/access-log/dto/query-access-log.dto.d.ts.map +1 -0
- package/dist/access-log/dto/query-access-log.dto.js +42 -0
- package/dist/access-log/dto/query-access-log.dto.js.map +1 -0
- package/dist/auth/auth.controller.d.ts +12 -12
- package/dist/auth/auth.service.d.ts +27 -27
- package/dist/auth/auth.service.d.ts.map +1 -1
- package/dist/auth/auth.service.js +0 -4
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/challenge/challenge.service.d.ts +2 -2
- package/dist/challenge/challenge.service.d.ts.map +1 -1
- package/dist/challenge/challenge.service.js +0 -1
- package/dist/challenge/challenge.service.js.map +1 -1
- package/dist/core/system.module.d.ts.map +1 -1
- package/dist/core/system.module.js +1 -0
- package/dist/core/system.module.js.map +1 -1
- package/dist/core.module.d.ts.map +1 -1
- package/dist/core.module.js +15 -0
- package/dist/core.module.js.map +1 -1
- package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +3 -3
- package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +3 -3
- package/dist/dashboard/dashboard.module.d.ts.map +1 -1
- package/dist/dashboard/dashboard.module.js +4 -1
- package/dist/dashboard/dashboard.module.js.map +1 -1
- package/dist/file/file.controller.js +0 -1
- package/dist/file/file.controller.js.map +1 -1
- package/dist/file/file.service.d.ts +65 -0
- package/dist/file/file.service.d.ts.map +1 -1
- package/dist/file/file.service.js +151 -3
- package/dist/file/file.service.js.map +1 -1
- package/dist/file/provider/abstract.provider.d.ts +8 -0
- package/dist/file/provider/abstract.provider.d.ts.map +1 -1
- package/dist/file/provider/abstract.provider.js.map +1 -1
- package/dist/file/provider/azure.provider.d.ts +4 -0
- package/dist/file/provider/azure.provider.d.ts.map +1 -1
- package/dist/file/provider/azure.provider.js +14 -0
- package/dist/file/provider/azure.provider.js.map +1 -1
- package/dist/file/provider/gcs.provider.d.ts +4 -0
- package/dist/file/provider/gcs.provider.d.ts.map +1 -1
- package/dist/file/provider/gcs.provider.js +14 -0
- package/dist/file/provider/gcs.provider.js.map +1 -1
- package/dist/file/provider/local.provider.d.ts +4 -0
- package/dist/file/provider/local.provider.d.ts.map +1 -1
- package/dist/file/provider/local.provider.js +19 -0
- package/dist/file/provider/local.provider.js.map +1 -1
- package/dist/file/provider/provider.factory.d.ts.map +1 -1
- package/dist/file/provider/provider.factory.js +3 -0
- package/dist/file/provider/provider.factory.js.map +1 -1
- package/dist/file/provider/s3.provider.d.ts +4 -0
- package/dist/file/provider/s3.provider.d.ts.map +1 -1
- package/dist/file/provider/s3.provider.js +17 -0
- package/dist/file/provider/s3.provider.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/guards/mcp-auth.guard.d.ts +6 -1
- package/dist/mcp/guards/mcp-auth.guard.d.ts.map +1 -1
- package/dist/mcp/guards/mcp-auth.guard.js +29 -2
- package/dist/mcp/guards/mcp-auth.guard.js.map +1 -1
- package/dist/mcp/mcp-api-key.controller.d.ts +32 -0
- package/dist/mcp/mcp-api-key.controller.d.ts.map +1 -0
- package/dist/mcp/mcp-api-key.controller.js +64 -0
- package/dist/mcp/mcp-api-key.controller.js.map +1 -0
- package/dist/mcp/mcp-api-key.service.d.ts +27 -0
- package/dist/mcp/mcp-api-key.service.d.ts.map +1 -0
- package/dist/mcp/mcp-api-key.service.js +74 -0
- package/dist/mcp/mcp-api-key.service.js.map +1 -0
- package/dist/mcp/mcp-audit.service.d.ts +3 -1
- package/dist/mcp/mcp-audit.service.d.ts.map +1 -1
- package/dist/mcp/mcp-audit.service.js +14 -2
- package/dist/mcp/mcp-audit.service.js.map +1 -1
- package/dist/mcp/mcp-registry.service.d.ts +1 -2
- package/dist/mcp/mcp-registry.service.d.ts.map +1 -1
- package/dist/mcp/mcp-registry.service.js +6 -2
- package/dist/mcp/mcp-registry.service.js.map +1 -1
- package/dist/mcp/mcp.controller.d.ts +3 -1
- package/dist/mcp/mcp.controller.d.ts.map +1 -1
- package/dist/mcp/mcp.controller.js +10 -2
- package/dist/mcp/mcp.controller.js.map +1 -1
- package/dist/mcp/mcp.module.d.ts.map +1 -1
- package/dist/mcp/mcp.module.js +80 -1
- package/dist/mcp/mcp.module.js.map +1 -1
- package/dist/mcp/tools/core-ai.mcp-tools.d.ts +45 -0
- package/dist/mcp/tools/core-ai.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-ai.mcp-tools.js +214 -0
- package/dist/mcp/tools/core-ai.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts +21 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.js +89 -0
- package/dist/mcp/tools/core-dashboard-items.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts +29 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.js +149 -0
- package/dist/mcp/tools/core-dashboard.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts +30 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.js +185 -0
- package/dist/mcp/tools/core-event-webhooks.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-files.mcp-tools.d.ts +26 -0
- package/dist/mcp/tools/core-files.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-files.mcp-tools.js +140 -0
- package/dist/mcp/tools/core-files.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts +26 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.js +168 -0
- package/dist/mcp/tools/core-integration-events.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts +32 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js +178 -0
- package/dist/mcp/tools/core-mail-profile.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts +14 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.js +106 -0
- package/dist/mcp/tools/core-mail-sent.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mail.mcp-tools.d.ts +36 -0
- package/dist/mcp/tools/core-mail.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mail.mcp-tools.js +184 -0
- package/dist/mcp/tools/core-mail.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts +21 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.js +118 -0
- package/dist/mcp/tools/core-mcp-chat.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-menus.mcp-tools.d.ts +40 -0
- package/dist/mcp/tools/core-menus.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-menus.mcp-tools.js +268 -0
- package/dist/mcp/tools/core-menus.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.d.ts +31 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.js +178 -0
- package/dist/mcp/tools/core-notifications.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-profile.mcp-tools.d.ts +20 -0
- package/dist/mcp/tools/core-profile.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-profile.mcp-tools.js +111 -0
- package/dist/mcp/tools/core-profile.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-roles.mcp-tools.d.ts +70 -0
- package/dist/mcp/tools/core-roles.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-roles.mcp-tools.js +355 -0
- package/dist/mcp/tools/core-roles.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-routes.mcp-tools.d.ts +52 -0
- package/dist/mcp/tools/core-routes.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-routes.mcp-tools.js +254 -0
- package/dist/mcp/tools/core-routes.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-screens.mcp-tools.d.ts +47 -0
- package/dist/mcp/tools/core-screens.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-screens.mcp-tools.js +250 -0
- package/dist/mcp/tools/core-screens.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.d.ts +20 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.js +128 -0
- package/dist/mcp/tools/core-sessions.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-settings.mcp-tools.d.ts +25 -0
- package/dist/mcp/tools/core-settings.mcp-tools.d.ts.map +1 -1
- package/dist/mcp/tools/core-settings.mcp-tools.js +138 -0
- package/dist/mcp/tools/core-settings.mcp-tools.js.map +1 -1
- package/dist/mcp/tools/core-system.mcp-tools.d.ts +8 -0
- package/dist/mcp/tools/core-system.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-system.mcp-tools.js +40 -0
- package/dist/mcp/tools/core-system.mcp-tools.js.map +1 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts +46 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.d.ts.map +1 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.js +266 -0
- package/dist/mcp/tools/core-webhooks.mcp-tools.js.map +1 -0
- package/dist/mcp-chat/mcp-chat.controller.d.ts +5 -1
- package/dist/mcp-chat/mcp-chat.controller.d.ts.map +1 -1
- package/dist/mcp-chat/mcp-chat.controller.js +46 -0
- package/dist/mcp-chat/mcp-chat.controller.js.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.d.ts +31 -3
- package/dist/mcp-chat/mcp-chat.service.d.ts.map +1 -1
- package/dist/mcp-chat/mcp-chat.service.js +776 -38
- package/dist/mcp-chat/mcp-chat.service.js.map +1 -1
- package/dist/notification/dto/create-notification.dto.d.ts +26 -0
- package/dist/notification/dto/create-notification.dto.d.ts.map +1 -0
- package/dist/notification/dto/create-notification.dto.js +86 -0
- package/dist/notification/dto/create-notification.dto.js.map +1 -0
- package/dist/notification/dto/update-progress.dto.d.ts +6 -0
- package/dist/notification/dto/update-progress.dto.d.ts.map +1 -0
- package/dist/notification/dto/update-progress.dto.js +33 -0
- package/dist/notification/dto/update-progress.dto.js.map +1 -0
- package/dist/notification/notification.controller.d.ts +112 -0
- package/dist/notification/notification.controller.d.ts.map +1 -0
- package/dist/notification/notification.controller.js +130 -0
- package/dist/notification/notification.controller.js.map +1 -0
- package/dist/notification/notification.module.d.ts +3 -0
- package/dist/notification/notification.module.d.ts.map +1 -0
- package/dist/notification/notification.module.js +29 -0
- package/dist/notification/notification.module.js.map +1 -0
- package/dist/notification/notification.service.d.ts +112 -0
- package/dist/notification/notification.service.d.ts.map +1 -0
- package/dist/notification/notification.service.js +269 -0
- package/dist/notification/notification.service.js.map +1 -0
- package/dist/pdf/pdf.service.js +1 -1
- package/dist/pdf/pdf.service.js.map +1 -1
- package/dist/profile/profile.controller.d.ts +4 -4
- package/dist/profile/profile.controller.js +0 -1
- package/dist/profile/profile.controller.js.map +1 -1
- package/dist/profile/profile.module.d.ts.map +1 -1
- package/dist/profile/profile.module.js +1 -0
- package/dist/profile/profile.module.js.map +1 -1
- package/dist/profile/profile.service.d.ts +4 -4
- package/dist/session/session.controller.d.ts +3 -3
- package/dist/session/session.service.d.ts +9 -9
- package/dist/setting/dto/update-setting-list.dto.d.ts +9 -0
- package/dist/setting/dto/update-setting-list.dto.d.ts.map +1 -0
- package/dist/setting/dto/update-setting-list.dto.js +44 -0
- package/dist/setting/dto/update-setting-list.dto.js.map +1 -0
- package/dist/setting/setting.controller.d.ts +20 -1
- package/dist/setting/setting.controller.d.ts.map +1 -1
- package/dist/setting/setting.controller.js +12 -0
- package/dist/setting/setting.controller.js.map +1 -1
- package/dist/setting/setting.service.d.ts +20 -1
- package/dist/setting/setting.service.d.ts.map +1 -1
- package/dist/setting/setting.service.js +80 -4
- package/dist/setting/setting.service.js.map +1 -1
- package/dist/task/task.service.d.ts +13 -0
- package/dist/task/task.service.d.ts.map +1 -1
- package/dist/task/task.service.js +85 -0
- package/dist/task/task.service.js.map +1 -1
- package/dist/token/token.service.d.ts.map +1 -1
- package/dist/token/token.service.js +0 -1
- package/dist/token/token.service.js.map +1 -1
- package/dist/user/user.controller.d.ts +11 -11
- package/dist/user/user.service.d.ts +27 -27
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts +22 -0
- package/dist/webhook-integration/dto/webhook-action.dto.d.ts.map +1 -0
- package/dist/webhook-integration/dto/webhook-action.dto.js +120 -0
- package/dist/webhook-integration/dto/webhook-action.dto.js.map +1 -0
- package/dist/webhook-integration/webhook-integration.controller.d.ts +7 -5
- package/dist/webhook-integration/webhook-integration.controller.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.controller.js +18 -5
- package/dist/webhook-integration/webhook-integration.controller.js.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.d.ts +18 -5
- package/dist/webhook-integration/webhook-integration.service.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-integration.service.js +342 -59
- package/dist/webhook-integration/webhook-integration.service.js.map +1 -1
- package/dist/webhook-integration/webhook-utils.d.ts +1 -0
- package/dist/webhook-integration/webhook-utils.d.ts.map +1 -1
- package/dist/webhook-integration/webhook-utils.js +38 -0
- package/dist/webhook-integration/webhook-utils.js.map +1 -1
- package/hedhog/data/menu.yaml +63 -4
- package/hedhog/data/route.yaml +1437 -0
- package/hedhog/data/setting_group.yaml +112 -0
- package/hedhog/data/setting_subgroup.yaml +32 -0
- package/hedhog/frontend/app/access-log/page.tsx.ejs +772 -0
- package/hedhog/frontend/app/account/components/mcp-tokens.tsx.ejs +285 -0
- package/hedhog/frontend/app/account/layout.tsx.ejs +32 -55
- package/hedhog/frontend/app/account/mcp-tokens/page.tsx.ejs +5 -0
- package/hedhog/frontend/app/ai_agent/page.tsx.ejs +10 -3
- package/hedhog/frontend/app/dashboard/dashboard-home-tabs.tsx.ejs +33 -13
- package/hedhog/frontend/app/dashboard/management/tabs/components-tab.tsx.ejs +12 -5
- package/hedhog/frontend/app/dashboard/management/tabs/dashboards-tab.tsx.ejs +12 -5
- package/hedhog/frontend/app/integrations-webhooks/page.tsx.ejs +3559 -1835
- package/hedhog/frontend/app/mcp_chat/chat-components.tsx.ejs +633 -0
- package/hedhog/frontend/app/mcp_chat/chat-types.ts.ejs +16 -0
- package/hedhog/frontend/app/mcp_chat/page.tsx.ejs +583 -384
- package/hedhog/frontend/app/menu/page.tsx.ejs +9 -3
- package/hedhog/frontend/app/roles/page.tsx.ejs +18 -6
- package/hedhog/frontend/app/routes/page.tsx.ejs +9 -3
- package/hedhog/frontend/app/setting-list/page.tsx.ejs +822 -0
- package/hedhog/frontend/app/users/page.tsx.ejs +445 -203
- package/hedhog/frontend/app/users/user-access-sheet.tsx.ejs +310 -304
- package/hedhog/frontend/app/users/user-sheet.tsx.ejs +41 -44
- package/hedhog/frontend/messages/en.json +343 -3
- package/hedhog/frontend/messages/pt.json +343 -3
- package/hedhog/table/access_log.yaml +31 -0
- package/hedhog/table/mcp_api_key.yaml +30 -0
- package/hedhog/table/notification.yaml +72 -0
- package/hedhog/table/webhook_action_log.yaml +49 -0
- package/package.json +5 -4
- package/src/access-log/access-log.controller.ts +29 -0
- package/src/access-log/access-log.interceptor.ts +38 -0
- package/src/access-log/access-log.module.ts +16 -0
- package/src/access-log/access-log.service.ts +129 -0
- package/src/access-log/dto/query-access-log.dto.ts +23 -0
- package/src/auth/auth.service.ts +0 -7
- package/src/challenge/challenge.service.ts +0 -2
- package/src/core/system.module.ts +1 -0
- package/src/core.module.ts +15 -0
- package/src/dashboard/dashboard.module.ts +4 -1
- package/src/file/file.controller.ts +14 -14
- package/src/file/file.service.ts +198 -4
- package/src/file/provider/abstract.provider.ts +10 -0
- package/src/file/provider/azure.provider.ts +24 -0
- package/src/file/provider/gcs.provider.ts +20 -0
- package/src/file/provider/local.provider.ts +30 -2
- package/src/file/provider/provider.factory.ts +3 -0
- package/src/file/provider/s3.provider.ts +22 -0
- package/src/index.ts +5 -0
- package/src/mcp/guards/mcp-auth.guard.ts +64 -32
- package/src/mcp/mcp-api-key.controller.ts +42 -0
- package/src/mcp/mcp-api-key.service.ts +66 -0
- package/src/mcp/mcp-audit.service.ts +47 -36
- package/src/mcp/mcp-registry.service.ts +75 -69
- package/src/mcp/mcp.controller.ts +40 -30
- package/src/mcp/mcp.module.ts +115 -36
- package/src/mcp/tools/core-ai.mcp-tools.ts +156 -0
- package/src/mcp/tools/core-dashboard-items.mcp-tools.ts +63 -0
- package/src/mcp/tools/core-dashboard.mcp-tools.ts +103 -0
- package/src/mcp/tools/core-event-webhooks.mcp-tools.ts +134 -0
- package/src/mcp/tools/core-files.mcp-tools.ts +105 -0
- package/src/mcp/tools/core-integration-events.mcp-tools.ts +118 -0
- package/src/mcp/tools/core-mail-profile.mcp-tools.ts +128 -0
- package/src/mcp/tools/core-mail-sent.mcp-tools.ts +76 -0
- package/src/mcp/tools/core-mail.mcp-tools.ts +130 -0
- package/src/mcp/tools/core-mcp-chat.mcp-tools.ts +81 -0
- package/src/mcp/tools/core-menus.mcp-tools.ts +197 -0
- package/src/mcp/tools/core-notifications.mcp-tools.ts +128 -0
- package/src/mcp/tools/core-profile.mcp-tools.ts +74 -0
- package/src/mcp/tools/core-roles.mcp-tools.ts +288 -0
- package/src/mcp/tools/core-routes.mcp-tools.ts +196 -0
- package/src/mcp/tools/core-screens.mcp-tools.ts +186 -0
- package/src/mcp/tools/core-sessions.mcp-tools.ts +97 -0
- package/src/mcp/tools/core-settings.mcp-tools.ts +171 -53
- package/src/mcp/tools/core-system.mcp-tools.ts +19 -0
- package/src/mcp/tools/core-webhooks.mcp-tools.ts +199 -0
- package/src/mcp-chat/mcp-chat.controller.ts +113 -60
- package/src/mcp-chat/mcp-chat.service.ts +1343 -332
- package/src/notification/dto/create-notification.dto.ts +71 -0
- package/src/notification/dto/update-progress.dto.ts +16 -0
- package/src/notification/notification.controller.ts +83 -0
- package/src/notification/notification.module.ts +16 -0
- package/src/notification/notification.service.ts +324 -0
- package/src/pdf/pdf.service.ts +1 -1
- package/src/profile/profile.controller.ts +1 -1
- package/src/profile/profile.module.ts +1 -0
- package/src/setting/dto/update-setting-list.dto.ts +32 -0
- package/src/setting/setting.controller.ts +9 -0
- package/src/setting/setting.service.ts +99 -11
- package/src/task/task.service.ts +103 -0
- package/src/token/token.service.ts +0 -2
- package/src/webhook-integration/dto/webhook-action.dto.ts +96 -0
- package/src/webhook-integration/webhook-integration.controller.ts +124 -103
- package/src/webhook-integration/webhook-integration.service.ts +1137 -735
- package/src/webhook-integration/webhook-utils.ts +136 -79
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JwtService } from '@nestjs/jwt';
|
|
2
2
|
import { AbstractProvider } from './abstract.provider';
|
|
3
3
|
import { AzureProvider } from './azure.provider';
|
|
4
|
+
import { GCSProvider } from './gcs.provider';
|
|
4
5
|
import { LocalProvider } from './local.provider';
|
|
5
6
|
import { EnumProvider } from './provider.enum';
|
|
6
7
|
import { S3Provider } from './s3.provider';
|
|
@@ -18,6 +19,8 @@ export class ProviderFactory {
|
|
|
18
19
|
return new LocalProvider(setting, jwtService);
|
|
19
20
|
case EnumProvider.AZURE:
|
|
20
21
|
return new AzureProvider(setting);
|
|
22
|
+
case EnumProvider.GCS:
|
|
23
|
+
return new GCSProvider(setting);
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
} from '@aws-sdk/client-s3';
|
|
10
10
|
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
11
11
|
import { BadRequestException } from '@nestjs/common';
|
|
12
|
+
import { createReadStream } from 'fs';
|
|
13
|
+
import { basename } from 'path';
|
|
12
14
|
import { Readable } from 'stream';
|
|
13
15
|
import { AbstractProvider } from './abstract.provider';
|
|
14
16
|
|
|
@@ -166,6 +168,26 @@ export class S3Provider extends AbstractProvider {
|
|
|
166
168
|
return `https://${this.setting['storage-s3-bucket']}.s3.${this.setting['storage-s3-region']}.amazonaws.com/${key}`;
|
|
167
169
|
}
|
|
168
170
|
|
|
171
|
+
async uploadFromPath(
|
|
172
|
+
destination: string,
|
|
173
|
+
filePath: string,
|
|
174
|
+
options?: { filename?: string; mimetype?: string },
|
|
175
|
+
): Promise<any> {
|
|
176
|
+
const s3 = await this.getClient();
|
|
177
|
+
const originalName = options?.filename ?? basename(filePath);
|
|
178
|
+
const storedFilename = this.getFilename(originalName);
|
|
179
|
+
const key = [destination, storedFilename].join('/');
|
|
180
|
+
const command = new PutObjectCommand({
|
|
181
|
+
Bucket: this.setting['storage-s3-bucket'],
|
|
182
|
+
Key: key,
|
|
183
|
+
Body: createReadStream(filePath),
|
|
184
|
+
ContentType: options?.mimetype,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
await s3.send(command);
|
|
188
|
+
return `https://${this.setting['storage-s3-bucket']}.s3.${this.setting['storage-s3-region']}.amazonaws.com/${key}`;
|
|
189
|
+
}
|
|
190
|
+
|
|
169
191
|
async delete(filepath: string): Promise<any> {
|
|
170
192
|
const s3 = await this.getClient();
|
|
171
193
|
const key = this.resolveS3Key(filepath);
|
package/src/index.ts
CHANGED
|
@@ -70,3 +70,8 @@ export * from './mcp/types/mcp-context.type';
|
|
|
70
70
|
// Utilities
|
|
71
71
|
export * from './utils/locale-context';
|
|
72
72
|
|
|
73
|
+
|
|
74
|
+
// Notification Module
|
|
75
|
+
export * from './notification/notification.module';
|
|
76
|
+
export * from './notification/notification.service';
|
|
77
|
+
export * from './notification/dto/create-notification.dto';
|
|
@@ -1,32 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
1
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
+
import {
|
|
3
|
+
CanActivate,
|
|
4
|
+
ExecutionContext,
|
|
5
|
+
Injectable,
|
|
6
|
+
UnauthorizedException,
|
|
7
|
+
} from '@nestjs/common';
|
|
8
|
+
import { Request } from 'express';
|
|
9
|
+
import { SecurityService } from '../../security/security.service';
|
|
10
|
+
import { TokenService } from '../../token/token.service';
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class McpAuthGuard implements CanActivate {
|
|
14
|
+
constructor(
|
|
15
|
+
private readonly tokenService: TokenService,
|
|
16
|
+
private readonly prisma: PrismaService,
|
|
17
|
+
private readonly security: SecurityService,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
async canActivate(context: ExecutionContext): Promise<boolean> {
|
|
21
|
+
const request = context.switchToHttp().getRequest<Request>();
|
|
22
|
+
const locale =
|
|
23
|
+
request.headers['accept-language']?.split(',')[0]?.split('-')[0] ?? 'en';
|
|
24
|
+
|
|
25
|
+
const token = this.extractToken(request);
|
|
26
|
+
if (!token) {
|
|
27
|
+
throw new UnauthorizedException('MCP: Bearer token required');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (token.startsWith('hedhog_mcp_')) {
|
|
31
|
+
return this.verifyApiKey(request, token);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
request['auth'] = await this.tokenService.verify(locale, token);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private async verifyApiKey(request: Request, token: string): Promise<boolean> {
|
|
39
|
+
const hash = this.security.hashWithPepper(token);
|
|
40
|
+
const apiKey = await this.prisma.mcp_api_key.findFirst({
|
|
41
|
+
where: { token_hash: hash, revoked_at: null },
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (!apiKey) {
|
|
45
|
+
throw new UnauthorizedException('MCP: Invalid API key');
|
|
46
|
+
}
|
|
47
|
+
if (apiKey.expires_at && apiKey.expires_at <= new Date()) {
|
|
48
|
+
throw new UnauthorizedException('MCP: API key expired');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.prisma.mcp_api_key.update({
|
|
52
|
+
where: { id: apiKey.id },
|
|
53
|
+
data: { last_used_at: new Date() },
|
|
54
|
+
}).catch(() => {});
|
|
55
|
+
|
|
56
|
+
request['auth'] = { sub: apiKey.user_id, sessionId: null };
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private extractToken(request: Request): string | undefined {
|
|
61
|
+
const [type, token] = request.headers.authorization?.split(' ') ?? [];
|
|
62
|
+
return type === 'Bearer' ? token : undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Role, User } from '@hed-hog/api';
|
|
2
|
+
import { Pagination, PaginationDTO } from '@hed-hog/api-pagination';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Post,
|
|
11
|
+
} from '@nestjs/common';
|
|
12
|
+
import { McpApiKeyService } from './mcp-api-key.service';
|
|
13
|
+
|
|
14
|
+
@Role()
|
|
15
|
+
@Controller('mcp/api-keys')
|
|
16
|
+
export class McpApiKeyController {
|
|
17
|
+
constructor(private readonly mcpApiKeyService: McpApiKeyService) {}
|
|
18
|
+
|
|
19
|
+
@Get()
|
|
20
|
+
list(
|
|
21
|
+
@Pagination() paginationParams: PaginationDTO,
|
|
22
|
+
@User() { id }: { id: number },
|
|
23
|
+
) {
|
|
24
|
+
return this.mcpApiKeyService.list(id, paginationParams);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@Post()
|
|
28
|
+
create(
|
|
29
|
+
@User() { id }: { id: number },
|
|
30
|
+
@Body() body: { name: string },
|
|
31
|
+
) {
|
|
32
|
+
return this.mcpApiKeyService.create(id, body.name);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Delete(':id')
|
|
36
|
+
revoke(
|
|
37
|
+
@User() { id: userId }: { id: number },
|
|
38
|
+
@Param('id', ParseIntPipe) id: number,
|
|
39
|
+
) {
|
|
40
|
+
return this.mcpApiKeyService.revoke(userId, id);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { PaginationDTO, PaginationService } from '@hed-hog/api-pagination';
|
|
2
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
3
|
+
import { Injectable, NotFoundException } from '@nestjs/common';
|
|
4
|
+
import { SecurityService } from '../security/security.service';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class McpApiKeyService {
|
|
8
|
+
constructor(
|
|
9
|
+
private readonly prisma: PrismaService,
|
|
10
|
+
private readonly security: SecurityService,
|
|
11
|
+
private readonly pagination: PaginationService,
|
|
12
|
+
) {}
|
|
13
|
+
|
|
14
|
+
async list(userId: number, paginationParams: PaginationDTO) {
|
|
15
|
+
return this.pagination.paginatePrismaModel(this.prisma.mcp_api_key, {
|
|
16
|
+
...paginationParams,
|
|
17
|
+
where: { user_id: userId, revoked_at: null },
|
|
18
|
+
select: {
|
|
19
|
+
id: true,
|
|
20
|
+
name: true,
|
|
21
|
+
token_prefix: true,
|
|
22
|
+
last_used_at: true,
|
|
23
|
+
expires_at: true,
|
|
24
|
+
created_at: true,
|
|
25
|
+
},
|
|
26
|
+
orderBy: { created_at: 'desc' },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async create(userId: number, name: string) {
|
|
31
|
+
const rawToken = 'hedhog_mcp_' + this.security.randomOpaque(36);
|
|
32
|
+
const tokenHash = this.security.hashWithPepper(rawToken);
|
|
33
|
+
const tokenPrefix = rawToken.substring(0, 16);
|
|
34
|
+
|
|
35
|
+
const record = await this.prisma.mcp_api_key.create({
|
|
36
|
+
data: {
|
|
37
|
+
user_id: userId,
|
|
38
|
+
name,
|
|
39
|
+
token_hash: tokenHash,
|
|
40
|
+
token_prefix: tokenPrefix,
|
|
41
|
+
},
|
|
42
|
+
select: {
|
|
43
|
+
id: true,
|
|
44
|
+
name: true,
|
|
45
|
+
token_prefix: true,
|
|
46
|
+
created_at: true,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return { ...record, rawToken };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async revoke(userId: number, id: number) {
|
|
54
|
+
const key = await this.prisma.mcp_api_key.findFirst({
|
|
55
|
+
where: { id, user_id: userId },
|
|
56
|
+
});
|
|
57
|
+
if (!key) {
|
|
58
|
+
throw new NotFoundException(`MCP API key ${id} not found`);
|
|
59
|
+
}
|
|
60
|
+
await this.prisma.mcp_api_key.update({
|
|
61
|
+
where: { id },
|
|
62
|
+
data: { revoked_at: new Date() },
|
|
63
|
+
});
|
|
64
|
+
return { success: true };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,36 +1,47 @@
|
|
|
1
|
-
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
-
import { Injectable, Logger } from '@nestjs/common';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
1
|
+
import { PrismaService } from '@hed-hog/api-prisma';
|
|
2
|
+
import { forwardRef, Inject, Injectable, Logger } from '@nestjs/common';
|
|
3
|
+
import { AccessLogService } from '../access-log/access-log.service';
|
|
4
|
+
|
|
5
|
+
interface AuditRecord {
|
|
6
|
+
userId: number;
|
|
7
|
+
toolName: string;
|
|
8
|
+
input: Record<string, any>;
|
|
9
|
+
success: boolean;
|
|
10
|
+
error?: string;
|
|
11
|
+
durationMs: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@Injectable()
|
|
15
|
+
export class McpAuditService {
|
|
16
|
+
private readonly logger = new Logger(McpAuditService.name);
|
|
17
|
+
|
|
18
|
+
constructor(
|
|
19
|
+
private readonly prisma: PrismaService,
|
|
20
|
+
@Inject(forwardRef(() => AccessLogService))
|
|
21
|
+
private readonly accessLogService: AccessLogService,
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
async record(data: AuditRecord): Promise<void> {
|
|
25
|
+
const sanitized = JSON.stringify(data.input).slice(0, 1000);
|
|
26
|
+
try {
|
|
27
|
+
await this.prisma.mcp_tool_call_log.create({
|
|
28
|
+
data: {
|
|
29
|
+
user_id: data.userId || null,
|
|
30
|
+
tool_name: data.toolName,
|
|
31
|
+
input: sanitized,
|
|
32
|
+
success: data.success,
|
|
33
|
+
error: data.error ?? null,
|
|
34
|
+
duration_ms: data.durationMs,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
} catch (e: any) {
|
|
38
|
+
this.logger.warn(`Failed to persist MCP audit record: ${e.message}`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
this.accessLogService.recordMcp({
|
|
42
|
+
userId: data.userId || undefined,
|
|
43
|
+
mcpTool: data.toolName,
|
|
44
|
+
mcpPrompt: sanitized,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,69 +1,75 @@
|
|
|
1
|
-
import { Injectable, Logger, OnModuleInit } from '@nestjs/common';
|
|
2
|
-
import { DiscoveryService } from '@nestjs/core';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
private readonly
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
private readonly
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
import { Injectable, Logger, OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
3
|
+
import { MCP_TOOL_METADATA } from './decorators/mcp-tool.decorator';
|
|
4
|
+
import { McpToolDefinition } from './interfaces/mcp-tool-definition.interface';
|
|
5
|
+
import { McpContext } from './types/mcp-context.type';
|
|
6
|
+
|
|
7
|
+
export interface McpToolEntry {
|
|
8
|
+
definition: McpToolDefinition;
|
|
9
|
+
handler: (args: Record<string, any>, context: McpContext) => Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class McpRegistryService implements OnModuleInit {
|
|
14
|
+
private readonly logger = new Logger(McpRegistryService.name);
|
|
15
|
+
private readonly tools = new Map<string, McpToolEntry>();
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
private readonly discovery: DiscoveryService,
|
|
19
|
+
private readonly reflector: Reflector,
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
onModuleInit(): void {
|
|
23
|
+
const providers = this.discovery.getProviders();
|
|
24
|
+
|
|
25
|
+
for (const wrapper of providers) {
|
|
26
|
+
const { instance } = wrapper;
|
|
27
|
+
if (!instance || typeof instance !== 'object') continue;
|
|
28
|
+
|
|
29
|
+
const prototype = Object.getPrototypeOf(instance);
|
|
30
|
+
if (!prototype) continue;
|
|
31
|
+
|
|
32
|
+
const methodNames = Object.getOwnPropertyNames(prototype).filter((key) => {
|
|
33
|
+
if (key === 'constructor') return false;
|
|
34
|
+
const descriptor = Object.getOwnPropertyDescriptor(prototype, key);
|
|
35
|
+
return descriptor !== undefined && typeof descriptor.value === 'function';
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
for (const methodName of methodNames) {
|
|
39
|
+
const definition = this.reflector.get<McpToolDefinition>(
|
|
40
|
+
MCP_TOOL_METADATA,
|
|
41
|
+
prototype[methodName],
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
if (!definition) continue;
|
|
45
|
+
|
|
46
|
+
if (this.tools.has(definition.name)) {
|
|
47
|
+
this.logger.warn(
|
|
48
|
+
`Duplicate MCP tool ignored: ${definition.name} from ${prototype.constructor?.name}.${methodName}`,
|
|
49
|
+
);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.logger.log(`Registered MCP tool: ${definition.name}`);
|
|
54
|
+
this.tools.set(definition.name, {
|
|
55
|
+
definition,
|
|
56
|
+
handler: (instance as any)[methodName].bind(instance),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.logger.log(`McpRegistryService: ${this.tools.size} tools registered`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getAll(): McpToolEntry[] {
|
|
65
|
+
return Array.from(this.tools.values());
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get(toolName: string): McpToolEntry | undefined {
|
|
69
|
+
return this.tools.get(toolName);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
has(toolName: string): boolean {
|
|
73
|
+
return this.tools.has(toolName);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1,30 +1,40 @@
|
|
|
1
|
-
import { NoRole } from '@hed-hog/api';
|
|
2
|
-
import { All, Controller, Req, Res, UseGuards } from '@nestjs/common';
|
|
3
|
-
import { Request, Response } from 'express';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@
|
|
10
|
-
@
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import { NoRole } from '@hed-hog/api';
|
|
2
|
+
import { All, Controller, Req, Res, UseGuards } from '@nestjs/common';
|
|
3
|
+
import { Request, Response } from 'express';
|
|
4
|
+
import { SettingService } from '../setting/setting.service';
|
|
5
|
+
import { McpAuthGuard } from './guards/mcp-auth.guard';
|
|
6
|
+
import { McpPermissionGuard } from './guards/mcp-permission.guard';
|
|
7
|
+
import { McpServerService } from './mcp-server.service';
|
|
8
|
+
|
|
9
|
+
@NoRole()
|
|
10
|
+
@UseGuards(McpAuthGuard, McpPermissionGuard)
|
|
11
|
+
@Controller('mcp')
|
|
12
|
+
export class McpController {
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly mcpServer: McpServerService,
|
|
15
|
+
private readonly setting: SettingService,
|
|
16
|
+
) {}
|
|
17
|
+
|
|
18
|
+
@All()
|
|
19
|
+
async handle(@Req() req: Request, @Res() res: Response): Promise<void> {
|
|
20
|
+
const settings = await this.setting.getSettingValues(['mcp-enabled']);
|
|
21
|
+
if (settings['mcp-enabled'] === false) {
|
|
22
|
+
res.status(503).json({ message: 'MCP server is disabled.' });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const auth = (req as any).auth;
|
|
27
|
+
const locale =
|
|
28
|
+
req.headers['accept-language']?.split(',')[0]?.split('-')[0] ?? 'en';
|
|
29
|
+
const body = req.body as any;
|
|
30
|
+
const toolName: string =
|
|
31
|
+
body?.method === 'tools/call' ? (body?.params?.name ?? '') : '';
|
|
32
|
+
|
|
33
|
+
await this.mcpServer.handleRequest(req, res, {
|
|
34
|
+
userId: auth.sub,
|
|
35
|
+
sessionId: String(auth.sessionId),
|
|
36
|
+
locale,
|
|
37
|
+
toolName,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|