motionmcp 1.0.2 → 2.0.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 +242 -446
  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 +266 -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-old.d.ts +29 -0
  60. package/dist/mcp-server-old.d.ts.map +1 -0
  61. package/dist/mcp-server-old.js +1304 -0
  62. package/dist/mcp-server-old.js.map +1 -0
  63. package/dist/mcp-server.d.ts +15 -0
  64. package/dist/mcp-server.d.ts.map +1 -0
  65. package/dist/mcp-server.js +145 -0
  66. package/dist/mcp-server.js.map +1 -0
  67. package/dist/schemas/motion.d.ts +4971 -0
  68. package/dist/schemas/motion.d.ts.map +1 -0
  69. package/dist/schemas/motion.js +328 -0
  70. package/dist/schemas/motion.js.map +1 -0
  71. package/dist/services/motionApi.d.ts +186 -0
  72. package/dist/services/motionApi.d.ts.map +1 -0
  73. package/dist/services/motionApi.js +1912 -0
  74. package/dist/services/motionApi.js.map +1 -0
  75. package/dist/tools/ToolConfigurator.d.ts +19 -0
  76. package/dist/tools/ToolConfigurator.d.ts.map +1 -0
  77. package/dist/tools/ToolConfigurator.js +89 -0
  78. package/dist/tools/ToolConfigurator.js.map +1 -0
  79. package/dist/tools/ToolDefinitions.d.ts +25 -0
  80. package/dist/tools/ToolDefinitions.d.ts.map +1 -0
  81. package/dist/tools/ToolDefinitions.js +502 -0
  82. package/dist/tools/ToolDefinitions.js.map +1 -0
  83. package/dist/tools/ToolRegistry.d.ts +16 -0
  84. package/dist/tools/ToolRegistry.d.ts.map +1 -0
  85. package/dist/tools/ToolRegistry.js +89 -0
  86. package/dist/tools/ToolRegistry.js.map +1 -0
  87. package/dist/tools/index.d.ts +4 -0
  88. package/dist/tools/index.d.ts.map +1 -0
  89. package/dist/tools/index.js +21 -0
  90. package/dist/tools/index.js.map +1 -0
  91. package/dist/types/mcp-tool-args.d.ts +122 -0
  92. package/dist/types/mcp-tool-args.d.ts.map +1 -0
  93. package/dist/types/mcp-tool-args.js +7 -0
  94. package/dist/types/mcp-tool-args.js.map +1 -0
  95. package/dist/types/mcp.d.ts +32 -0
  96. package/dist/types/mcp.d.ts.map +1 -0
  97. package/dist/types/mcp.js +3 -0
  98. package/dist/types/mcp.js.map +1 -0
  99. package/dist/types/motion.d.ts +304 -0
  100. package/dist/types/motion.d.ts.map +1 -0
  101. package/dist/types/motion.js +3 -0
  102. package/dist/types/motion.js.map +1 -0
  103. package/dist/utils/cache.d.ts +25 -0
  104. package/dist/utils/cache.d.ts.map +1 -0
  105. package/dist/utils/cache.js +135 -0
  106. package/dist/utils/cache.js.map +1 -0
  107. package/dist/utils/constants.d.ts +83 -0
  108. package/dist/utils/constants.d.ts.map +1 -0
  109. package/dist/utils/constants.js +151 -0
  110. package/dist/utils/constants.js.map +1 -0
  111. package/dist/utils/errorHandling.d.ts +50 -0
  112. package/dist/utils/errorHandling.d.ts.map +1 -0
  113. package/dist/utils/errorHandling.js +86 -0
  114. package/dist/utils/errorHandling.js.map +1 -0
  115. package/dist/utils/index.d.ts +13 -0
  116. package/dist/utils/index.d.ts.map +1 -0
  117. package/dist/utils/index.js +38 -0
  118. package/dist/utils/index.js.map +1 -0
  119. package/dist/utils/logger.d.ts +13 -0
  120. package/dist/utils/logger.d.ts.map +1 -0
  121. package/dist/utils/logger.js +47 -0
  122. package/dist/utils/logger.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 +92 -0
  132. package/dist/utils/responseFormatters.d.ts.map +1 -0
  133. package/dist/utils/responseFormatters.js +331 -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 +137 -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
package/README.md CHANGED
@@ -1,6 +1,22 @@
1
1
  # Motion MCP Server
2
2
 
3
- A Model Context Protocol (MCP) server that provides LLMs with direct access to the Motion API for task and project management. This server implements the MCP protocol to enable seamless integration between AI assistants and Motion's productivity platform.
3
+ An MCP (Model Context Protocol) server that gives LLMs direct access to the Motion API for projects, tasks, users, and more. Built in TypeScript with robust validation and consolidated tools to keep your client tool list lean.
4
+
5
+ ## Quick start (npx)
6
+
7
+ Run the server without installing globally:
8
+
9
+ ```bash
10
+ MOTION_API_KEY=your_motion_api_key npx motionmcp
11
+ ```
12
+
13
+ Or provide the key via your shell environment and run:
14
+
15
+ ```bash
16
+ npx motionmcp
17
+ ```
18
+
19
+ > Tip: `npx` runs the latest published version.
4
20
 
