vikunja-mcp-ng 0.4.0
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/LICENSE +21 -0
- package/README.md +123 -0
- package/dist/auth/AuthManager.d.ts +63 -0
- package/dist/auth/AuthManager.d.ts.map +1 -0
- package/dist/auth/AuthManager.js +137 -0
- package/dist/auth/AuthManager.js.map +1 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +14 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/permissions.d.ts +60 -0
- package/dist/auth/permissions.d.ts.map +1 -0
- package/dist/auth/permissions.js +173 -0
- package/dist/auth/permissions.js.map +1 -0
- package/dist/client/VikunjaClientFactory.d.ts +41 -0
- package/dist/client/VikunjaClientFactory.d.ts.map +1 -0
- package/dist/client/VikunjaClientFactory.js +58 -0
- package/dist/client/VikunjaClientFactory.js.map +1 -0
- package/dist/client.d.ts +70 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +136 -0
- package/dist/client.js.map +1 -0
- package/dist/config/ConfigurationManager.d.ts +106 -0
- package/dist/config/ConfigurationManager.d.ts.map +1 -0
- package/dist/config/ConfigurationManager.js +509 -0
- package/dist/config/ConfigurationManager.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +36 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/secrets.d.ts +33 -0
- package/dist/config/secrets.d.ts.map +1 -0
- package/dist/config/secrets.js +90 -0
- package/dist/config/secrets.js.map +1 -0
- package/dist/config/types.d.ts +1113 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +189 -0
- package/dist/config/types.js.map +1 -0
- package/dist/formatters/BatchImportResponseFormatter.d.ts +89 -0
- package/dist/formatters/BatchImportResponseFormatter.d.ts.map +1 -0
- package/dist/formatters/BatchImportResponseFormatter.js +125 -0
- package/dist/formatters/BatchImportResponseFormatter.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +130 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/direct-middleware.d.ts +9 -0
- package/dist/middleware/direct-middleware.d.ts.map +1 -0
- package/dist/middleware/direct-middleware.js +49 -0
- package/dist/middleware/direct-middleware.js.map +1 -0
- package/dist/middleware/index.d.ts +8 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +21 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/simplified-rate-limit.d.ts +147 -0
- package/dist/middleware/simplified-rate-limit.d.ts.map +1 -0
- package/dist/middleware/simplified-rate-limit.js +533 -0
- package/dist/middleware/simplified-rate-limit.js.map +1 -0
- package/dist/parsers/CSVParser.d.ts +36 -0
- package/dist/parsers/CSVParser.d.ts.map +1 -0
- package/dist/parsers/CSVParser.js +69 -0
- package/dist/parsers/CSVParser.js.map +1 -0
- package/dist/parsers/InputParserFactory.d.ts +17 -0
- package/dist/parsers/InputParserFactory.d.ts.map +1 -0
- package/dist/parsers/InputParserFactory.js +137 -0
- package/dist/parsers/InputParserFactory.js.map +1 -0
- package/dist/parsers/JSONParser.d.ts +74 -0
- package/dist/parsers/JSONParser.d.ts.map +1 -0
- package/dist/parsers/JSONParser.js +69 -0
- package/dist/parsers/JSONParser.js.map +1 -0
- package/dist/services/EntityResolver.d.ts +92 -0
- package/dist/services/EntityResolver.d.ts.map +1 -0
- package/dist/services/EntityResolver.js +201 -0
- package/dist/services/EntityResolver.js.map +1 -0
- package/dist/services/TaskCreationService.d.ts +99 -0
- package/dist/services/TaskCreationService.d.ts.map +1 -0
- package/dist/services/TaskCreationService.js +392 -0
- package/dist/services/TaskCreationService.js.map +1 -0
- package/dist/storage/SimpleFilterStorage.d.ts +103 -0
- package/dist/storage/SimpleFilterStorage.d.ts.map +1 -0
- package/dist/storage/SimpleFilterStorage.js +350 -0
- package/dist/storage/SimpleFilterStorage.js.map +1 -0
- package/dist/storage/filtering/FilterSerializer.d.ts +45 -0
- package/dist/storage/filtering/FilterSerializer.d.ts.map +1 -0
- package/dist/storage/filtering/FilterSerializer.js +171 -0
- package/dist/storage/filtering/FilterSerializer.js.map +1 -0
- package/dist/storage/filtering/FilterValidator.d.ts +59 -0
- package/dist/storage/filtering/FilterValidator.d.ts.map +1 -0
- package/dist/storage/filtering/FilterValidator.js +183 -0
- package/dist/storage/filtering/FilterValidator.js.map +1 -0
- package/dist/storage/index.d.ts +61 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +125 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/templateFileStore.d.ts +62 -0
- package/dist/storage/templateFileStore.d.ts.map +1 -0
- package/dist/storage/templateFileStore.js +151 -0
- package/dist/storage/templateFileStore.js.map +1 -0
- package/dist/tools/admin.d.ts +51 -0
- package/dist/tools/admin.d.ts.map +1 -0
- package/dist/tools/admin.js +207 -0
- package/dist/tools/admin.js.map +1 -0
- package/dist/tools/auth.d.ts +9 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +175 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/batch-import.d.ts +5 -0
- package/dist/tools/batch-import.d.ts.map +1 -0
- package/dist/tools/batch-import.js +153 -0
- package/dist/tools/batch-import.js.map +1 -0
- package/dist/tools/caldav-tokens.d.ts +45 -0
- package/dist/tools/caldav-tokens.d.ts.map +1 -0
- package/dist/tools/caldav-tokens.js +93 -0
- package/dist/tools/caldav-tokens.js.map +1 -0
- package/dist/tools/export.d.ts +14 -0
- package/dist/tools/export.d.ts.map +1 -0
- package/dist/tools/export.js +252 -0
- package/dist/tools/export.js.map +1 -0
- package/dist/tools/filters.d.ts +50 -0
- package/dist/tools/filters.d.ts.map +1 -0
- package/dist/tools/filters.js +512 -0
- package/dist/tools/filters.js.map +1 -0
- package/dist/tools/index.d.ts +53 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +217 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/labels.d.ts +22 -0
- package/dist/tools/labels.d.ts.map +1 -0
- package/dist/tools/labels.js +206 -0
- package/dist/tools/labels.js.map +1 -0
- package/dist/tools/notifications.d.ts +17 -0
- package/dist/tools/notifications.d.ts.map +1 -0
- package/dist/tools/notifications.js +171 -0
- package/dist/tools/notifications.js.map +1 -0
- package/dist/tools/projects/backgrounds.d.ts +80 -0
- package/dist/tools/projects/backgrounds.d.ts.map +1 -0
- package/dist/tools/projects/backgrounds.js +154 -0
- package/dist/tools/projects/backgrounds.js.map +1 -0
- package/dist/tools/projects/buckets.d.ts +147 -0
- package/dist/tools/projects/buckets.d.ts.map +1 -0
- package/dist/tools/projects/buckets.js +291 -0
- package/dist/tools/projects/buckets.js.map +1 -0
- package/dist/tools/projects/crud.d.ts +145 -0
- package/dist/tools/projects/crud.d.ts.map +1 -0
- package/dist/tools/projects/crud.js +425 -0
- package/dist/tools/projects/crud.js.map +1 -0
- package/dist/tools/projects/duplicate.d.ts +41 -0
- package/dist/tools/projects/duplicate.d.ts.map +1 -0
- package/dist/tools/projects/duplicate.js +49 -0
- package/dist/tools/projects/duplicate.js.map +1 -0
- package/dist/tools/projects/hierarchy.d.ts +77 -0
- package/dist/tools/projects/hierarchy.d.ts.map +1 -0
- package/dist/tools/projects/hierarchy.js +300 -0
- package/dist/tools/projects/hierarchy.js.map +1 -0
- package/dist/tools/projects/index.d.ts +34 -0
- package/dist/tools/projects/index.d.ts.map +1 -0
- package/dist/tools/projects/index.js +522 -0
- package/dist/tools/projects/index.js.map +1 -0
- package/dist/tools/projects/permission.d.ts +26 -0
- package/dist/tools/projects/permission.d.ts.map +1 -0
- package/dist/tools/projects/permission.js +53 -0
- package/dist/tools/projects/permission.js.map +1 -0
- package/dist/tools/projects/response-formatter.d.ts +54 -0
- package/dist/tools/projects/response-formatter.d.ts.map +1 -0
- package/dist/tools/projects/response-formatter.js +139 -0
- package/dist/tools/projects/response-formatter.js.map +1 -0
- package/dist/tools/projects/sharing-access.d.ts +165 -0
- package/dist/tools/projects/sharing-access.d.ts.map +1 -0
- package/dist/tools/projects/sharing-access.js +450 -0
- package/dist/tools/projects/sharing-access.js.map +1 -0
- package/dist/tools/projects/sharing.d.ts +105 -0
- package/dist/tools/projects/sharing.d.ts.map +1 -0
- package/dist/tools/projects/sharing.js +258 -0
- package/dist/tools/projects/sharing.js.map +1 -0
- package/dist/tools/projects/validation.d.ts +51 -0
- package/dist/tools/projects/validation.d.ts.map +1 -0
- package/dist/tools/projects/validation.js +160 -0
- package/dist/tools/projects/validation.js.map +1 -0
- package/dist/tools/projects/views.d.ts +161 -0
- package/dist/tools/projects/views.d.ts.map +1 -0
- package/dist/tools/projects/views.js +234 -0
- package/dist/tools/projects/views.js.map +1 -0
- package/dist/tools/projects.d.ts +20 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +66 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/reactions.d.ts +25 -0
- package/dist/tools/reactions.d.ts.map +1 -0
- package/dist/tools/reactions.js +108 -0
- package/dist/tools/reactions.js.map +1 -0
- package/dist/tools/subscriptions.d.ts +23 -0
- package/dist/tools/subscriptions.d.ts.map +1 -0
- package/dist/tools/subscriptions.js +111 -0
- package/dist/tools/subscriptions.js.map +1 -0
- package/dist/tools/task-assignees.d.ts +13 -0
- package/dist/tools/task-assignees.d.ts.map +1 -0
- package/dist/tools/task-assignees.js +74 -0
- package/dist/tools/task-assignees.js.map +1 -0
- package/dist/tools/task-bulk.d.ts +13 -0
- package/dist/tools/task-bulk.d.ts.map +1 -0
- package/dist/tools/task-bulk.js +117 -0
- package/dist/tools/task-bulk.js.map +1 -0
- package/dist/tools/task-comments.d.ts +12 -0
- package/dist/tools/task-comments.d.ts.map +1 -0
- package/dist/tools/task-comments.js +65 -0
- package/dist/tools/task-comments.js.map +1 -0
- package/dist/tools/task-crud.d.ts +13 -0
- package/dist/tools/task-crud.d.ts.map +1 -0
- package/dist/tools/task-crud.js +168 -0
- package/dist/tools/task-crud.js.map +1 -0
- package/dist/tools/task-labels.d.ts +13 -0
- package/dist/tools/task-labels.d.ts.map +1 -0
- package/dist/tools/task-labels.js +64 -0
- package/dist/tools/task-labels.js.map +1 -0
- package/dist/tools/task-relations.d.ts +13 -0
- package/dist/tools/task-relations.d.ts.map +1 -0
- package/dist/tools/task-relations.js +74 -0
- package/dist/tools/task-relations.js.map +1 -0
- package/dist/tools/task-reminders.d.ts +13 -0
- package/dist/tools/task-reminders.d.ts.map +1 -0
- package/dist/tools/task-reminders.js +69 -0
- package/dist/tools/task-reminders.js.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeOperationsService.d.ts +63 -0
- package/dist/tools/tasks/assignees/AssigneeOperationsService.d.ts.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeOperationsService.js +152 -0
- package/dist/tools/tasks/assignees/AssigneeOperationsService.js.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeResponseFormatter.d.ts +28 -0
- package/dist/tools/tasks/assignees/AssigneeResponseFormatter.d.ts.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeResponseFormatter.js +73 -0
- package/dist/tools/tasks/assignees/AssigneeResponseFormatter.js.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeValidationService.d.ts +46 -0
- package/dist/tools/tasks/assignees/AssigneeValidationService.d.ts.map +1 -0
- package/dist/tools/tasks/assignees/AssigneeValidationService.js +70 -0
- package/dist/tools/tasks/assignees/AssigneeValidationService.js.map +1 -0
- package/dist/tools/tasks/assignees/index.d.ts +52 -0
- package/dist/tools/tasks/assignees/index.d.ts.map +1 -0
- package/dist/tools/tasks/assignees/index.js +103 -0
- package/dist/tools/tasks/assignees/index.js.map +1 -0
- package/dist/tools/tasks/attach.d.ts +39 -0
- package/dist/tools/tasks/attach.d.ts.map +1 -0
- package/dist/tools/tasks/attach.js +90 -0
- package/dist/tools/tasks/attach.js.map +1 -0
- package/dist/tools/tasks/attachments.d.ts +67 -0
- package/dist/tools/tasks/attachments.d.ts.map +1 -0
- package/dist/tools/tasks/attachments.js +153 -0
- package/dist/tools/tasks/attachments.js.map +1 -0
- package/dist/tools/tasks/buckets.d.ts +41 -0
- package/dist/tools/tasks/buckets.d.ts.map +1 -0
- package/dist/tools/tasks/buckets.js +75 -0
- package/dist/tools/tasks/buckets.js.map +1 -0
- package/dist/tools/tasks/bulk/BatchProcessorFactory.d.ts +30 -0
- package/dist/tools/tasks/bulk/BatchProcessorFactory.d.ts.map +1 -0
- package/dist/tools/tasks/bulk/BatchProcessorFactory.js +69 -0
- package/dist/tools/tasks/bulk/BatchProcessorFactory.js.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationErrorHandler.d.ts +50 -0
- package/dist/tools/tasks/bulk/BulkOperationErrorHandler.d.ts.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationErrorHandler.js +183 -0
- package/dist/tools/tasks/bulk/BulkOperationErrorHandler.js.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationProcessor.d.ts +101 -0
- package/dist/tools/tasks/bulk/BulkOperationProcessor.d.ts.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationProcessor.js +416 -0
- package/dist/tools/tasks/bulk/BulkOperationProcessor.js.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationTypes.d.ts +50 -0
- package/dist/tools/tasks/bulk/BulkOperationTypes.d.ts.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationTypes.js +6 -0
- package/dist/tools/tasks/bulk/BulkOperationTypes.js.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationValidator.d.ts +53 -0
- package/dist/tools/tasks/bulk/BulkOperationValidator.d.ts.map +1 -0
- package/dist/tools/tasks/bulk/BulkOperationValidator.js +216 -0
- package/dist/tools/tasks/bulk/BulkOperationValidator.js.map +1 -0
- package/dist/tools/tasks/bulk/index.d.ts +9 -0
- package/dist/tools/tasks/bulk/index.d.ts.map +1 -0
- package/dist/tools/tasks/bulk/index.js +15 -0
- package/dist/tools/tasks/bulk/index.js.map +1 -0
- package/dist/tools/tasks/bulk-operations-simplified.d.ts +62 -0
- package/dist/tools/tasks/bulk-operations-simplified.d.ts.map +1 -0
- package/dist/tools/tasks/bulk-operations-simplified.js +416 -0
- package/dist/tools/tasks/bulk-operations-simplified.js.map +1 -0
- package/dist/tools/tasks/bulk-operations.d.ts +8 -0
- package/dist/tools/tasks/bulk-operations.d.ts.map +1 -0
- package/dist/tools/tasks/bulk-operations.js +13 -0
- package/dist/tools/tasks/bulk-operations.js.map +1 -0
- package/dist/tools/tasks/by-index.d.ts +36 -0
- package/dist/tools/tasks/by-index.d.ts.map +1 -0
- package/dist/tools/tasks/by-index.js +52 -0
- package/dist/tools/tasks/by-index.js.map +1 -0
- package/dist/tools/tasks/comments/CommentOperationsService.d.ts +44 -0
- package/dist/tools/tasks/comments/CommentOperationsService.d.ts.map +1 -0
- package/dist/tools/tasks/comments/CommentOperationsService.js +86 -0
- package/dist/tools/tasks/comments/CommentOperationsService.js.map +1 -0
- package/dist/tools/tasks/comments/CommentResponseFormatter.d.ts +41 -0
- package/dist/tools/tasks/comments/CommentResponseFormatter.d.ts.map +1 -0
- package/dist/tools/tasks/comments/CommentResponseFormatter.js +114 -0
- package/dist/tools/tasks/comments/CommentResponseFormatter.js.map +1 -0
- package/dist/tools/tasks/comments/CommentValidationService.d.ts +62 -0
- package/dist/tools/tasks/comments/CommentValidationService.d.ts.map +1 -0
- package/dist/tools/tasks/comments/CommentValidationService.js +105 -0
- package/dist/tools/tasks/comments/CommentValidationService.js.map +1 -0
- package/dist/tools/tasks/comments/index.d.ts +66 -0
- package/dist/tools/tasks/comments/index.d.ts.map +1 -0
- package/dist/tools/tasks/comments/index.js +99 -0
- package/dist/tools/tasks/comments/index.js.map +1 -0
- package/dist/tools/tasks/constants.d.ts +19 -0
- package/dist/tools/tasks/constants.d.ts.map +1 -0
- package/dist/tools/tasks/constants.js +82 -0
- package/dist/tools/tasks/constants.js.map +1 -0
- package/dist/tools/tasks/crud/TaskCreationService.d.ts +29 -0
- package/dist/tools/tasks/crud/TaskCreationService.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskCreationService.js +274 -0
- package/dist/tools/tasks/crud/TaskCreationService.js.map +1 -0
- package/dist/tools/tasks/crud/TaskDeletionService.d.ts +19 -0
- package/dist/tools/tasks/crud/TaskDeletionService.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskDeletionService.js +96 -0
- package/dist/tools/tasks/crud/TaskDeletionService.js.map +1 -0
- package/dist/tools/tasks/crud/TaskReadService.d.ts +19 -0
- package/dist/tools/tasks/crud/TaskReadService.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskReadService.js +66 -0
- package/dist/tools/tasks/crud/TaskReadService.js.map +1 -0
- package/dist/tools/tasks/crud/TaskResponseFormatter.d.ts +18 -0
- package/dist/tools/tasks/crud/TaskResponseFormatter.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskResponseFormatter.js +248 -0
- package/dist/tools/tasks/crud/TaskResponseFormatter.js.map +1 -0
- package/dist/tools/tasks/crud/TaskUpdateService.d.ts +33 -0
- package/dist/tools/tasks/crud/TaskUpdateService.d.ts.map +1 -0
- package/dist/tools/tasks/crud/TaskUpdateService.js +294 -0
- package/dist/tools/tasks/crud/TaskUpdateService.js.map +1 -0
- package/dist/tools/tasks/crud/index.d.ts +17 -0
- package/dist/tools/tasks/crud/index.d.ts.map +1 -0
- package/dist/tools/tasks/crud/index.js +20 -0
- package/dist/tools/tasks/crud/index.js.map +1 -0
- package/dist/tools/tasks/duplicate.d.ts +28 -0
- package/dist/tools/tasks/duplicate.d.ts.map +1 -0
- package/dist/tools/tasks/duplicate.js +41 -0
- package/dist/tools/tasks/duplicate.js.map +1 -0
- package/dist/tools/tasks/filtering/FilterExecutor.d.ts +39 -0
- package/dist/tools/tasks/filtering/FilterExecutor.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/FilterExecutor.js +214 -0
- package/dist/tools/tasks/filtering/FilterExecutor.js.map +1 -0
- package/dist/tools/tasks/filtering/FilterValidator.d.ts +59 -0
- package/dist/tools/tasks/filtering/FilterValidator.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/FilterValidator.js +257 -0
- package/dist/tools/tasks/filtering/FilterValidator.js.map +1 -0
- package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.d.ts +78 -0
- package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.js +195 -0
- package/dist/tools/tasks/filtering/TaskFilteringOrchestrator.js.map +1 -0
- package/dist/tools/tasks/filtering/evaluators.d.ts +41 -0
- package/dist/tools/tasks/filtering/evaluators.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/evaluators.js +224 -0
- package/dist/tools/tasks/filtering/evaluators.js.map +1 -0
- package/dist/tools/tasks/filtering/index.d.ts +11 -0
- package/dist/tools/tasks/filtering/index.d.ts.map +1 -0
- package/dist/tools/tasks/filtering/index.js +26 -0
- package/dist/tools/tasks/filtering/index.js.map +1 -0
- package/dist/tools/tasks/index.d.ts +9 -0
- package/dist/tools/tasks/index.d.ts.map +1 -0
- package/dist/tools/tasks/index.js +337 -0
- package/dist/tools/tasks/index.js.map +1 -0
- package/dist/tools/tasks/labels.d.ts +49 -0
- package/dist/tools/tasks/labels.d.ts.map +1 -0
- package/dist/tools/tasks/labels.js +223 -0
- package/dist/tools/tasks/labels.js.map +1 -0
- package/dist/tools/tasks/mark-read.d.ts +27 -0
- package/dist/tools/tasks/mark-read.d.ts.map +1 -0
- package/dist/tools/tasks/mark-read.js +38 -0
- package/dist/tools/tasks/mark-read.js.map +1 -0
- package/dist/tools/tasks/position.d.ts +53 -0
- package/dist/tools/tasks/position.d.ts.map +1 -0
- package/dist/tools/tasks/position.js +83 -0
- package/dist/tools/tasks/position.js.map +1 -0
- package/dist/tools/tasks/reminders.d.ts +56 -0
- package/dist/tools/tasks/reminders.d.ts.map +1 -0
- package/dist/tools/tasks/reminders.js +213 -0
- package/dist/tools/tasks/reminders.js.map +1 -0
- package/dist/tools/tasks/subtasks.d.ts +85 -0
- package/dist/tools/tasks/subtasks.d.ts.map +1 -0
- package/dist/tools/tasks/subtasks.js +286 -0
- package/dist/tools/tasks/subtasks.js.map +1 -0
- package/dist/tools/tasks/types/filters.d.ts +136 -0
- package/dist/tools/tasks/types/filters.d.ts.map +1 -0
- package/dist/tools/tasks/types/filters.js +7 -0
- package/dist/tools/tasks/types/filters.js.map +1 -0
- package/dist/tools/tasks/validation.d.ts +47 -0
- package/dist/tools/tasks/validation.d.ts.map +1 -0
- package/dist/tools/tasks/validation.js +131 -0
- package/dist/tools/tasks/validation.js.map +1 -0
- package/dist/tools/tasks-relations.d.ts +25 -0
- package/dist/tools/tasks-relations.d.ts.map +1 -0
- package/dist/tools/tasks-relations.js +271 -0
- package/dist/tools/tasks-relations.js.map +1 -0
- package/dist/tools/tasks.d.ts +6 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +10 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/teams.d.ts +9 -0
- package/dist/tools/teams.d.ts.map +1 -0
- package/dist/tools/teams.js +255 -0
- package/dist/tools/teams.js.map +1 -0
- package/dist/tools/templates.d.ts +9 -0
- package/dist/tools/templates.d.ts.map +1 -0
- package/dist/tools/templates.js +450 -0
- package/dist/tools/templates.js.map +1 -0
- package/dist/tools/tokens.d.ts +37 -0
- package/dist/tools/tokens.d.ts.map +1 -0
- package/dist/tools/tokens.js +122 -0
- package/dist/tools/tokens.js.map +1 -0
- package/dist/tools/user-deletion.d.ts +41 -0
- package/dist/tools/user-deletion.d.ts.map +1 -0
- package/dist/tools/user-deletion.js +126 -0
- package/dist/tools/user-deletion.js.map +1 -0
- package/dist/tools/users.d.ts +9 -0
- package/dist/tools/users.d.ts.map +1 -0
- package/dist/tools/users.js +418 -0
- package/dist/tools/users.js.map +1 -0
- package/dist/tools/webhooks.d.ts +31 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +414 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/transforms/base.d.ts +204 -0
- package/dist/transforms/base.d.ts.map +1 -0
- package/dist/transforms/base.js +175 -0
- package/dist/transforms/base.js.map +1 -0
- package/dist/transforms/field-selector.d.ts +27 -0
- package/dist/transforms/field-selector.d.ts.map +1 -0
- package/dist/transforms/field-selector.js +91 -0
- package/dist/transforms/field-selector.js.map +1 -0
- package/dist/transforms/index.d.ts +15 -0
- package/dist/transforms/index.d.ts.map +1 -0
- package/dist/transforms/index.js +50 -0
- package/dist/transforms/index.js.map +1 -0
- package/dist/transforms/size-calculator.d.ts +131 -0
- package/dist/transforms/size-calculator.d.ts.map +1 -0
- package/dist/transforms/size-calculator.js +284 -0
- package/dist/transforms/size-calculator.js.map +1 -0
- package/dist/transforms/task.d.ts +207 -0
- package/dist/transforms/task.d.ts.map +1 -0
- package/dist/transforms/task.js +259 -0
- package/dist/transforms/task.js.map +1 -0
- package/dist/types/errors.d.ts +65 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +44 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/filters.d.ts +149 -0
- package/dist/types/filters.d.ts.map +1 -0
- package/dist/types/filters.js +26 -0
- package/dist/types/filters.js.map +1 -0
- package/dist/types/index.d.ts +147 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +24 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/node-vikunja-extended.d.ts +36 -0
- package/dist/types/node-vikunja-extended.d.ts.map +1 -0
- package/dist/types/node-vikunja-extended.js +25 -0
- package/dist/types/node-vikunja-extended.js.map +1 -0
- package/dist/types/responses.d.ts +121 -0
- package/dist/types/responses.d.ts.map +1 -0
- package/dist/types/responses.js +26 -0
- package/dist/types/responses.js.map +1 -0
- package/dist/types/vikunja.d.ts +319 -0
- package/dist/types/vikunja.d.ts.map +1 -0
- package/dist/types/vikunja.js +7 -0
- package/dist/types/vikunja.js.map +1 -0
- package/dist/utils/auth-error-handler.d.ts +23 -0
- package/dist/utils/auth-error-handler.d.ts.map +1 -0
- package/dist/utils/auth-error-handler.js +162 -0
- package/dist/utils/auth-error-handler.js.map +1 -0
- package/dist/utils/composite-operation.d.ts +184 -0
- package/dist/utils/composite-operation.d.ts.map +1 -0
- package/dist/utils/composite-operation.js +293 -0
- package/dist/utils/composite-operation.js.map +1 -0
- package/dist/utils/error-handler.d.ts +39 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +336 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/filtering/ClientSideFilteringStrategy.d.ts +13 -0
- package/dist/utils/filtering/ClientSideFilteringStrategy.d.ts.map +1 -0
- package/dist/utils/filtering/ClientSideFilteringStrategy.js +129 -0
- package/dist/utils/filtering/ClientSideFilteringStrategy.js.map +1 -0
- package/dist/utils/filtering/FilteringContext.d.ts +40 -0
- package/dist/utils/filtering/FilteringContext.d.ts.map +1 -0
- package/dist/utils/filtering/FilteringContext.js +58 -0
- package/dist/utils/filtering/FilteringContext.js.map +1 -0
- package/dist/utils/filtering/HybridFilteringStrategy.d.ts +15 -0
- package/dist/utils/filtering/HybridFilteringStrategy.d.ts.map +1 -0
- package/dist/utils/filtering/HybridFilteringStrategy.js +55 -0
- package/dist/utils/filtering/HybridFilteringStrategy.js.map +1 -0
- package/dist/utils/filtering/RestCrossProjectFilteringStrategy.d.ts +42 -0
- package/dist/utils/filtering/RestCrossProjectFilteringStrategy.d.ts.map +1 -0
- package/dist/utils/filtering/RestCrossProjectFilteringStrategy.js +120 -0
- package/dist/utils/filtering/RestCrossProjectFilteringStrategy.js.map +1 -0
- package/dist/utils/filtering/ServerSideFilteringStrategy.d.ts +13 -0
- package/dist/utils/filtering/ServerSideFilteringStrategy.d.ts.map +1 -0
- package/dist/utils/filtering/ServerSideFilteringStrategy.js +88 -0
- package/dist/utils/filtering/ServerSideFilteringStrategy.js.map +1 -0
- package/dist/utils/filtering/TaskFilteringStrategy.d.ts +19 -0
- package/dist/utils/filtering/TaskFilteringStrategy.d.ts.map +1 -0
- package/dist/utils/filtering/TaskFilteringStrategy.js +10 -0
- package/dist/utils/filtering/TaskFilteringStrategy.js.map +1 -0
- package/dist/utils/filtering/index.d.ts +14 -0
- package/dist/utils/filtering/index.d.ts.map +1 -0
- package/dist/utils/filtering/index.js +22 -0
- package/dist/utils/filtering/index.js.map +1 -0
- package/dist/utils/filtering/types.d.ts +108 -0
- package/dist/utils/filtering/types.d.ts.map +1 -0
- package/dist/utils/filtering/types.js +6 -0
- package/dist/utils/filtering/types.js.map +1 -0
- package/dist/utils/filters.d.ts +70 -0
- package/dist/utils/filters.d.ts.map +1 -0
- package/dist/utils/filters.js +812 -0
- package/dist/utils/filters.js.map +1 -0
- package/dist/utils/http-error-detail.d.ts +28 -0
- package/dist/utils/http-error-detail.d.ts.map +1 -0
- package/dist/utils/http-error-detail.js +67 -0
- package/dist/utils/http-error-detail.js.map +1 -0
- package/dist/utils/label-bulk.d.ts +21 -0
- package/dist/utils/label-bulk.d.ts.map +1 -0
- package/dist/utils/label-bulk.js +51 -0
- package/dist/utils/label-bulk.js.map +1 -0
- package/dist/utils/logger.d.ts +20 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +66 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/memory.d.ts +73 -0
- package/dist/utils/memory.d.ts.map +1 -0
- package/dist/utils/memory.js +194 -0
- package/dist/utils/memory.js.map +1 -0
- package/dist/utils/performance/batch-processor.d.ts +77 -0
- package/dist/utils/performance/batch-processor.d.ts.map +1 -0
- package/dist/utils/performance/batch-processor.js +218 -0
- package/dist/utils/performance/batch-processor.js.map +1 -0
- package/dist/utils/performance/index.d.ts +42 -0
- package/dist/utils/performance/index.d.ts.map +1 -0
- package/dist/utils/performance/index.js +49 -0
- package/dist/utils/performance/index.js.map +1 -0
- package/dist/utils/performance/performance-monitor.d.ts +116 -0
- package/dist/utils/performance/performance-monitor.d.ts.map +1 -0
- package/dist/utils/performance/performance-monitor.js +307 -0
- package/dist/utils/performance/performance-monitor.js.map +1 -0
- package/dist/utils/read-only.d.ts +111 -0
- package/dist/utils/read-only.d.ts.map +1 -0
- package/dist/utils/read-only.js +503 -0
- package/dist/utils/read-only.js.map +1 -0
- package/dist/utils/response-factory.d.ts +81 -0
- package/dist/utils/response-factory.d.ts.map +1 -0
- package/dist/utils/response-factory.js +86 -0
- package/dist/utils/response-factory.js.map +1 -0
- package/dist/utils/retry.d.ts +160 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +316 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/security.d.ts +70 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +358 -0
- package/dist/utils/security.js.map +1 -0
- package/dist/utils/simple-response.d.ts +75 -0
- package/dist/utils/simple-response.d.ts.map +1 -0
- package/dist/utils/simple-response.js +311 -0
- package/dist/utils/simple-response.js.map +1 -0
- package/dist/utils/storage-errors.d.ts +9 -0
- package/dist/utils/storage-errors.d.ts.map +1 -0
- package/dist/utils/storage-errors.js +20 -0
- package/dist/utils/storage-errors.js.map +1 -0
- package/dist/utils/task-rest-transport.d.ts +28 -0
- package/dist/utils/task-rest-transport.d.ts.map +1 -0
- package/dist/utils/task-rest-transport.js +33 -0
- package/dist/utils/task-rest-transport.js.map +1 -0
- package/dist/utils/unicode-fix.d.ts +19 -0
- package/dist/utils/unicode-fix.d.ts.map +1 -0
- package/dist/utils/unicode-fix.js +70 -0
- package/dist/utils/unicode-fix.js.map +1 -0
- package/dist/utils/validation.d.ts +75 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +758 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/utils/vikunja-rest.d.ts +159 -0
- package/dist/utils/vikunja-rest.d.ts.map +1 -0
- package/dist/utils/vikunja-rest.js +378 -0
- package/dist/utils/vikunja-rest.js.map +1 -0
- package/docs/CONFIGURATION.md +957 -0
- package/docs/DOCKER-DESKTOP-MCP.md +207 -0
- package/docs/TOOLS.md +422 -0
- package/package.json +145 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Templates Tool
|
|
4
|
+
* Handles project template operations for Vikunja
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.registerTemplatesTool = registerTemplatesTool;
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const types_1 = require("../types");
|
|
10
|
+
const storage_1 = require("../storage");
|
|
11
|
+
// Imported directly from the module (not the `../storage` barrel) so that
|
|
12
|
+
// tests mocking `../../src/storage` wholesale (to stub `storageManager`)
|
|
13
|
+
// don't also need to stub these — they're a separate, self-contained
|
|
14
|
+
// concern (see templateFileStore.ts's header).
|
|
15
|
+
const templateFileStore_1 = require("../storage/templateFileStore");
|
|
16
|
+
const config_1 = require("../config");
|
|
17
|
+
const logger_1 = require("../utils/logger");
|
|
18
|
+
const label_bulk_1 = require("../utils/label-bulk");
|
|
19
|
+
const response_factory_1 = require("../utils/response-factory");
|
|
20
|
+
const vikunja_rest_1 = require("../utils/vikunja-rest");
|
|
21
|
+
const read_only_1 = require("../utils/read-only");
|
|
22
|
+
/**
|
|
23
|
+
* Get session-scoped storage instance, hydrated from the templates
|
|
24
|
+
* persistence file (if configured) on first touch for that session.
|
|
25
|
+
*/
|
|
26
|
+
async function getSessionStorage(authManager) {
|
|
27
|
+
const session = authManager.getSession();
|
|
28
|
+
const sessionId = session.apiToken ? `${session.apiUrl}:${session.apiToken.substring(0, 8)}` : 'anonymous';
|
|
29
|
+
const storage = await storage_1.storageManager.getStorage(sessionId, session.userId, session.apiUrl);
|
|
30
|
+
const persistPath = getTemplatesPersistPath();
|
|
31
|
+
if (persistPath) {
|
|
32
|
+
await hydrateTemplatesFromDiskIfNeeded(storage, persistPath);
|
|
33
|
+
}
|
|
34
|
+
return storage;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the effective templates persistence path (env var wins over
|
|
38
|
+
* config — see docs/CONFIGURATION.md). Returns `undefined` when persistence
|
|
39
|
+
* isn't configured, in which case templates stay in-memory-only, exactly as
|
|
40
|
+
* before this file-backed persistence support was added.
|
|
41
|
+
*/
|
|
42
|
+
function getTemplatesPersistPath() {
|
|
43
|
+
const configuredPath = config_1.ConfigurationManager.getInstance().loadConfiguration().templates.persistPath;
|
|
44
|
+
return (0, templateFileStore_1.resolveTemplatesPersistPath)(configuredPath);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Templates already hydrated from disk in this process, keyed by
|
|
48
|
+
* `${persistPath}:${sessionId}` — hydration happens once per session per
|
|
49
|
+
* configured path, not on every call, so repeated tool invocations don't
|
|
50
|
+
* re-read the file or attempt to re-create already-loaded templates.
|
|
51
|
+
*/
|
|
52
|
+
const hydratedPersistenceKeys = new Set();
|
|
53
|
+
async function hydrateTemplatesFromDiskIfNeeded(storage, persistPath) {
|
|
54
|
+
const sessionId = storage.getSession().id;
|
|
55
|
+
const key = `${persistPath}:${sessionId}`;
|
|
56
|
+
if (hydratedPersistenceKeys.has(key)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
hydratedPersistenceKeys.add(key);
|
|
60
|
+
const records = (0, templateFileStore_1.loadTemplatesFile)(persistPath);
|
|
61
|
+
for (const record of records) {
|
|
62
|
+
try {
|
|
63
|
+
const existing = await storage.findByName(record.name);
|
|
64
|
+
if (!existing) {
|
|
65
|
+
await storage.create({ name: record.name, filter: record.data, isGlobal: true });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
logger_1.logger.warn('Failed to hydrate a template from the persistence file, skipping it', {
|
|
70
|
+
persistPath,
|
|
71
|
+
templateId: record.id,
|
|
72
|
+
error: error instanceof Error ? error.message : String(error),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Write-through: persist the full current template set for this session to
|
|
79
|
+
* disk, atomically, when persistence is configured. A write failure is
|
|
80
|
+
* logged but never surfaced as a tool error — the in-memory mutation the
|
|
81
|
+
* caller just made already succeeded, and durability is a best-effort
|
|
82
|
+
* bonus, not a correctness requirement (per the "in memory by default"
|
|
83
|
+
* contract templates.ts documents).
|
|
84
|
+
*/
|
|
85
|
+
async function persistTemplatesIfConfigured(storage) {
|
|
86
|
+
const persistPath = getTemplatesPersistPath();
|
|
87
|
+
if (!persistPath) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const all = await storage.list();
|
|
92
|
+
const records = all
|
|
93
|
+
.filter((filter) => filter.name.startsWith('template_'))
|
|
94
|
+
.map((filter) => ({ id: filter.name, name: filter.name, data: filter.filter }));
|
|
95
|
+
(0, templateFileStore_1.writeTemplatesFileAtomic)(persistPath, records);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
logger_1.logger.error('Failed to persist templates to disk', {
|
|
99
|
+
persistPath,
|
|
100
|
+
error: error instanceof Error ? error.message : String(error),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function registerTemplatesTool(server, authManager, _clientFactory) {
|
|
105
|
+
server.tool('vikunja_templates', (0, read_only_1.withReadOnlyNote)('vikunja_templates', 'Manage task templates for creating consistent tasks and project structures. ' +
|
|
106
|
+
'IMPORTANT: templates are never persisted to Vikunja itself. By default they ' +
|
|
107
|
+
"are session-only — kept in this server process's memory and lost on restart. " +
|
|
108
|
+
'Set the templates.persistPath config key (or VIKUNJA_MCP_TEMPLATES_FILE env ' +
|
|
109
|
+
'var, which wins) to make them durable across restarts via a JSON file on disk ' +
|
|
110
|
+
'— see docs/CONFIGURATION.md.'), {
|
|
111
|
+
subcommand: zod_1.z.enum(['create', 'list', 'get', 'update', 'delete', 'instantiate']),
|
|
112
|
+
// Template fields
|
|
113
|
+
id: zod_1.z.string().optional(),
|
|
114
|
+
projectId: zod_1.z.number().optional(),
|
|
115
|
+
name: zod_1.z.string().optional(),
|
|
116
|
+
description: zod_1.z.string().optional(),
|
|
117
|
+
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
118
|
+
// Instantiation fields
|
|
119
|
+
projectName: zod_1.z.string().optional(),
|
|
120
|
+
parentProjectId: zod_1.z.number().optional(),
|
|
121
|
+
variables: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
122
|
+
}, (0, read_only_1.getToolAnnotations)('vikunja_templates'), async (args) => {
|
|
123
|
+
try {
|
|
124
|
+
// Check authentication
|
|
125
|
+
if (!authManager.isAuthenticated()) {
|
|
126
|
+
throw new types_1.MCPError(types_1.ErrorCode.AUTH_REQUIRED, 'Authentication required. Please use vikunja_auth.connect first.');
|
|
127
|
+
}
|
|
128
|
+
(0, read_only_1.assertWriteAllowed)('vikunja_templates', args.subcommand);
|
|
129
|
+
const storage = await getSessionStorage(authManager);
|
|
130
|
+
switch (args.subcommand) {
|
|
131
|
+
case 'create': {
|
|
132
|
+
if (!args.projectId || !args.name) {
|
|
133
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'projectId and name are required for creating a template');
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
// Get the source project
|
|
137
|
+
const project = await (0, vikunja_rest_1.vikunjaRestRequest)(authManager, 'GET', `/projects/${args.projectId}`);
|
|
138
|
+
// Get all tasks in the project. NOTE: `GET /projects/{id}/tasks` is
|
|
139
|
+
// not present in the vendored OpenAPI spec (only `PUT` is documented
|
|
140
|
+
// there) — this mirrors the legacy client's own `getProjectTasks`, which
|
|
141
|
+
// calls this same undocumented-but-functional path. Preserved as-is
|
|
142
|
+
// per this migration's "transport only, same behavior" scope; see
|
|
143
|
+
// docs/API-COVERAGE.md's note on `GET /projects/{id}/tasks` for the
|
|
144
|
+
// broader spec-drift context.
|
|
145
|
+
const tasks = await (0, vikunja_rest_1.vikunjaRestRequest)(authManager, 'GET', `/projects/${args.projectId}/tasks`);
|
|
146
|
+
// Validate hex color if present
|
|
147
|
+
if (project.hex_color && !/^#[0-9A-Fa-f]{6}$/.test(project.hex_color)) {
|
|
148
|
+
logger_1.logger.warn('Invalid hex color in source project, skipping', {
|
|
149
|
+
projectId: args.projectId,
|
|
150
|
+
color: project.hex_color,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
// Create template data
|
|
154
|
+
const templateId = `template_${Date.now()}`;
|
|
155
|
+
const templateData = {
|
|
156
|
+
id: templateId,
|
|
157
|
+
name: args.name,
|
|
158
|
+
...(args.description && { description: args.description }),
|
|
159
|
+
created: new Date().toISOString(),
|
|
160
|
+
tags: args.tags || [],
|
|
161
|
+
projectData: {
|
|
162
|
+
title: project.title ?? '',
|
|
163
|
+
...(project.description && { description: project.description }),
|
|
164
|
+
...(project.hex_color &&
|
|
165
|
+
/^#[0-9A-Fa-f]{6}$/.test(project.hex_color) && {
|
|
166
|
+
hex_color: project.hex_color,
|
|
167
|
+
}),
|
|
168
|
+
},
|
|
169
|
+
tasks: tasks.map((task) => ({
|
|
170
|
+
title: task.title ?? '',
|
|
171
|
+
...(task.description && { description: task.description }),
|
|
172
|
+
...(task.labels &&
|
|
173
|
+
task.labels.length > 0 && {
|
|
174
|
+
labels: task.labels
|
|
175
|
+
.map((l) => l.id)
|
|
176
|
+
.filter((id) => id !== undefined),
|
|
177
|
+
}),
|
|
178
|
+
...(task.due_date && { due_date: task.due_date }),
|
|
179
|
+
...(task.priority !== undefined && { priority: task.priority }),
|
|
180
|
+
...(task.position !== undefined && { position: task.position }),
|
|
181
|
+
})),
|
|
182
|
+
variables: {},
|
|
183
|
+
};
|
|
184
|
+
// Save template as a saved filter
|
|
185
|
+
await storage.create({
|
|
186
|
+
name: templateId,
|
|
187
|
+
filter: JSON.stringify(templateData),
|
|
188
|
+
isGlobal: true,
|
|
189
|
+
});
|
|
190
|
+
await persistTemplatesIfConfigured(storage);
|
|
191
|
+
const response = (0, types_1.createStandardResponse)('create-template', `Template "${args.name}" created successfully`, { template: templateData }, { sourceProjectId: args.projectId, taskCount: tasks.length });
|
|
192
|
+
return {
|
|
193
|
+
content: [
|
|
194
|
+
{
|
|
195
|
+
type: 'text',
|
|
196
|
+
text: (0, response_factory_1.formatAorpAsMarkdown)(response),
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `Failed to create template: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
case 'list': {
|
|
206
|
+
try {
|
|
207
|
+
const savedFilters = await storage.list();
|
|
208
|
+
// Convert saved filters back to templates
|
|
209
|
+
const templates = savedFilters
|
|
210
|
+
.filter((f) => f.name.startsWith('template_'))
|
|
211
|
+
.map((f) => {
|
|
212
|
+
try {
|
|
213
|
+
return JSON.parse(f.filter);
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
.filter((t) => t !== null);
|
|
220
|
+
const response = (0, types_1.createStandardResponse)('list-templates', `Retrieved ${templates.length} template${templates.length !== 1 ? 's' : ''}`, { templates }, { count: templates.length });
|
|
221
|
+
return {
|
|
222
|
+
content: [
|
|
223
|
+
{
|
|
224
|
+
type: 'text',
|
|
225
|
+
text: (0, response_factory_1.formatAorpAsMarkdown)(response),
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `Failed to list templates: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
case 'get': {
|
|
235
|
+
if (!args.id) {
|
|
236
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'Template ID is required');
|
|
237
|
+
}
|
|
238
|
+
try {
|
|
239
|
+
const savedFilter = await storage.findByName(args.id);
|
|
240
|
+
if (!savedFilter) {
|
|
241
|
+
throw new types_1.MCPError(types_1.ErrorCode.NOT_FOUND, `Template with ID ${args.id} not found`);
|
|
242
|
+
}
|
|
243
|
+
const template = JSON.parse(savedFilter.filter);
|
|
244
|
+
const response = (0, types_1.createStandardResponse)('get-template', `Retrieved template "${template.name}"`, { template });
|
|
245
|
+
return {
|
|
246
|
+
content: [
|
|
247
|
+
{
|
|
248
|
+
type: 'text',
|
|
249
|
+
text: (0, response_factory_1.formatAorpAsMarkdown)(response),
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
if (error instanceof types_1.MCPError)
|
|
256
|
+
throw error;
|
|
257
|
+
throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `Failed to get template: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
case 'update': {
|
|
261
|
+
if (!args.id) {
|
|
262
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'Template ID is required');
|
|
263
|
+
}
|
|
264
|
+
try {
|
|
265
|
+
const savedFilter = await storage.findByName(args.id);
|
|
266
|
+
if (!savedFilter) {
|
|
267
|
+
throw new types_1.MCPError(types_1.ErrorCode.NOT_FOUND, `Template with ID ${args.id} not found`);
|
|
268
|
+
}
|
|
269
|
+
const template = JSON.parse(savedFilter.filter);
|
|
270
|
+
// Update template fields
|
|
271
|
+
if (args.name !== undefined)
|
|
272
|
+
template.name = args.name;
|
|
273
|
+
if (args.description !== undefined)
|
|
274
|
+
template.description = args.description;
|
|
275
|
+
if (args.tags !== undefined)
|
|
276
|
+
template.tags = args.tags;
|
|
277
|
+
// Update the saved filter by finding it first
|
|
278
|
+
const existingFilter = await storage.findByName(args.id);
|
|
279
|
+
if (existingFilter) {
|
|
280
|
+
await storage.update(existingFilter.id, {
|
|
281
|
+
filter: JSON.stringify(template),
|
|
282
|
+
});
|
|
283
|
+
await persistTemplatesIfConfigured(storage);
|
|
284
|
+
}
|
|
285
|
+
const response = (0, types_1.createStandardResponse)('update-template', `Template "${template.name}" updated successfully`, { template });
|
|
286
|
+
return {
|
|
287
|
+
content: [
|
|
288
|
+
{
|
|
289
|
+
type: 'text',
|
|
290
|
+
text: (0, response_factory_1.formatAorpAsMarkdown)(response),
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
if (error instanceof types_1.MCPError)
|
|
297
|
+
throw error;
|
|
298
|
+
throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `Failed to update template: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
case 'delete': {
|
|
302
|
+
if (!args.id) {
|
|
303
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'Template ID is required');
|
|
304
|
+
}
|
|
305
|
+
try {
|
|
306
|
+
const savedFilter = await storage.findByName(args.id);
|
|
307
|
+
if (!savedFilter) {
|
|
308
|
+
throw new types_1.MCPError(types_1.ErrorCode.NOT_FOUND, `Template with ID ${args.id} not found`);
|
|
309
|
+
}
|
|
310
|
+
const template = JSON.parse(savedFilter.filter);
|
|
311
|
+
await storage.delete(savedFilter.id);
|
|
312
|
+
await persistTemplatesIfConfigured(storage);
|
|
313
|
+
const response = (0, types_1.createStandardResponse)('delete-template', `Template "${template.name}" deleted successfully`, { deletedId: args.id });
|
|
314
|
+
return {
|
|
315
|
+
content: [
|
|
316
|
+
{
|
|
317
|
+
type: 'text',
|
|
318
|
+
text: (0, response_factory_1.formatAorpAsMarkdown)(response),
|
|
319
|
+
},
|
|
320
|
+
],
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
if (error instanceof types_1.MCPError)
|
|
325
|
+
throw error;
|
|
326
|
+
throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `Failed to delete template: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
case 'instantiate': {
|
|
330
|
+
if (!args.id || !args.projectName) {
|
|
331
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'id and projectName are required for instantiating a template');
|
|
332
|
+
}
|
|
333
|
+
try {
|
|
334
|
+
const savedFilter = await storage.findByName(args.id);
|
|
335
|
+
if (!savedFilter) {
|
|
336
|
+
throw new types_1.MCPError(types_1.ErrorCode.NOT_FOUND, `Template with ID ${args.id} not found`);
|
|
337
|
+
}
|
|
338
|
+
const template = JSON.parse(savedFilter.filter);
|
|
339
|
+
// Create new project from template
|
|
340
|
+
const projectData = {
|
|
341
|
+
title: applyVariables(args.projectName, args.variables || {}),
|
|
342
|
+
...(template.projectData.description && {
|
|
343
|
+
description: applyVariables(template.projectData.description, args.variables || {}),
|
|
344
|
+
}),
|
|
345
|
+
...(args.parentProjectId && { parent_project_id: args.parentProjectId }),
|
|
346
|
+
};
|
|
347
|
+
if (template.projectData.hex_color) {
|
|
348
|
+
projectData.hex_color = template.projectData.hex_color;
|
|
349
|
+
}
|
|
350
|
+
const newProject = await (0, vikunja_rest_1.vikunjaRestRequest)(authManager, 'PUT', '/projects', projectData);
|
|
351
|
+
logger_1.logger.info('Created project from template', {
|
|
352
|
+
projectId: newProject.id,
|
|
353
|
+
templateId: args.id,
|
|
354
|
+
});
|
|
355
|
+
// Create tasks from template
|
|
356
|
+
const createdTasks = [];
|
|
357
|
+
for (const taskTemplate of template.tasks) {
|
|
358
|
+
try {
|
|
359
|
+
const taskData = {
|
|
360
|
+
title: applyVariables(taskTemplate.title, args.variables || {}),
|
|
361
|
+
project_id: newProject.id ?? 0,
|
|
362
|
+
...(taskTemplate.description && {
|
|
363
|
+
description: applyVariables(taskTemplate.description, args.variables || {}),
|
|
364
|
+
}),
|
|
365
|
+
...(taskTemplate.due_date && { due_date: taskTemplate.due_date }),
|
|
366
|
+
...(taskTemplate.priority !== undefined && { priority: taskTemplate.priority }),
|
|
367
|
+
...(taskTemplate.position !== undefined && { position: taskTemplate.position }),
|
|
368
|
+
};
|
|
369
|
+
const createdTask = await (0, vikunja_rest_1.vikunjaRestRequest)(authManager, 'PUT', `/projects/${newProject.id ?? 0}/tasks`, taskData);
|
|
370
|
+
createdTasks.push(createdTask);
|
|
371
|
+
// Add labels if any
|
|
372
|
+
if (taskTemplate.labels && taskTemplate.labels.length > 0) {
|
|
373
|
+
try {
|
|
374
|
+
await (0, label_bulk_1.setTaskLabels)(authManager, createdTask.id ?? 0, taskTemplate.labels);
|
|
375
|
+
}
|
|
376
|
+
catch (labelError) {
|
|
377
|
+
logger_1.logger.warn('Failed to add labels to task', {
|
|
378
|
+
taskId: createdTask.id,
|
|
379
|
+
labels: taskTemplate.labels,
|
|
380
|
+
error: labelError,
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
catch (taskError) {
|
|
386
|
+
logger_1.logger.warn('Failed to create task from template', {
|
|
387
|
+
taskTitle: taskTemplate.title,
|
|
388
|
+
error: taskError,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
const response = (0, types_1.createStandardResponse)('instantiate-template', `Project "${newProject.title}" created from template "${template.name}"`, {
|
|
393
|
+
project: newProject,
|
|
394
|
+
createdTasks: createdTasks.length,
|
|
395
|
+
failedTasks: template.tasks.length - createdTasks.length,
|
|
396
|
+
}, { templateId: args.id, templateName: template.name });
|
|
397
|
+
return {
|
|
398
|
+
content: [
|
|
399
|
+
{
|
|
400
|
+
type: 'text',
|
|
401
|
+
text: (0, response_factory_1.formatAorpAsMarkdown)(response),
|
|
402
|
+
},
|
|
403
|
+
],
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
if (error instanceof types_1.MCPError)
|
|
408
|
+
throw error;
|
|
409
|
+
throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `Failed to instantiate template: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
default:
|
|
413
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, `Unknown subcommand: ${String(args.subcommand)}`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
catch (error) {
|
|
417
|
+
if (error instanceof types_1.MCPError) {
|
|
418
|
+
throw error;
|
|
419
|
+
}
|
|
420
|
+
throw new types_1.MCPError(types_1.ErrorCode.INTERNAL_ERROR, `Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Escape special regex characters in a string
|
|
426
|
+
*/
|
|
427
|
+
function escapeRegex(str) {
|
|
428
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Apply variable substitution to a string
|
|
432
|
+
*/
|
|
433
|
+
function applyVariables(text, variables) {
|
|
434
|
+
if (!text)
|
|
435
|
+
return '';
|
|
436
|
+
let result = text;
|
|
437
|
+
// Apply custom variables
|
|
438
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
439
|
+
const escaped = escapeRegex(key);
|
|
440
|
+
const pattern = new RegExp(`{{${escaped}}}`, 'g');
|
|
441
|
+
result = result.replace(pattern, value);
|
|
442
|
+
}
|
|
443
|
+
// Apply built-in variables
|
|
444
|
+
const today = new Date().toISOString().split('T')[0] || '';
|
|
445
|
+
const now = new Date().toISOString();
|
|
446
|
+
result = result.replace(/{{TODAY}}/g, today);
|
|
447
|
+
result = result.replace(/{{NOW}}/g, now);
|
|
448
|
+
return result;
|
|
449
|
+
}
|
|
450
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/tools/templates.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAkJH,sDA+aC;AA9jBD,6BAAwB;AAGxB,oCAAuE;AACvE,wCAA4C;AAC5C,0EAA0E;AAC1E,yEAAyE;AACzE,qEAAqE;AACrE,+CAA+C;AAC/C,oEAIsC;AAEtC,sCAAiD;AACjD,4CAAyC;AACzC,oDAAoD;AACpD,gEAAiE;AACjE,wDAA2D;AAC3D,kDAA8F;AAO9F;;;GAGG;AACH,KAAK,UAAU,iBAAiB,CAAC,WAAwB;IACvD,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;IAC3G,MAAM,OAAO,GAAG,MAAM,wBAAc,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3F,MAAM,WAAW,GAAG,uBAAuB,EAAE,CAAC;IAC9C,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,gCAAgC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,SAAS,uBAAuB;IAC9B,MAAM,cAAc,GAAG,6BAAoB,CAAC,WAAW,EAAE,CAAC,iBAAiB,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC;IACpG,OAAO,IAAA,+CAA2B,EAAC,cAAc,CAAC,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,uBAAuB,GAAG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). Reserved behind the
|
|
6
|
+
* deny-by-default `tokenManagement` module config key (see
|
|
7
|
+
* src/config/types.ts DANGEROUS_MODULE_KEYS) because it is credential-
|
|
8
|
+
* adjacent: an operator must explicitly opt in before an AI assistant can
|
|
9
|
+
* create or delete API tokens for the connected account.
|
|
10
|
+
*
|
|
11
|
+
* Per docs/VIKUNJA_API_ISSUES.md #2, user-scoped endpoints have historically
|
|
12
|
+
* rejected `tk_*` API tokens (JWT-only), and `/tokens` shares the same
|
|
13
|
+
* security scheme as those endpoints in the spec. This tool is still
|
|
14
|
+
* registered for API-token sessions (the tokenManagement config key is the
|
|
15
|
+
* only registration-time gate — see docs/ENDPOINT-PLAYBOOK.md and the Wave D
|
|
16
|
+
* item this shipped in), but a call made with an API-token session may be
|
|
17
|
+
* rejected by the server; the 401/403 branch below surfaces that plainly
|
|
18
|
+
* rather than pretending it always works.
|
|
19
|
+
*/
|
|
20
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
21
|
+
import type { AuthManager } from '../auth/AuthManager';
|
|
22
|
+
import type { VikunjaClientFactory } from '../client/VikunjaClientFactory';
|
|
23
|
+
/**
|
|
24
|
+
* `models.APIToken` per the OpenAPI spec. `token` (the actual secret key) is
|
|
25
|
+
* only ever present in the `create` response — list responses omit it.
|
|
26
|
+
*/
|
|
27
|
+
export interface ApiToken {
|
|
28
|
+
id?: number;
|
|
29
|
+
title?: string;
|
|
30
|
+
token?: string;
|
|
31
|
+
permissions?: Record<string, string[]>;
|
|
32
|
+
expires_at?: string;
|
|
33
|
+
owner_id?: number;
|
|
34
|
+
created?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function registerTokensTool(server: McpServer, authManager: AuthManager, _clientFactory?: VikunjaClientFactory): void;
|
|
37
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/tools/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAQ3E;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,WAAW,EACxB,cAAc,CAAC,EAAE,oBAAoB,GACpC,IAAI,CA6JN"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API Token Management Tool
|
|
4
|
+
*
|
|
5
|
+
* Manages the current user's Vikunja API tokens (`GET/PUT /tokens`,
|
|
6
|
+
* `DELETE /tokens/{tokenID}` per the OpenAPI spec). Reserved behind the
|
|
7
|
+
* deny-by-default `tokenManagement` module config key (see
|
|
8
|
+
* src/config/types.ts DANGEROUS_MODULE_KEYS) because it is credential-
|
|
9
|
+
* adjacent: an operator must explicitly opt in before an AI assistant can
|
|
10
|
+
* create or delete API tokens for the connected account.
|
|
11
|
+
*
|
|
12
|
+
* Per docs/VIKUNJA_API_ISSUES.md #2, user-scoped endpoints have historically
|
|
13
|
+
* rejected `tk_*` API tokens (JWT-only), and `/tokens` shares the same
|
|
14
|
+
* security scheme as those endpoints in the spec. This tool is still
|
|
15
|
+
* registered for API-token sessions (the tokenManagement config key is the
|
|
16
|
+
* only registration-time gate — see docs/ENDPOINT-PLAYBOOK.md and the Wave D
|
|
17
|
+
* item this shipped in), but a call made with an API-token session may be
|
|
18
|
+
* rejected by the server; the 401/403 branch below surfaces that plainly
|
|
19
|
+
* rather than pretending it always works.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.registerTokensTool = registerTokensTool;
|
|
23
|
+
const zod_1 = require("zod");
|
|
24
|
+
const types_1 = require("../types");
|
|
25
|
+
const logger_1 = require("../utils/logger");
|
|
26
|
+
const validation_1 = require("../utils/validation");
|
|
27
|
+
const response_factory_1 = require("../utils/response-factory");
|
|
28
|
+
const vikunja_rest_1 = require("../utils/vikunja-rest");
|
|
29
|
+
const read_only_1 = require("../utils/read-only");
|
|
30
|
+
function registerTokensTool(server, authManager, _clientFactory) {
|
|
31
|
+
server.tool('vikunja_tokens', (0, read_only_1.withReadOnlyNote)('vikunja_tokens', "Manage the current user's Vikunja API tokens (list, create, delete). Reserved/deny-by-default: only registered when the 'tokenManagement' module config key is explicitly enabled, since it is credential-adjacent. A newly-created token's secret value is only ever returned once, in the 'create' response — it cannot be retrieved again afterwards."), {
|
|
32
|
+
subcommand: zod_1.z.enum(['list', 'create', 'delete']),
|
|
33
|
+
// list
|
|
34
|
+
page: zod_1.z.number().int().positive().optional(),
|
|
35
|
+
perPage: zod_1.z.number().int().positive().max(100).optional(),
|
|
36
|
+
search: zod_1.z.string().optional(),
|
|
37
|
+
// create
|
|
38
|
+
title: zod_1.z.string().min(1).optional(),
|
|
39
|
+
permissions: zod_1.z
|
|
40
|
+
.record(zod_1.z.array(zod_1.z.string()))
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('Map of resource group to allowed actions, e.g. {"tasks":["read_all","update"]}. Valid keys/values are documented via GET /routes on the Vikunja server.'),
|
|
43
|
+
expiresAt: zod_1.z.string().optional().describe('ISO 8601 date when the token should expire'),
|
|
44
|
+
ownerId: zod_1.z
|
|
45
|
+
.number()
|
|
46
|
+
.int()
|
|
47
|
+
.positive()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Bot user id to create this token for; omitted defaults to the authenticated user"),
|
|
50
|
+
// delete
|
|
51
|
+
tokenId: zod_1.z.number().int().positive().optional(),
|
|
52
|
+
}, (0, read_only_1.getToolAnnotations)('vikunja_tokens'), async (args) => {
|
|
53
|
+
if (!authManager.isAuthenticated()) {
|
|
54
|
+
throw new types_1.MCPError(types_1.ErrorCode.AUTH_REQUIRED, 'Authentication required. Please use vikunja_auth.connect first.');
|
|
55
|
+
}
|
|
56
|
+
const subcommand = args.subcommand;
|
|
57
|
+
(0, read_only_1.assertWriteAllowed)('vikunja_tokens', subcommand);
|
|
58
|
+
logger_1.logger.debug('Tokens tool called', { subcommand, args: { ...args, permissions: undefined } });
|
|
59
|
+
try {
|
|
60
|
+
switch (subcommand) {
|
|
61
|
+
case 'list': {
|
|
62
|
+
const query = new URLSearchParams();
|
|
63
|
+
if (args.page !== undefined)
|
|
64
|
+
query.set('page', String(args.page));
|
|
65
|
+
if (args.perPage !== undefined)
|
|
66
|
+
query.set('per_page', String(args.perPage));
|
|
67
|
+
if (args.search !== undefined)
|
|
68
|
+
query.set('s', args.search);
|
|
69
|
+
const qs = query.toString();
|
|
70
|
+
const tokens = (await (0, vikunja_rest_1.vikunjaRestRequest)(authManager, 'GET', `/tokens${qs ? `?${qs}` : ''}`)) ?? [];
|
|
71
|
+
logger_1.logger.info('Listed API tokens', { count: tokens.length });
|
|
72
|
+
const aorpResult = (0, response_factory_1.createAorpResponse)('list', `Retrieved ${tokens.length} API tokens`, { tokens }, { success: true, metadata: { count: tokens.length } });
|
|
73
|
+
return { content: [{ type: 'text', text: aorpResult.content }] };
|
|
74
|
+
}
|
|
75
|
+
case 'create': {
|
|
76
|
+
if (!args.title) {
|
|
77
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'title is required for creating an API token');
|
|
78
|
+
}
|
|
79
|
+
if (!args.permissions || Object.keys(args.permissions).length === 0) {
|
|
80
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, 'permissions is required for creating an API token (e.g. {"tasks":["read_all"]})');
|
|
81
|
+
}
|
|
82
|
+
const body = {
|
|
83
|
+
title: args.title,
|
|
84
|
+
permissions: args.permissions,
|
|
85
|
+
};
|
|
86
|
+
if (args.expiresAt !== undefined)
|
|
87
|
+
body.expires_at = args.expiresAt;
|
|
88
|
+
if (args.ownerId !== undefined)
|
|
89
|
+
body.owner_id = args.ownerId;
|
|
90
|
+
const token = await (0, vikunja_rest_1.vikunjaRestRequest)(authManager, 'PUT', '/tokens', body);
|
|
91
|
+
logger_1.logger.info('Created API token', { tokenId: token.id, title: token.title });
|
|
92
|
+
const aorpResult = (0, response_factory_1.createAorpResponse)('create', `API token '${token.title ?? args.title}' created successfully. Its secret value is shown only now and cannot be retrieved again — store it securely.`, { token }, { success: true, metadata: { count: 1 } });
|
|
93
|
+
return { content: [{ type: 'text', text: aorpResult.content }] };
|
|
94
|
+
}
|
|
95
|
+
case 'delete': {
|
|
96
|
+
const tokenId = (0, validation_1.validateAndConvertId)(args.tokenId, 'tokenId');
|
|
97
|
+
await (0, vikunja_rest_1.vikunjaRestRequest)(authManager, 'DELETE', `/tokens/${tokenId}`);
|
|
98
|
+
logger_1.logger.info('Deleted API token', { tokenId });
|
|
99
|
+
const aorpResult = (0, response_factory_1.createAorpResponse)('delete', `API token ${tokenId} deleted successfully`, { tokenId }, { success: true, metadata: { count: 1 } });
|
|
100
|
+
return { content: [{ type: 'text', text: aorpResult.content }] };
|
|
101
|
+
}
|
|
102
|
+
default:
|
|
103
|
+
throw new types_1.MCPError(types_1.ErrorCode.VALIDATION_ERROR, `Unknown subcommand: ${subcommand}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
logger_1.logger.error('Token operation failed', { error, subcommand });
|
|
108
|
+
if (error instanceof types_1.MCPError) {
|
|
109
|
+
const statusCode = error.details?.statusCode;
|
|
110
|
+
if (statusCode === 401 || statusCode === 403) {
|
|
111
|
+
throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, 'API token management was rejected by the server. Per docs/VIKUNJA_API_ISSUES.md, user-scoped endpoints have historically required JWT authentication (tk_* API tokens are rejected) — try reconnecting with a JWT via vikunja_auth.connect.');
|
|
112
|
+
}
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
if (error instanceof Error) {
|
|
116
|
+
throw new types_1.MCPError(types_1.ErrorCode.API_ERROR, `Token operation failed: ${error.message}`);
|
|
117
|
+
}
|
|
118
|
+
throw new types_1.MCPError(types_1.ErrorCode.INTERNAL_ERROR, 'An unexpected error occurred during token operation');
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=tokens.js.map
|