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