5
21
  ## Preview
6
22
 
@@ -10,539 +26,319 @@ A Model Context Protocol (MCP) server that provides LLMs with direct access to t
10
26
 
11
27
  ## Features
12
28
 
13
- - **MCP Protocol Implementation**: Full Model Context Protocol support for LLM integration
14
- - **Motion API Integration**: Complete CRUD operations for projects, tasks, workspaces, and users
15
- - **18 Built-in Tools**: Comprehensive set of tools for Motion management with AI-powered intelligence
16
- - **Context Awareness**: Real-time workspace context, recent activity, and intelligent suggestions
17
- - **Smart Workspace Management**: Automatic workspace detection and selection
18
- - **Intelligent Search**: Semantic search across tasks and projects with relevance scoring
19
- - **Workload Analytics**: Comprehensive workload analysis with overdue tasks and deadline tracking
20
- - **Workflow Intelligence**: Smart scheduling, bulk operations, and next action suggestions
21
- - **Project Templates**: Pre-built project templates with intelligent task creation
22
- - **Enhanced Task Creation**: Supports all Motion API parameters with intelligent defaults
23
- - **MCP-Compliant Logging**: Structured JSON logging to stderr for debugging
24
- - **JSON Schema Validation**: Proper input validation and type safety
25
- - **Robust Error Handling**: Detailed error messages and fallback mechanisms
26
- - **API Key Authentication**: Secure Motion API integration
29
+ * MCP protocol support for seamless LLM integration
30
+ * Motion API integration for projects, tasks, users, comments, custom fields, and recurring tasks
31
+ * **Consolidated tools** to reduce tool count (minimal, essential, all, or custom)
32
+ * Context utilities: semantic search and lightweight context summaries
33
+ * API key via environment variable
34
+ * Structured JSON logging
35
+ * **TypeScript** with strong types, validation, and robust error handling
27
36
 
28
37
  ## Prerequisites
29
38
 
