motionmcp 1.0.2 → 2.1.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.
Files changed (159) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +241 -450
  3. package/dist/handlers/CommentHandler.d.ts +9 -0
  4. package/dist/handlers/CommentHandler.d.ts.map +1 -0
  5. package/dist/handlers/CommentHandler.js +66 -0
  6. package/dist/handlers/CommentHandler.js.map +1 -0
  7. package/dist/handlers/CustomFieldHandler.d.ts +14 -0
  8. package/dist/handlers/CustomFieldHandler.d.ts.map +1 -0
  9. package/dist/handlers/CustomFieldHandler.js +95 -0
  10. package/dist/handlers/CustomFieldHandler.js.map +1 -0
  11. package/dist/handlers/HandlerFactory.d.ts +15 -0
  12. package/dist/handlers/HandlerFactory.d.ts.map +1 -0
  13. package/dist/handlers/HandlerFactory.js +58 -0
  14. package/dist/handlers/HandlerFactory.js.map +1 -0
  15. package/dist/handlers/ProjectHandler.d.ts +10 -0
  16. package/dist/handlers/ProjectHandler.d.ts.map +1 -0
  17. package/dist/handlers/ProjectHandler.js +63 -0
  18. package/dist/handlers/ProjectHandler.js.map +1 -0
  19. package/dist/handlers/RecurringTaskHandler.d.ts +10 -0
  20. package/dist/handlers/RecurringTaskHandler.d.ts.map +1 -0
  21. package/dist/handlers/RecurringTaskHandler.js +68 -0
  22. package/dist/handlers/RecurringTaskHandler.js.map +1 -0
  23. package/dist/handlers/ScheduleHandler.d.ts +8 -0
  24. package/dist/handlers/ScheduleHandler.d.ts.map +1 -0
  25. package/dist/handlers/ScheduleHandler.js +43 -0
  26. package/dist/handlers/ScheduleHandler.js.map +1 -0
  27. package/dist/handlers/SearchHandler.d.ts +10 -0
  28. package/dist/handlers/SearchHandler.d.ts.map +1 -0
  29. package/dist/handlers/SearchHandler.js +116 -0
  30. package/dist/handlers/SearchHandler.js.map +1 -0
  31. package/dist/handlers/StatusHandler.d.ts +8 -0
  32. package/dist/handlers/StatusHandler.d.ts.map +1 -0
  33. package/dist/handlers/StatusHandler.js +22 -0
  34. package/dist/handlers/StatusHandler.js.map +1 -0
  35. package/dist/handlers/TaskHandler.d.ts +22 -0
  36. package/dist/handlers/TaskHandler.d.ts.map +1 -0
  37. package/dist/handlers/TaskHandler.js +324 -0
  38. package/dist/handlers/TaskHandler.js.map +1 -0
  39. package/dist/handlers/UserHandler.d.ts +9 -0
  40. package/dist/handlers/UserHandler.d.ts.map +1 -0
  41. package/dist/handlers/UserHandler.js +36 -0
  42. package/dist/handlers/UserHandler.js.map +1 -0
  43. package/dist/handlers/WorkspaceHandler.d.ts +10 -0
  44. package/dist/handlers/WorkspaceHandler.d.ts.map +1 -0
  45. package/dist/handlers/WorkspaceHandler.js +49 -0
  46. package/dist/handlers/WorkspaceHandler.js.map +1 -0
  47. package/dist/handlers/base/BaseHandler.d.ts +16 -0
  48. package/dist/handlers/base/BaseHandler.d.ts.map +1 -0
  49. package/dist/handlers/base/BaseHandler.js +31 -0
  50. package/dist/handlers/base/BaseHandler.js.map +1 -0
  51. package/dist/handlers/base/HandlerInterface.d.ts +18 -0
  52. package/dist/handlers/base/HandlerInterface.d.ts.map +1 -0
  53. package/dist/handlers/base/HandlerInterface.js +3 -0
  54. package/dist/handlers/base/HandlerInterface.js.map +1 -0
  55. package/dist/handlers/index.d.ts +14 -0
  56. package/dist/handlers/index.d.ts.map +1 -0
  57. package/dist/handlers/index.js +31 -0
  58. package/dist/handlers/index.js.map +1 -0
  59. package/dist/mcp-server.d.ts +15 -0
  60. package/dist/mcp-server.d.ts.map +1 -0
  61. package/dist/mcp-server.js +145 -0
  62. package/dist/mcp-server.js.map +1 -0
  63. package/dist/schemas/motion.d.ts +4971 -0
  64. package/dist/schemas/motion.d.ts.map +1 -0
  65. package/dist/schemas/motion.js +328 -0
  66. package/dist/schemas/motion.js.map +1 -0
  67. package/dist/services/motionApi.d.ts +199 -0
  68. package/dist/services/motionApi.d.ts.map +1 -0
  69. package/dist/services/motionApi.js +1950 -0
  70. package/dist/services/motionApi.js.map +1 -0
  71. package/dist/tools/ToolConfigurator.d.ts +19 -0
  72. package/dist/tools/ToolConfigurator.d.ts.map +1 -0
  73. package/dist/tools/ToolConfigurator.js +89 -0
  74. package/dist/tools/ToolConfigurator.js.map +1 -0
  75. package/dist/tools/ToolDefinitions.d.ts +25 -0
  76. package/dist/tools/ToolDefinitions.d.ts.map +1 -0
  77. package/dist/tools/ToolDefinitions.js +508 -0
  78. package/dist/tools/ToolDefinitions.js.map +1 -0
  79. package/dist/tools/ToolRegistry.d.ts +16 -0
  80. package/dist/tools/ToolRegistry.d.ts.map +1 -0
  81. package/dist/tools/ToolRegistry.js +89 -0
  82. package/dist/tools/ToolRegistry.js.map +1 -0
  83. package/dist/tools/index.d.ts +4 -0
  84. package/dist/tools/index.d.ts.map +1 -0
  85. package/dist/tools/index.js +21 -0
  86. package/dist/tools/index.js.map +1 -0
  87. package/dist/types/mcp-tool-args.d.ts +123 -0
  88. package/dist/types/mcp-tool-args.d.ts.map +1 -0
  89. package/dist/types/mcp-tool-args.js +7 -0
  90. package/dist/types/mcp-tool-args.js.map +1 -0
  91. package/dist/types/mcp.d.ts +32 -0
  92. package/dist/types/mcp.d.ts.map +1 -0
  93. package/dist/types/mcp.js +3 -0
  94. package/dist/types/mcp.js.map +1 -0
  95. package/dist/types/motion.d.ts +304 -0
  96. package/dist/types/motion.d.ts.map +1 -0
  97. package/dist/types/motion.js +3 -0
  98. package/dist/types/motion.js.map +1 -0
  99. package/dist/utils/cache.d.ts +25 -0
  100. package/dist/utils/cache.d.ts.map +1 -0
  101. package/dist/utils/cache.js +135 -0
  102. package/dist/utils/cache.js.map +1 -0
  103. package/dist/utils/constants.d.ts +88 -0
  104. package/dist/utils/constants.d.ts.map +1 -0
  105. package/dist/utils/constants.js +188 -0
  106. package/dist/utils/constants.js.map +1 -0
  107. package/dist/utils/errorHandling.d.ts +50 -0
  108. package/dist/utils/errorHandling.d.ts.map +1 -0
  109. package/dist/utils/errorHandling.js +86 -0
  110. package/dist/utils/errorHandling.js.map +1 -0
  111. package/dist/utils/index.d.ts +13 -0
  112. package/dist/utils/index.d.ts.map +1 -0
  113. package/dist/utils/index.js +38 -0
  114. package/dist/utils/index.js.map +1 -0
  115. package/dist/utils/logger.d.ts +13 -0
  116. package/dist/utils/logger.d.ts.map +1 -0
  117. package/dist/utils/logger.js +47 -0
  118. package/dist/utils/logger.js.map +1 -0
  119. package/dist/utils/pagination.d.ts +61 -0
  120. package/dist/utils/pagination.d.ts.map +1 -0
  121. package/dist/utils/pagination.js +168 -0
  122. package/dist/utils/pagination.js.map +1 -0
  123. package/dist/utils/paginationNew.d.ts +44 -0
  124. package/dist/utils/paginationNew.d.ts.map +1 -0
  125. package/dist/utils/paginationNew.js +149 -0
  126. package/dist/utils/paginationNew.js.map +1 -0
  127. package/dist/utils/parameterUtils.d.ts +79 -0
  128. package/dist/utils/parameterUtils.d.ts.map +1 -0
  129. package/dist/utils/parameterUtils.js +189 -0
  130. package/dist/utils/parameterUtils.js.map +1 -0
  131. package/dist/utils/responseFormatters.d.ts +95 -0
  132. package/dist/utils/responseFormatters.d.ts.map +1 -0
  133. package/dist/utils/responseFormatters.js +342 -0
  134. package/dist/utils/responseFormatters.js.map +1 -0
  135. package/dist/utils/responseWrapper.d.ts +38 -0
  136. package/dist/utils/responseWrapper.d.ts.map +1 -0
  137. package/dist/utils/responseWrapper.js +201 -0
  138. package/dist/utils/responseWrapper.js.map +1 -0
  139. package/dist/utils/sanitize.d.ts +51 -0
  140. package/dist/utils/sanitize.d.ts.map +1 -0
  141. package/dist/utils/sanitize.js +138 -0
  142. package/dist/utils/sanitize.js.map +1 -0
  143. package/dist/utils/validator.d.ts +37 -0
  144. package/dist/utils/validator.d.ts.map +1 -0
  145. package/dist/utils/validator.js +74 -0
  146. package/dist/utils/validator.js.map +1 -0
  147. package/dist/utils/workspaceResolver.d.ts +40 -0
  148. package/dist/utils/workspaceResolver.d.ts.map +1 -0
  149. package/dist/utils/workspaceResolver.js +207 -0
  150. package/dist/utils/workspaceResolver.js.map +1 -0
  151. package/package.json +41 -17
  152. package/.claude/settings.local.json +0 -15
  153. package/.env.example +0 -3
  154. package/sample.png +0 -0
  155. package/src/index.js +0 -179
  156. package/src/mcp-server.js +0 -1137
  157. package/src/routes/motion.js +0 -152
  158. package/src/services/motionApi.js +0 -1177
  159. package/src/worker.js +0 -248
