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
package/README.md CHANGED
@@ -1,6 +1,40 @@
1
+ ![NPM Version](https://img.shields.io/npm/v/motionmcp)
2
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
3
+
1
4
  # Motion MCP Server
2
5
 
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.
6
+ 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.
7
+
8
+ **Current version:** 2.1.0
9
+
10
+ ## Quick start (npx)
11
+
12
+ 1. **Get your Motion API key** from [https://app.usemotion.com/settings/api](https://app.usemotion.com/settings/api)
13
+
14
+ 2. **Add to Claude Desktop** - Update your `claude_desktop_config.json`:
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "motion": {
20
+ "command": "npx",
21
+ "args": ["motionmcp"],
22
+ "env": {
23
+ "MOTION_API_KEY": "your_api_key",
24
+ "MOTION_MCP_TOOLS": "essential"
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ 3. **Test the server** - Or run directly from command line:
32
+
33
+ ```bash
34
+ MOTION_API_KEY=your_motion_api_key npx motionmcp
35
+ ```
36
+
37
+ > Tip: `npx` runs the latest published version.
4
38
 
5
39
  ## Preview
6
40
 
@@ -10,539 +44,296 @@ A Model Context Protocol (MCP) server that provides LLMs with direct access to t
10
44
 
11
45
  ## Features
12
46
 
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
47
+ * MCP protocol support for seamless LLM integration
48
+ * Motion API integration for projects, tasks, users, comments, custom fields, and recurring tasks
49
+ * **Consolidated tools** to reduce tool count (minimal, essential, all, or custom)
50
+ * Context utilities: semantic search and lightweight context summaries
51
+ * API key via environment variable
52
+ * Structured JSON logging
53
+ * **TypeScript** with strong types, validation, and robust error handling
27
54
 
28
55
  ## Prerequisites
29
56
 
30
- - Node.js 18 or higher
31
- - Motion API key (get from https://app.usemotion.com/settings/api)
57
+ * Node.js 18 or higher
32
58
 
33
- ## Providing Your Motion API Key
59
+ ## Tool Configuration
60
+
61
+ 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:
62
+
63
+ ### Configuration options
34
64
 
35
- The Motion MCP Server supports multiple ways to provide your API key:
65
+ #### Minimal (3 tools)
66
+ Best for users who need only basic functionality and want to maximize room for other MCP servers.
36
67
 
37
- ### Environment Variable
38
68
  ```bash
39
- MOTION_API_KEY=your-key npx motionmcp
69
+ MOTION_MCP_TOOLS=minimal npx motionmcp
40
70
  ```
41
71
 
42
- ### Command Line Arguments
43
- ```bash
44
- # With API key only
45
- npx motionmcp --api-key=your-key
72
+ **Available tools:**
73
+ - `motion_tasks` - Task operations (create, list, get, update, delete, move, unassign)
74
+ - `motion_projects` - Project operations (create, list, get)
75
+ - `motion_workspaces` - Workspace management (list, get, set_default)
46
76
 
47
- # With API key and custom port
48
- npx motionmcp --api-key=your-key --port=4000
49
- ```
77
+ #### Essential (7 tools, default)
78
+ Balanced configuration with core functionality plus search, user management, and scheduling.
50
79
 
51
- ### Config File
52
- Create a config file in your home directory:
53
80
  ```bash
54
- echo '{"apiKey": "your-key", "port": 4000}' > ~/.motionmcp.json
81
+ # Default - no configuration needed
55
82
  npx motionmcp
83
+ # or explicitly:
84
+ MOTION_MCP_TOOLS=essential npx motionmcp
56
85
  ```
57
86
 
58
- ### Interactive Prompt
59
- If no API key is provided through the above methods, the server will prompt you:
87
+ **Available tools:**
88
+ - All from Minimal, plus:
89
+ - `motion_users` - User operations (list, current)
90
+ - `motion_search` - Search and context utilities (content, context, smart)
91
+ - `motion_comments` - Comment management (list, create)
92
+ - `motion_schedules` - Schedule operations (list)
93
+
94
+ #### Complete (10 tools)
95
+ All consolidated tools for full Motion API access.
96
+
60
97
  ```bash
61
- npx motionmcp
62
- # Will prompt: "Please enter your Motion API key: "
98
+ MOTION_MCP_TOOLS=complete npx motionmcp
63
99
  ```
64
100
 
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
101
+ **Available tools:**
102
+ - All from Essential, plus:
103
+ - `motion_custom_fields` - Custom field management (list, create, delete, add/remove)
104
+ - `motion_recurring_tasks` - Recurring task management (list, create, delete)
105
+ - `motion_statuses` - Status operations (list)
106
+
107
+
108
+
109
+ #### Custom
110
+ Specify exactly which tools you need.
70
111
 
71
- ## Installation
112
+ ```bash
113
+ MOTION_MCP_TOOLS=custom:motion_tasks,motion_projects,motion_search npx motionmcp
114
+ ```
72
115
 
73
- 1. Clone the repository
74
- 2. Install dependencies:
75
- ```bash
76
- npm install
77
- ```
116
+ ### Consolidated Tools
78
117
 
79
- 3. Create a `.env` file based on `.env.example`:
80
- ```bash
81
- cp .env.example .env
82
- ```
118
+ The consolidated tools reduce the total tool count by combining related operations:
83
119
 
84
- 4. Update the `.env` file with your Motion API key:
85
- ```
86
- MOTION_API_KEY=your_motion_api_key_here
87
- ```
120
+ - **`motion_projects`**: Single tool for core project operations
121
+ - Operations: `create`, `list`, `get`
122
+ - Example: `{"operation": "create", "name": "New Project", "workspaceName": "Personal"}`
88
123
 
89
- ## Usage
124
+ - **`motion_tasks`**: Single tool for all task operations
125
+ - Operations: `create`, `list`, `get`, `update`, `delete`, `move`, `unassign`
126
+ - Example: `{"operation": "create", "name": "New Task", "projectName": "My Project"}`
90
127
 
91
- The Motion MCP Server runs as a Model Context Protocol server for direct LLM integration:
128
+ - **`motion_comments`**: Manage task comments
129
+ - Operations: `list`, `create`
130
+ - Example: `{"operation": "create", "taskId": "task_123", "content": "Great progress!"}`
92
131
 
93
- ```bash
94
- # Run the MCP server
95
- npm run mcp
132
+ - **`motion_custom_fields`**: Single tool for custom field management
133
+ - Operations: `list`, `create`, `delete`, `add_to_project`, `remove_from_project`, `add_to_task`, `remove_from_task`
134
+ - Example: `{"operation": "create", "name": "Priority Level", "type": "DROPDOWN", "options": ["Low", "Medium", "High"]}`
96
135
 
97
- # Or run directly
98
- node src/mcp-server.js
99
- ```
136
+ - **`motion_recurring_tasks`**: Single tool for recurring task templates
137
+ - Operations: `list`, `create`, `delete`
138
+ - Example: `{"operation": "create", "name": "Weekly Review", "workspaceId": "ws_123", "assigneeId": "user_123", "frequency": {"type": "weekly", "daysOfWeek": [1,3,5] }, "duration": 30 }`
100
139
 
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
- ```
140
+ ## Providing Your Motion API Key
191
141
 
192
- ### Intelligent Search
193
- The `search_motion_content` tool provides semantic search capabilities:
142
+ The Motion MCP Server supports the following ways to provide your API key:
194
143
 
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
144
+ ### 1. Environment Variable
200
145
 
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
146
+ ```bash
147
+ MOTION_API_KEY=your-key npx motionmcp
210
148
  ```
211
149
 
212
- ### Workload Analytics
213
- The `analyze_motion_workload` tool provides comprehensive productivity insights:
150
+ ### 2. .env file (when running via npm)
214
151
 
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)
152
+ Create a `.env` next to the project with:
221
153
 
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
154
+ ```bash
155
+ MOTION_API_KEY=your-key
238
156
  ```
239
157
 
240
- ### Smart Scheduling
241
- The `smart_schedule_tasks` tool provides AI-powered task optimization:
158
+ > When using npx, prefer exporting the variable in your shell as shown above.
242
159
 
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
160
+ ## Tool Overview
249
161
 
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
- ```
162
+ ### Context & Search
260
163
 
261
- ### Workflow Intelligence
262
- The `suggest_next_actions` tool provides proactive assistance:
164
+ * `motion_search` — content search, context, and smart search
263
165
 
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.)
166
+ ### Projects
270
167
 
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
- ```
168
+ * `motion_projects` — create, list, get
281
169
 
282
- ## Quick Start for LLM Context
170
+ ### Tasks
283
171
 
284
- **For optimal LLM assistance, start with these tools:**
172
+ * `motion_tasks` create, list, get, update, delete, move, unassign
285
173
 
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
174
+ ### Comments, Custom Fields, Recurring
289
175
 
290
- **Example Intelligent Workflow:**
291
- ```
292
- User: "Help me plan my day"
176
+ * `motion_comments` — list, create (task comments)
177
+ * `motion_custom_fields` — list, create, delete, add/remove on project or task
178
+ * `motion_recurring_tasks` list, create, delete
293
179
 
294
- LLM: I'll help you plan your day efficiently. Let me first understand your current situation.
180
+ ### Workspaces, Users, Schedules, Statuses
295
181
 
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.
182
+ * `motion_workspaces` list, get, set_default
183
+ * `motion_users` — list (by workspace), current
184
+ * `motion_schedules` user schedules and time zones
185
+ * `motion_statuses` — available statuses by workspace
299
186
 
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.
187
+ ## Enhanced Features
304
188
 
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)
189
+ ### Smart Defaults & Resolution
312
190
 
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.
191
+ * Workspace and project auto-detection and fuzzy matching
192
+ * Intelligent defaults: selects "Personal" workspace if none provided
193
+ * Robust fallback and error messaging
314
194
 
315
- Would you like me to help schedule these tasks or create any new tasks for your day?
316
- ```
195
+ ### Task Creation
317
196
 
318
- ## MCP Integration Examples
197
+ Supports all Motion API parameters:
319
198
 
320
- ### Using with Claude Desktop
321
- Add to your `claude_desktop_config.json`:
199
+ * Basic: `name`, `description`, `workspaceId|workspaceName`, `projectId|projectName`
200
+ * Advanced: `priority`, `dueDate`, `duration`, `labels`, `assigneeId`, `autoScheduled`
322
201
 
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
- ```
202
+ ### Semantic Search
336
203
 
337
- ### LLM Tool Usage Examples
204
+ * Cross-search by query with intelligent scope and priority boosting
338
205
 
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
- ```
206
+ ### Scheduling & Workload
346
207
 
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
208
+ * Prioritized scheduling with conflict detection and task balancing
209
+ * Detailed workload breakdowns by status, priority, and project
210
+
211
+ ## Example Tool Use
212
+
213
+ ### Creating a task with the consolidated tool
214
+ ```json
215
+ Tool: motion_tasks
351
216
  Args: {
217
+ "operation": "create",
352
218
  "name": "Complete API integration",
353
- "description": "Integrate with Motion API and test all endpoints",
354
219
  "workspaceName": "Development",
355
- "projectName": "Feature Release",
220
+ "projectName": "Release Cycle Q2",
221
+ "dueDate": "2025-06-15T09:00:00Z",
356
222
  "priority": "HIGH",
357
- "dueDate": "2025-05-30T17:00:00.000Z",
358
- "duration": 120,
359
- "labels": ["api", "integration", "urgent"]
223
+ "labels": ["api", "release"]
360
224
  }
361
- Result: Successfully created task "Complete API integration" with ID: task_789 in project proj_456 in workspace ws_123
362
225
  ```
363
226
 
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
227
+ ### Adding a comment to a task
228
+ ```json
229
+ Tool: motion_comments
230
+ Args: {
231
+ "operation": "create",
232
+ "taskId": "task_123",
233
+ "content": "Updated the API endpoints as discussed"
234
+ }
373
235
  ```
374
236
 
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
237
+ ### Creating a custom field
238
+ ```json
239
+ Tool: motion_custom_fields
240
+ Args: {
241
+ "operation": "create",
242
+ "name": "Sprint",
243
+ "type": "DROPDOWN",
244
+ "options": ["Sprint 1", "Sprint 2", "Sprint 3"],
245
+ "workspaceName": "Development"
246
+ }
386
247
  ```
387
248
 
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
249
+ ### Creating a recurring task
418
250
  ```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"}
251
+ Tool: motion_recurring_tasks
252
+ Args: {
253
+ "operation": "create",
254
+ "name": "Weekly Team Standup",
255
+ "recurrence": "WEEKLY",
256
+ "projectName": "Team Meetings",
257
+ "daysOfWeek": ["MONDAY", "WEDNESDAY", "FRIDAY"],
258
+ "duration": 30
259
+ }
427
260
  ```
428
261
 
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
262
+ ## Advanced Claude Desktop Configuration
436
263
 
437
- ## Architecture
438
-
439
- The Motion MCP Server is designed as a focused MCP implementation:
440
-
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
264
+ **Minimal setup (3 tools only):**
265
+ ```json
266
+ {
267
+ "mcpServers": {
268
+ "motion": {
269
+ "command": "npx",
270
+ "args": ["motionmcp"],
271
+ "env": {
272
+ "MOTION_API_KEY": "your_api_key",
273
+ "MOTION_MCP_TOOLS": "minimal"
274
+ }
275
+ }
276
+ }
277
+ }
447
278
  ```
448
279
 
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:
280
+ **Custom tools selection:**
495
281
  ```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"}
282
+ {
283
+ "mcpServers": {
284
+ "motion": {
285
+ "command": "npx",
286
+ "args": ["motionmcp"],
287
+ "env": {
288
+ "MOTION_API_KEY": "your_api_key",
289
+ "MOTION_MCP_TOOLS": "custom:motion_tasks,motion_projects,motion_search"
290
+ }
291
+ }
292
+ }
293
+ }
498
294
  ```
499
295
 
500
- ### Common Issues
501
-
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)
506
-
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
296
+ **Using your local workspace (npm):**
297
+ ```json
298
+ {
299
+ "mcpServers": {
300
+ "motion": {
301
+ "command": "npm",
302
+ "args": ["run", "mcp:dev"],
303
+ "cwd": "/absolute/path/to/your/MotionMCP",
304
+ "env": {
305
+ "MOTION_API_KEY": "your_api_key",
306
+ "MOTION_MCP_TOOLS": "essential"
307
+ }
308
+ }
309
+ }
310
+ }
311
+ ```
511
312
 
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
313
+ See the full developer setup and more options in [DEVELOPER.md](./DEVELOPER.md).
516
314
 
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
315
+ ## Debugging
522
316
 
523
- ## How MCP Communication Works
317
+ * Logs output to `stderr` in JSON format
318
+ * Check for missing keys, workspace/project names, and permissions
319
+ * Use `motion_workspaces` (list) and `motion_projects` (list) to validate IDs
524
320
 
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
321
+ ## Logging Example
529
322
 
530
- **Example Protocol Flow:**
531
323
  ```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": [...]}}
324
+ {
325
+ "level": "info",
326
+ "msg": "Task created successfully",
327
+ "method": "createTask",
328
+ "taskId": "task_789",
329
+ "workspace": "Development"
330
+ }
544
331
  ```
545
332
 
546
333
  ## License
547
334
 
548
- ISC
335
+ Apache-2.0 License
336
+
337
+ ---
338
+
339
+ For more information, see the full [Motion API docs](https://docs.usemotion.com/) or [Model Context Protocol docs](https://modelcontextprotocol.io/docs/).