30
- - Node.js 18 or higher
31
- - Motion API key (get from https://app.usemotion.com/settings/api)
39
+ * Node.js 18 or higher
40
+ * Motion API key from [https://app.usemotion.com/settings/api](https://app.usemotion.com/settings/api)
32
41
 
33
- ## Providing Your Motion API Key
42
+ ## Tool Configuration
34
43
 
35
- The Motion MCP Server supports multiple ways to provide your API key:
44
+ The server supports configurable tool sets to stay within MCP client limits (~100 tools across all servers). Configure via the `MOTION_MCP_TOOLS` environment variable:
45
+
46
+ ### Configuration options
47
+
48
+ #### Minimal (3 tools)
49
+ Best for users who need only basic functionality and want to maximize room for other MCP servers.
36
50
 
37
- ### Environment Variable
38
51
  ```bash
39
- MOTION_API_KEY=your-key npx motionmcp
52
+ MOTION_MCP_TOOLS=minimal npx motionmcp
40
53
  ```
41
54
 
42
- ### Command Line Arguments
43
- ```bash
44
- # With API key only
45
- npx motionmcp --api-key=your-key
55
+ **Available tools:**
56
+ - `motion_tasks` - Task operations (create, list, get, update, delete, move, unassign)
57
+ - `motion_projects` - Project operations (create, list, get)
58
+ - `motion_workspaces` - Workspace management (list, get, set_default)
46
59
 
47
- # With API key and custom port
48
- npx motionmcp --api-key=your-key --port=4000
49
- ```
60
+ #### Essential (7 tools, default)
61
+ Balanced configuration with core functionality plus search, user management, and scheduling.
50
62
 
51
- ### Config File
52
- Create a config file in your home directory:
53
63
  ```bash
54
- echo '{"apiKey": "your-key", "port": 4000}' > ~/.motionmcp.json
64
+ # Default - no configuration needed
55
65
  npx motionmcp
66
+ # or explicitly:
67
+ MOTION_MCP_TOOLS=essential npx motionmcp
56
68
  ```
57
69
 
58
- ### Interactive Prompt
59
- If no API key is provided through the above methods, the server will prompt you:
70
+ **Available tools:**
71
+ - All from Minimal, plus:
72
+ - `motion_users` - User operations (list, current)
73
+ - `motion_search` - Search and context utilities (content, context, smart)
74
+ - `motion_comments` - Comment management (list, create)
75
+ - `motion_schedules` - Schedule operations (list)
76
+
77
+ #### Complete (10 tools)
78
+ All consolidated tools for full Motion API access.
79
+
60
80
  ```bash
61
- npx motionmcp
62
- # Will prompt: "Please enter your Motion API key: "
81
+ MOTION_MCP_TOOLS=complete npx motionmcp
63
82
  ```
64
83
 
65
- The server checks for the API key in this order:
66
- 1. Environment variable (`MOTION_API_KEY`)
67
- 2. Command line argument (`--api-key=`)
68
- 3. Config file (`~/.motionmcp.json`)
69
- 4. Interactive prompt
84
+ **Available tools:**
85
+ - All from Essential, plus:
86
+ - `motion_custom_fields` - Custom field management (list, create, delete, add/remove)
87
+ - `motion_recurring_tasks` - Recurring task management (list, create, delete)
88
+ - `motion_statuses` - Status operations (list)
70
89
 
71
- ## Installation
90
+
72
91
 
73
- 1. Clone the repository
74
- 2. Install dependencies:
75
- ```bash
76
- npm install
77
- ```
92
+ #### Custom
93
+ Specify exactly which tools you need.
78
94
 
79
- 3. Create a `.env` file based on `.env.example`:
80
- ```bash
81
- cp .env.example .env
82
- ```
95
+ ```bash
96
+ MOTION_MCP_TOOLS=custom:motion_tasks,motion_projects,motion_search npx motionmcp
97
+ ```
83
98
 
84
- 4. Update the `.env` file with your Motion API key:
85
- ```
86
- MOTION_API_KEY=your_motion_api_key_here
87
- ```
99
+ ### Consolidated Tools
88
100
 
89
- ## Usage
101
+ The consolidated tools reduce the total tool count by combining related operations:
90
102
 
91
- The Motion MCP Server runs as a Model Context Protocol server for direct LLM integration:
103
+ - **`motion_projects`**: Single tool for core project operations
104
+ - Operations: `create`, `list`, `get`
105
+ - Example: `{"operation": "create", "name": "New Project", "workspaceName": "Personal"}`
92
106
 
93
- ```bash
94
- # Run the MCP server
95
- npm run mcp
107
+ - **`motion_tasks`**: Single tool for all task operations
108
+ - Operations: `create`, `list`, `get`, `update`, `delete`, `move`, `unassign`
109
+ - Example: `{"operation": "create", "name": "New Task", "projectName": "My Project"}`
96
110
 
97
- # Or run directly
98
- node src/mcp-server.js
99
- ```
111
+ - **`motion_comments`**: Manage task comments
112
+ - Operations: `list`, `create`
113
+ - Example: `{"operation": "create", "taskId": "task_123", "content": "Great progress!"}`
100
114
 
101
- ## MCP Tools
102
-
103
- The MCP server provides 18 intelligent tools for Motion integration with enhanced AI capabilities:
104
-
105
- ### Context & Intelligence
106
- - `get_motion_context` - Get comprehensive workspace context, recent activity, and smart suggestions
107
- - `search_motion_content` - Intelligent search across tasks and projects with semantic relevance
108
- - `analyze_motion_workload` - Analyze workload distribution, overdue tasks, and productivity insights
109
- - `suggest_next_actions` - AI-powered suggestions for next actions based on current state
110
-
111
- ### Project Management
112
- - `create_motion_project` - Create a new project with workspace auto-detection
113
- - `create_project_template` - Create projects from intelligent templates (software dev, marketing, etc.)
114
- - `list_motion_projects` - List projects with workspace filtering support
115
- - `get_motion_project` - Get project details by ID
116
- - `update_motion_project` - Update project properties
117
- - `delete_motion_project` - Delete a project
118
-
119
- ### Task Management
120
- - `create_motion_task` - Create a new task with intelligent workspace/project resolution
121
- - `list_motion_tasks` - List tasks with workspace and project filtering
122
- - `get_motion_task` - Get task details by ID
123
- - `update_motion_task` - Update task properties
124
- - `delete_motion_task` - Delete a task
125
- - `bulk_update_tasks` - Update multiple tasks simultaneously
126
- - `smart_schedule_tasks` - AI-powered intelligent task scheduling
127
-
128
- ### Workspace & User Info
129
- - `list_motion_workspaces` - List all workspaces with enhanced details
130
- - `list_motion_users` - List all users
131
-
132
- ## Enhanced Tool Features
133
-
134
- ### Smart Workspace Management
135
- - **Auto-detection**: Automatically uses default workspace when none specified
136
- - **Name resolution**: Find workspaces by name instead of requiring IDs
137
- - **Intelligent defaults**: Prefers "Personal" workspaces as default
138
- - **Fallback handling**: Graceful handling when workspace resolution fails
139
-
140
- ### Advanced Task Creation
141
- The `create_motion_task` tool now supports all Motion API parameters:
142
-
143
- **Basic Parameters:**
144
- - `name` (required) - Task title
145
- - `description` - Markdown-supported task description
146
- - `workspaceId` / `workspaceName` - Workspace specification (auto-detects if omitted)
147
- - `projectId` / `projectName` - Project assignment (optional)
148
-
149
- **Advanced Parameters:**
150
- - `status` - Task status (uses workspace default if omitted)
151
- - `priority` - ASAP, HIGH, MEDIUM, or LOW
152
- - `dueDate` - ISO 8601 date (required for scheduled tasks)
153
- - `duration` - Minutes (number), "NONE", or "REMINDER"
154
- - `assigneeId` - User ID for task assignment
155
- - `labels` - Array of label names
156
- - `autoScheduled` - Auto-scheduling configuration (object or null)
157
-
158
- ### Intelligent Project Resolution
159
- - **Name lookup**: Find projects by partial or exact name match
160
- - **Workspace scoping**: Project searches are scoped to specific workspaces
161
- - **Fuzzy matching**: Supports partial name matching for easier use
162
- - **Error feedback**: Clear messages when projects aren't found
163
-
164
- ## AI-Powered Intelligence Features
165
-
166
- ### Context Awareness
167
- The `get_motion_context` tool provides LLMs with comprehensive situational awareness:
168
-
169
- **Real-time Context:**
170
- - Current default workspace and available workspaces
171
- - User information and permissions
172
- - Recent activity across tasks and projects
173
- - Current workload distribution and status
174
-
175
- **Intelligent Suggestions:**
176
- - Overdue tasks requiring immediate attention
177
- - High-priority items to focus on next
178
- - Upcoming deadlines and time-sensitive work
179
- - Project status insights and recommendations
180
-
181
- **Example Usage:**
182
- ```
183
- LLM: Let me get your current Motion context to understand your situation.
184
- Tool: get_motion_context
185
- Result: You're in "Development" workspace with 15 active tasks. You have 3 overdue tasks and 5 high-priority items. Recent activity shows focus on "API Integration" project.
186
- Suggestions:
187
- - Address 3 overdue tasks (Task A, B, C)
188
- - Continue work on high-priority "Security Review"
189
- - Upcoming deadline: "Release Planning" due tomorrow
190
- ```
115
+ - **`motion_custom_fields`**: Single tool for custom field management
116
+ - Operations: `list`, `create`, `delete`, `add_to_project`, `remove_from_project`, `add_to_task`, `remove_from_task`
117
+ - Example: `{"operation": "create", "name": "Priority Level", "type": "DROPDOWN", "options": ["Low", "Medium", "High"]}`
191
118
 
192
- ### Intelligent Search
193
- The `search_motion_content` tool provides semantic search capabilities:
119
+ - **`motion_recurring_tasks`**: Single tool for recurring task templates
120
+ - Operations: `list`, `create`, `delete`
121
+ - Example: `{"operation": "create", "name": "Weekly Review", "workspaceId": "ws_123", "assigneeId": "user_123", "frequency": {"type": "weekly", "daysOfWeek": [1,3,5] }, "duration": 30 }`
194
122
 
195
- **Advanced Search Features:**
196
- - Content-aware search across task descriptions and project details
197
- - Relevance scoring based on exact matches, partial matches, and priority
198
- - Scoped search (tasks only, projects only, or both)
199
- - Priority boosting for urgent items
123
+ ## Providing Your Motion API Key
200
124
 
201
- **Example Usage:**
202
- ```
203
- LLM: Let me search for anything related to "API security"
204
- Tool: search_motion_content
205
- Args: {"query": "API security", "searchScope": "both"}
206
- Result: Found 4 relevant items:
207
- - [task] API Security Review (ID: task_789) - Relevance: 95
208
- - [project] Security Audit (ID: proj_456) - Relevance: 70
209
- - [task] Update API documentation (ID: task_012) - Relevance: 45
125
+ The Motion MCP Server supports the following ways to provide your API key:
126
+
127
+ ### 1. Environment Variable
128
+
129
+ ```bash
130
+ MOTION_API_KEY=your-key npx motionmcp
210
131
  ```
211
132
 
212
- ### Workload Analytics
213
- The `analyze_motion_workload` tool provides comprehensive productivity insights:
133
+ ### 2. .env file (when running via npm)
214
134
 
215
- **Analytics Capabilities:**
216
- - Task distribution by status, priority, and project
217
- - Overdue task identification and counting
218
- - Upcoming deadline tracking and alerts
219
- - Project health and progress monitoring
220
- - Time-based analysis (today, this week, this month)
135
+ Create a `.env` next to the project with:
221
136
 
222
- **Example Usage:**
223
- ```
224
- LLM: Let me analyze your current workload.
225
- Tool: analyze_motion_workload
226
- Args: {"timeframe": "this_week", "includeProjects": true}
227
- Result: Workload Analysis (this_week):
228
- - Total Tasks: 23
229
- - Overdue Tasks: 3
230
- - Upcoming Deadlines: 7
231
- - Task Distribution:
232
- - In Progress: 8 tasks
233
- - Todo: 12 tasks
234
- - Completed: 3 tasks
235
- - Project Insights:
236
- - 4 active projects
237
- - 2 projects behind schedule
137
+ ```bash
138
+ MOTION_API_KEY=your-key
238
139
  ```
239
140
 
240
- ### Smart Scheduling
241
- The `smart_schedule_tasks` tool provides AI-powered task optimization:
141
+ > When using npx, prefer exporting the variable in your shell as shown above.
242
142
 
243
- **Intelligent Scheduling Features:**
244
- - Priority-based task ordering (ASAP → HIGH → MEDIUM → LOW)
245
- - Deadline-aware scheduling with urgency detection
246
- - Workload balancing and buffer time inclusion
247
- - Conflict detection and resolution suggestions
248
- - Automatic unscheduled task discovery
143
+ ## Tool Overview
249
144
 
250
- **Example Usage:**
251
- ```
252
- LLM: Let me intelligently schedule your unscheduled tasks.
253
- Tool: smart_schedule_tasks
254
- Args: {"schedulingPreferences": {"prioritizeDeadlines": true}}
255
- Result: Scheduled 8 tasks optimally:
256
- - Task ID: task_456 -> 9:00 AM (ASAP priority)
257
- - Task ID: task_789 -> 10:30 AM (Due today)
258
- - Task ID: task_012 -> 2:00 PM (HIGH priority)
259
- ```
145
+ ### Context & Search
260
146
 
261
- ### Workflow Intelligence
262
- The `suggest_next_actions` tool provides proactive assistance:
147
+ * `motion_search` — content search, context, and smart search
263
148
 
264
- **Smart Suggestions Based On:**
265
- - Current task priorities and deadlines
266
- - Project status and momentum
267
- - Historical patterns and preferences
268
- - Workload balance and capacity
269
- - Context-aware recommendations (daily planning, project review, etc.)
149
+ ### Projects
270
150
 
271
- **Example Usage:**
272
- ```
273
- LLM: What should I focus on next?
274
- Tool: suggest_next_actions
275
- Args: {"context": "daily planning", "maxSuggestions": 3}
276
- Result: Suggested Next Actions:
277
- ✅ Complete "Security Review" (task_789) - ASAP priority, due today
278
- ⏰ Start "Database Migration" (task_456) - Due in 2 days
279
- 🔄 Review stalled project: "Mobile App" - No recent activity
280
- ```
151
+ * `motion_projects` — create, list, get
281
152
 
282
- ## Quick Start for LLM Context
153
+ ### Tasks
283
154
 
284
- **For optimal LLM assistance, start with these tools:**
155
+ * `motion_tasks` create, list, get, update, delete, move, unassign
285
156
 
286
- 1. **`get_motion_context`** - Get comprehensive workspace overview and current state
287
- 2. **`analyze_motion_workload`** - Understand current workload and priorities
288
- 3. **`suggest_next_actions`** - Get AI-powered recommendations for what to focus on next
157
+ ### Comments, Custom Fields, Recurring
289
158
 
290
- **Example Intelligent Workflow:**
291
- ```
292
- User: "Help me plan my day"
159
+ * `motion_comments` — list, create (task comments)
160
+ * `motion_custom_fields` — list, create, delete, add/remove on project or task
161
+ * `motion_recurring_tasks` list, create, delete
293
162
 
294
- LLM: I'll help you plan your day efficiently. Let me first understand your current situation.
163
+ ### Workspaces, Users, Schedules, Statuses
295
164
 
296
- 1. Getting your Motion context...
297
- Tool: get_motion_context
298
- Result: You're in "Work" workspace with 12 active tasks, 2 overdue items, and 4 high-priority tasks.
165
+ * `motion_workspaces` list, get, set_default
166
+ * `motion_users` — list (by workspace), current
167
+ * `motion_schedules` user schedules and time zones
168
+ * `motion_statuses` — available statuses by workspace
299
169
 
300
- 2. Analyzing your current workload...
301
- Tool: analyze_motion_workload
302
- Args: {"timeframe": "today"}
303
- Result: Today you have 6 tasks, 2 are overdue, 3 due by end of day.
170
+ ## Enhanced Features
304
171
 
305
- 3. Generating smart suggestions...
306
- Tool: suggest_next_actions
307
- Args: {"context": "daily planning"}
308
- Result: Recommended focus:
309
- - ✅ Complete overdue "Security Review" (ASAP priority)
310
- - ⏰ Finish "Database Migration" (due today)
311
- - 🚀 Start "Feature Testing" (high priority, good momentum)
172
+ ### Smart Defaults & Resolution
312
173
 
313
- Based on this analysis, I recommend starting with the overdue Security Review task since it's marked ASAP priority, then moving to the Database Migration that's due today. This will clear your urgent items and give you momentum for the day.
174
+ * Workspace and project auto-detection and fuzzy matching
175
+ * Intelligent defaults: selects "Personal" workspace if none provided
176
+ * Robust fallback and error messaging
314
177
 
315
- Would you like me to help schedule these tasks or create any new tasks for your day?
316
- ```
178
+ ### Task Creation
317
179
 
318
- ## MCP Integration Examples
180
+ Supports all Motion API parameters:
319
181
 
320
- ### Using with Claude Desktop
321
- Add to your `claude_desktop_config.json`:
182
+ * Basic: `name`, `description`, `workspaceId|workspaceName`, `projectId|projectName`
183
+ * Advanced: `priority`, `dueDate`, `duration`, `labels`, `assigneeId`, `autoScheduled`
322
184
 
323
- ```json
324
- {
325
- "mcpServers": {
326
- "motion": {
327
- "command": "node",
328
- "args": ["/path/to/MotionMCP/src/mcp-server.js"],
329
- "env": {
330
- "MOTION_API_KEY": "your_motion_api_key_here"
331
- }
332
- }
333
- }
334
- }
335
- ```
185
+ ### Semantic Search
336
186
 
337
- ### LLM Tool Usage Examples
187
+ * Cross-search by query with intelligent scope and priority boosting
338
188
 
339
- **Create a simple task:**
340
- ```
341
- LLM: I'll create a new task for you.
342
- Tool: create_motion_task
343
- Args: {"name": "Review quarterly reports"}
344
- Result: Successfully created task "Review quarterly reports" with ID: task_123 in workspace ws_456
345
- ```
189
+ ### Scheduling & Workload
346
190
 
347
- **Create an advanced task with project assignment:**
348
- ```
349
- LLM: I'll create a detailed task in your development project.
350
- Tool: create_motion_task
191
+ * Prioritized scheduling with conflict detection and task balancing
192
+ * Detailed workload breakdowns by status, priority, and project
193
+
194
+ ## Example Tool Use
195
+
196
+ ### Creating a task with the consolidated tool
197
+ ```json
198
+ Tool: motion_tasks
351
199
  Args: {
200
+ "operation": "create",
352
201
  "name": "Complete API integration",
353
- "description": "Integrate with Motion API and test all endpoints",
354
202
  "workspaceName": "Development",
355
- "projectName": "Feature Release",
203
+ "projectName": "Release Cycle Q2",
204
+ "dueDate": "2025-06-15T09:00:00Z",
356
205
  "priority": "HIGH",
357
- "dueDate": "2025-05-30T17:00:00.000Z",
358
- "duration": 120,
359
- "labels": ["api", "integration", "urgent"]
206
+ "labels": ["api", "release"]
360
207
  }
361
- Result: Successfully created task "Complete API integration" with ID: task_789 in project proj_456 in workspace ws_123
362
208
  ```
363
209
 
364
- **List projects with workspace filtering:**
365
- ```
366
- LLM: Let me check your development projects.
367
- Tool: list_motion_projects
368
- Args: {"workspaceName": "Development"}
369
- Result: Found 3 projects in Development workspace:
370
- - Feature Release (ID: proj_456) - Status: In Progress
371
- - Bug Fixes (ID: proj_789) - Status: Todo
372
- - Documentation (ID: proj_012) - Status: Backlog
210
+ ### Adding a comment to a task
211
+ ```json
212
+ Tool: motion_comments
213
+ Args: {
214
+ "operation": "create",
215
+ "taskId": "task_123",
216
+ "content": "Updated the API endpoints as discussed"
217
+ }
373
218
  ```
374
219
 
375
- **List tasks with intelligent filtering:**
376
- ```
377
- LLM: Let me check your current tasks.
378
- Tool: list_motion_tasks
379
- Args: {"workspaceName": "Personal", "projectName": "Website Redesign"}
380
- Result: Found 5 tasks in Website Redesign project:
381
- - Fix responsive layout (ID: task_456) - Status: In Progress
382
- - Update color scheme (ID: task_789) - Status: Todo
383
- - Optimize images (ID: task_012) - Status: Done
384
- - Test on mobile (ID: task_345) - Status: Todo
385
- - Deploy to staging (ID: task_678) - Status: Backlog
220
+ ### Creating a custom field
221
+ ```json
222
+ Tool: motion_custom_fields
223
+ Args: {
224
+ "operation": "create",
225
+ "name": "Sprint",
226
+ "type": "DROPDOWN",
227
+ "options": ["Sprint 1", "Sprint 2", "Sprint 3"],
228
+ "workspaceName": "Development"
229
+ }
386
230
  ```
387
231
 
388
- ## Configuration
389
-
390
- ### Environment Variables
391
-
392
- | Variable | Description | Default |
393
- | ---------------- | ------------------------------ | ------- |
394
- | `MOTION_API_KEY` | Your Motion API key (required) | - |
395
-
396
- ## Motion API Documentation
397
-
398
- For detailed information about Motion's API, visit: https://docs.usemotion.com/
399
-
400
- ## Error Handling & Logging
401
-
402
- The server includes comprehensive error handling and MCP-compliant logging:
403
-
404
- ### MCP-Compliant Logging
405
- - **Structured JSON logs** to stderr for MCP compliance
406
- - **Detailed context** including method names, IDs, and API responses
407
- - **Error tracking** with API status codes and messages
408
- - **Performance monitoring** with request/response timing
409
-
410
- ### Enhanced Error Handling
411
- - **Smart workspace resolution** with fallback to defaults
412
- - **Project lookup validation** with helpful error messages
413
- - **API response structure handling** for wrapped/unwrapped responses
414
- - **Input validation** with detailed parameter requirements
415
- - **Graceful degradation** when optional features fail
416
-
417
- ### Error Response Examples
232
+ ### Creating a recurring task
418
233
  ```json
419
- // Missing workspace error
420
- {"error": "workspaceId is required and no default workspace could be found"}
421
-
422
- // Project not found error
423
- {"error": "Project 'Marketing Campaign' not found in workspace"}
424
-
425
- // Invalid parameter error
426
- {"error": "Task priority must be one of: ASAP, HIGH, MEDIUM, LOW"}
234
+ Tool: motion_recurring_tasks
235
+ Args: {
236
+ "operation": "create",
237
+ "name": "Weekly Team Standup",
238
+ "recurrence": "WEEKLY",
239
+ "projectName": "Team Meetings",
240
+ "daysOfWeek": ["MONDAY", "WEDNESDAY", "FRIDAY"],
241
+ "duration": 30
242
+ }
427
243
  ```
428
244
 
429
- ## Security
430
-
431
- - API keys are never logged or exposed
432
- - All sensitive information is kept out of logs
433
- - Input validation on all endpoints
434
- - MCP-compliant structured logging to stderr
435
- - Workspace-scoped operations for data isolation
245
+ ## LLM Integration
436
246
 
437
- ## Architecture
247
+ ### Claude Desktop Configuration
438
248
 
439
- The Motion MCP Server is designed as a focused MCP implementation:
249
+ Add this to your `claude_desktop_config.json`.
440
250
 
441
- ```
442
- src/
443
- ├── mcp-server.js # MCP protocol server implementation
444
- ├── services/
445
- │ └── motionApi.js # Enhanced Motion API service layer
446
- └── utils/ # Utility functions
251
+ #### Using published package (npx)
252
+ ```json
253
+ {
254
+ "mcpServers": {
255
+ "motion": {
256
+ "command": "npx",
257
+ "args": ["motionmcp"],
258
+ "env": {
259
+ "MOTION_API_KEY": "your_api_key",
260
+ "MOTION_MCP_TOOLS": "essential"
261
+ }
262
+ }
263
+ }
264
+ }
447
265
  ```
448
266
 
449
- ### Key Components
450
-
451
- **MotionApiService (`motionApi.js`):**
452
- - **Smart workspace detection** with default workspace resolution
453
- - **Project lookup by name** with fuzzy matching capabilities
454
- - **Enhanced error handling** with detailed context and fallbacks
455
- - **MCP-compliant logging** with structured JSON output
456
- - **API response handling** for Motion's wrapped response formats
457
-
458
- **MCP Server (`mcp-server.js`):**
459
- - **Intelligent parameter resolution** for workspace and project names
460
- - **Enhanced tool definitions** with comprehensive parameter documentation
461
- - **Robust error handling** with user-friendly error messages
462
- - **Workspace-aware operations** for all project and task management
463
-
464
- ## Recent Improvements
465
-
466
- ### Version 2.0 Enhancements
467
- - ✅ **MCP-Compliant Logging**: Replaced Winston with structured JSON logging to stderr
468
- - ✅ **Smart Workspace Management**: Auto-detection and intelligent defaults for workspaces
469
- - ✅ **Enhanced Task Creation**: Support for all Motion API parameters with intelligent resolution
470
- - ✅ **Project Name Resolution**: Find projects by name with fuzzy matching
471
- - ✅ **Robust Error Handling**: Detailed error messages with context and fallback mechanisms
472
- - ✅ **API Response Handling**: Fixed handling of Motion's wrapped response formats (`{projects: [...]}`, `{workspaces: [...]}`)
473
- - ✅ **Workspace-Aware Operations**: All tools now support workspace filtering and auto-detection
474
- - ✅ **Improved Documentation**: Comprehensive parameter descriptions and usage examples
475
-
476
- ### Version 2.1 Intelligence Enhancements
477
- - ✅ **Context Awareness**: Real-time workspace context with activity tracking and intelligent suggestions
478
- - ✅ **Intelligent Search**: Semantic search across tasks and projects with relevance scoring
479
- - ✅ **Workload Analytics**: Comprehensive workload analysis with overdue tasks and deadline tracking
480
- - ✅ **Smart Scheduling**: AI-powered task scheduling with priority and deadline optimization
481
- - ✅ **Workflow Intelligence**: Proactive next action suggestions based on current state
482
- - ✅ **Project Templates**: Pre-built intelligent templates for common project types
483
- - ✅ **Bulk Operations**: Efficient batch updates for multiple tasks simultaneously
484
- - ✅ **Enhanced Tool Count**: Expanded from 12 to 18 tools with AI-powered capabilities
485
-
486
- ### Breaking Changes
487
- - **Logging Format**: Changed from Winston file logging to MCP-compliant JSON stderr logging
488
- - **Task Creation**: `workspaceId` is now auto-resolved if not provided (was previously required)
489
- - **Response Handling**: Fixed array method errors by properly handling wrapped API responses
490
-
491
- ## Debugging & Troubleshooting
492
-
493
- ### MCP Logging
494
- The server outputs structured JSON logs to stderr for debugging:
267
+ #### Using your local workspace (npm)
495
268
  ```json
496
- {"level":"info","msg":"Successfully fetched projects","method":"getProjects","count":3,"workspaceId":"ws_123","time":"2025-05-26T22:30:45.123Z"}
497
- {"level":"error","msg":"Failed to create task","method":"createTask","error":"workspaceId is required","time":"2025-05-26T22:30:46.456Z"}
269
+ {
270
+ "mcpServers": {
271
+ "motion": {
272
+ "command": "npm",
273
+ "args": ["run", "mcp:dev"],
274
+ "cwd": "/absolute/path/to/your/MotionMCP",
275
+ "env": {
276
+ "MOTION_API_KEY": "your_api_key",
277
+ "MOTION_MCP_TOOLS": "essential"
278
+ }
279
+ }
280
+ }
281
+ }
498
282
  ```
499
283
 
500
- ### Common Issues
284
+ See the full developer setup and more options in [DEVELOPER.md](./DEVELOPER.md).
501
285
 
502
- **Task Creation Fails:**
503
- - Ensure your Motion API key has task creation permissions
504
- - Check that the workspace exists and is accessible
505
- - Verify project names are spelled correctly (uses fuzzy matching)
286
+ ### Configuration Examples
506
287
 
507
- **Workspace Not Found:**
508
- - List workspaces first with `list_motion_workspaces`
509
- - Use exact workspace names or IDs
510
- - Check API key permissions for workspace access
288
+ **Minimal setup (3 tools only):**
289
+ ```json
290
+ {
291
+ "mcpServers": {
292
+ "motion": {
293
+ "command": "npx",
294
+ "args": ["motionmcp"],
295
+ "env": {
296
+ "MOTION_API_KEY": "your_api_key",
297
+ "MOTION_MCP_TOOLS": "minimal"
298
+ }
299
+ }
300
+ }
301
+ }
302
+ ```
511
303
 
512
- **Project Resolution Issues:**
513
- - Projects are searched within the specified workspace only
514
- - Use partial names for fuzzy matching: "Marketing" will find "Marketing Campaign"
515
- - Ensure the project exists in the target workspace
304
+ **Custom tools selection:**
305
+ ```json
306
+ {
307
+ "mcpServers": {
308
+ "motion": {
309
+ "command": "npx",
310
+ "args": ["motionmcp"],
311
+ "env": {
312
+ "MOTION_API_KEY": "your_api_key",
313
+ "MOTION_MCP_TOOLS": "custom:motion_tasks,motion_projects,motion_search"
314
+ }
315
+ }
316
+ }
317
+ }
318
+ ```
516
319
 
517
- ### Debugging Tips
518
- 1. **Check stderr output** for detailed MCP logs
519
- 2. **Use `list_motion_workspaces`** to see available workspaces
520
- 3. **Test with simple task creation** before using advanced parameters
521
- 4. **Verify API key permissions** in Motion settings
320
+ ## Debugging
522
321
 
523
- ## How MCP Communication Works
322
+ * Logs output to `stderr` in JSON format
323
+ * Check for missing keys, workspace/project names, and permissions
324
+ * Use `motion_workspaces` (list) and `motion_projects` (list) to validate IDs
524
325
 
525
- 1. **LLM Discovery**: LLM calls `tools/list` to discover available tools
526
- 2. **Tool Schema**: Server returns JSON schemas for each tool
527
- 3. **Tool Execution**: LLM calls `tools/call` with tool name and arguments
528
- 4. **Response**: Server executes Motion API call and returns structured result
326
+ ## Logging Example
529
327
 
530
- **Example Protocol Flow:**
531
328
  ```json
532
- // LLM requests available tools
533
- {"jsonrpc": "2.0", "id": 1, "method": "tools/list"}
534
-
535
- // Server responds with tool definitions
536
- {"jsonrpc": "2.0", "id": 1, "result": {"tools": [...]}}
537
-
538
- // LLM calls a tool
539
- {"jsonrpc": "2.0", "id": 2, "method": "tools/call",
540
- "params": {"name": "create_motion_task", "arguments": {...}}}
541
-
542
- // Server executes and responds
543
- {"jsonrpc": "2.0", "id": 2, "result": {"content": [...]}}
329
+ {
330
+ "level": "info",
331
+ "msg": "Task created successfully",
332
+ "method": "createTask",
333
+ "taskId": "task_789",
334
+ "workspace": "Development"
335
+ }
544
336
  ```
545
337
 
546
338
  ## License
547
339
 
548
- ISC
340
+ Apache-2.0 License
341
+
342
+ ---
343
+
344
+ For more information, see the full [Motion API docs](https://docs.usemotion.com/) or [Model Context Protocol docs](https://modelcontextprotocol.io/docs/).