@@ -1,152 +0,0 @@
1
- const express = require('express');
2
- const MotionApiService = require('../services/motionApi');
3
-
4
- const router = express.Router();
5
- let motionService;
6
-
7
- try {
8
- motionService = new MotionApiService();
9
- } catch (error) {
10
- console.error('Failed to initialize Motion API service:', error.message);
11
- }
12
-
13
- const asyncHandler = (fn) => (req, res, next) => {
14
- Promise.resolve(fn(req, res, next)).catch(next);
15
- };
16
-
17
- const validateMotionService = (req, res, next) => {
18
- if (!motionService) {
19
- return res.status(503).json({
20
- error: 'Motion API service unavailable. Check MOTION_API_KEY configuration.'
21
- });
22
- }
23
- next();
24
- };
25
-
26
- router.get('/projects', validateMotionService, asyncHandler(async (req, res) => {
27
- const projects = await motionService.getProjects();
28
- res.json(projects);
29
- }));
30
-
31
- router.post('/projects', validateMotionService, asyncHandler(async (req, res) => {
32
- const { name, description, color, status } = req.body;
33
-
34
- if (!name) {
35
- return res.status(400).json({ error: 'Project name is required' });
36
- }
37
-
38
- const projectData = { name };
39
- if (description) projectData.description = description;
40
- if (color) projectData.color = color;
41
- if (status) projectData.status = status;
42
-
43
- const project = await motionService.createProject(projectData);
44
- res.status(201).json(project);
45
- }));
46
-
47
- router.get('/projects/:id', validateMotionService, asyncHandler(async (req, res) => {
48
- const project = await motionService.getProject(req.params.id);
49
- res.json(project);
50
- }));
51
-
52
- router.patch('/projects/:id', validateMotionService, asyncHandler(async (req, res) => {
53
- const { name, description, color, status } = req.body;
54
-
55
- const updateData = {};
56
- if (name) updateData.name = name;
57
- if (description !== undefined) updateData.description = description;
58
- if (color) updateData.color = color;
59
- if (status) updateData.status = status;
60
-
61
- if (Object.keys(updateData).length === 0) {
62
- return res.status(400).json({ error: 'No valid fields to update' });
63
- }
64
-
65
- const project = await motionService.updateProject(req.params.id, updateData);
66
- res.json(project);
67
- }));
68
-
69
- router.delete('/projects/:id', validateMotionService, asyncHandler(async (req, res) => {
70
- await motionService.deleteProject(req.params.id);
71
- res.status(204).send();
72
- }));
73
-
74
- router.get('/tasks', validateMotionService, asyncHandler(async (req, res) => {
75
- const options = {};
76
- if (req.query.projectId) options.projectId = req.query.projectId;
77
- if (req.query.status) options.status = req.query.status;
78
- if (req.query.assigneeId) options.assigneeId = req.query.assigneeId;
79
-
80
- const tasks = await motionService.getTasks(options);
81
- res.json(tasks);
82
- }));
83
-
84
- router.post('/tasks', validateMotionService, asyncHandler(async (req, res) => {
85
- const { name, description, status, priority, dueDate, projectId, assigneeId } = req.body;
86
-
87
- if (!name) {
88
- return res.status(400).json({ error: 'Task name is required' });
89
- }
90
-
91
- const taskData = { name };
92
- if (description) taskData.description = description;
93
- if (status) taskData.status = status;
94
- if (priority) taskData.priority = priority;
95
- if (dueDate) taskData.dueDate = dueDate;
96
- if (projectId) taskData.projectId = projectId;
97
- if (assigneeId) taskData.assigneeId = assigneeId;
98
-
99
- const task = await motionService.createTask(taskData);
100
- res.status(201).json(task);
101
- }));
102
-
103
- router.get('/tasks/:id', validateMotionService, asyncHandler(async (req, res) => {
104
- const task = await motionService.getTask(req.params.id);
105
- res.json(task);
106
- }));
107
-
108
- router.patch('/tasks/:id', validateMotionService, asyncHandler(async (req, res) => {
109
- const { name, description, status, priority, dueDate, projectId, assigneeId } = req.body;
110
-
111
- const updateData = {};
112
- if (name) updateData.name = name;
113
- if (description !== undefined) updateData.description = description;
114
- if (status) updateData.status = status;
115
- if (priority) updateData.priority = priority;
116
- if (dueDate !== undefined) updateData.dueDate = dueDate;
117
- if (projectId) updateData.projectId = projectId;
118
- if (assigneeId) updateData.assigneeId = assigneeId;
119
-
120
- if (Object.keys(updateData).length === 0) {
121
- return res.status(400).json({ error: 'No valid fields to update' });
122
- }
123
-
124
- const task = await motionService.updateTask(req.params.id, updateData);
125
- res.json(task);
126
- }));
127
-
128
- router.delete('/tasks/:id', validateMotionService, asyncHandler(async (req, res) => {
129
- await motionService.deleteTask(req.params.id);
130
- res.status(204).send();
131
- }));
132
-
133
- router.get('/workspaces', validateMotionService, asyncHandler(async (req, res) => {
134
- const workspaces = await motionService.getWorkspaces();
135
- res.json(workspaces);
136
- }));
137
-
138
- router.get('/users', validateMotionService, asyncHandler(async (req, res) => {
139
- const users = await motionService.getUsers();
140
- res.json(users);
141
- }));
142
-
143
- router.use((error, req, res, next) => {
144
- if (error.message.includes('Failed to')) {
145
- const statusCode = error.message.includes('not found') ? 404 : 400;
146
- return res.status(statusCode).json({ error: error.message });
147
- }
148
-
149
- res.status(500).json({ error: 'Internal server error' });
150
- });
151
-
152
- module.exports = router;