@hauptsache.net/clickup-mcp 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -123,7 +123,9 @@ Use the ClickUp search tools to find tasks assigned to me, and get detailed info
123
123
  const serverPromise = initializeServer();
124
124
  exports.serverPromise = serverPromise;
125
125
  // Only connect to the transport if this file is being run directly (not imported)
126
- if (require.main === module) {
126
+ // OR if not being imported by CLI (to support Claude Desktop's module loading)
127
+ const isCliMode = process.argv.some(arg => arg.includes('cli.ts') || arg.includes('cli.js'));
128
+ if (require.main === module || !isCliMode) {
127
129
  // Start receiving messages on stdin and sending messages on stdout after initialization
128
130
  serverPromise.then(() => {
129
131
  const transport = new stdio_js_1.StdioServerTransport();
@@ -1 +1 @@
1
- {"version":3,"file":"task-write-tools.d.ts","sourceRoot":"","sources":["../../src/tools/task-write-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAapE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,QAqTtE"}
1
+ {"version":3,"file":"task-write-tools.d.ts","sourceRoot":"","sources":["../../src/tools/task-write-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAapE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,QAwXtE"}
@@ -120,6 +120,48 @@ function registerTaskToolsWrite(server, userData) {
120
120
  throw new Error(`Error fetching task: ${taskResponse.status} ${taskResponse.statusText}`);
121
121
  }
122
122
  const taskData = await taskResponse.json();
123
+ // Handle tags separately since they need individual API calls
124
+ let tagUpdateResults = [];
125
+ if (tags !== undefined) {
126
+ // Get current tags
127
+ const currentTags = taskData.tags?.map((t) => t.name) || [];
128
+ const tagsToAdd = tags.filter(tag => !currentTags.includes(tag));
129
+ const tagsToRemove = currentTags.filter((tag) => !tags.includes(tag));
130
+ // Add new tags
131
+ for (const tagName of tagsToAdd) {
132
+ try {
133
+ const addTagResponse = await fetch(`https://api.clickup.com/api/v2/task/${task_id}/tag/${encodeURIComponent(tagName)}`, {
134
+ method: 'POST',
135
+ headers: { Authorization: config_1.CONFIG.apiKey }
136
+ });
137
+ if (!addTagResponse.ok) {
138
+ console.error(`Failed to add tag "${tagName}": ${addTagResponse.status}`);
139
+ tagUpdateResults.push(`Failed to add tag: ${tagName}`);
140
+ }
141
+ }
142
+ catch (error) {
143
+ console.error(`Error adding tag "${tagName}":`, error);
144
+ tagUpdateResults.push(`Error adding tag: ${tagName}`);
145
+ }
146
+ }
147
+ // Remove old tags
148
+ for (const tagName of tagsToRemove) {
149
+ try {
150
+ const removeTagResponse = await fetch(`https://api.clickup.com/api/v2/task/${task_id}/tag/${encodeURIComponent(tagName)}`, {
151
+ method: 'DELETE',
152
+ headers: { Authorization: config_1.CONFIG.apiKey }
153
+ });
154
+ if (!removeTagResponse.ok) {
155
+ console.error(`Failed to remove tag "${tagName}": ${removeTagResponse.status}`);
156
+ tagUpdateResults.push(`Failed to remove tag: ${tagName}`);
157
+ }
158
+ }
159
+ catch (error) {
160
+ console.error(`Error removing tag "${tagName}":`, error);
161
+ tagUpdateResults.push(`Error removing tag: ${tagName}`);
162
+ }
163
+ }
164
+ }
123
165
  // Handle append-only description update with markdown support
124
166
  let finalDescription;
125
167
  if (append_description) {
@@ -128,9 +170,9 @@ function registerTaskToolsWrite(server, userData) {
128
170
  const separator = currentDescription.trim() ? "\n\n---\n" : "";
129
171
  finalDescription = currentDescription + separator + `**Edit (${timestamp}):** ${append_description}`;
130
172
  }
131
- // Build update body using shared utility (without description since we handle it separately)
173
+ // Build update body without tags (they're handled separately)
132
174
  const updateBody = buildTaskRequestBody({
133
- name, status, priority, due_date, start_date, time_estimate, tags, parent_task_id, assignees
175
+ name, status, priority, due_date, start_date, time_estimate, parent_task_id, assignees
134
176
  });
135
177
  // Add markdown description if we have content to append
136
178
  if (finalDescription !== undefined) {
@@ -140,8 +182,8 @@ function registerTaskToolsWrite(server, userData) {
140
182
  if (assignees !== undefined) {
141
183
  updateBody.assignees = { add: assignees, rem: [] }; // Add new assignees, remove none
142
184
  }
143
- // Check if there's anything to update
144
- if (Object.keys(updateBody).length === 0) {
185
+ // Check if there's anything to update (including tags which were handled separately)
186
+ if (Object.keys(updateBody).length === 0 && tags === undefined) {
145
187
  return {
146
188
  content: [
147
189
  {
@@ -151,23 +193,39 @@ function registerTaskToolsWrite(server, userData) {
151
193
  ],
152
194
  };
153
195
  }
154
- // Update the task
155
- const updateResponse = await fetch(`https://api.clickup.com/api/v2/task/${task_id}`, {
156
- method: 'PUT',
157
- headers: {
158
- Authorization: config_1.CONFIG.apiKey,
159
- 'Content-Type': 'application/json'
160
- },
161
- body: JSON.stringify(updateBody)
162
- });
163
- if (!updateResponse.ok) {
164
- const errorData = await updateResponse.json().catch(() => ({}));
165
- throw new Error(`Error updating task: ${updateResponse.status} ${updateResponse.statusText} - ${JSON.stringify(errorData)}`);
196
+ // Update the task (if there are non-tag updates)
197
+ let updatedTask = taskData;
198
+ if (Object.keys(updateBody).length > 0) {
199
+ const updateResponse = await fetch(`https://api.clickup.com/api/v2/task/${task_id}`, {
200
+ method: 'PUT',
201
+ headers: {
202
+ Authorization: config_1.CONFIG.apiKey,
203
+ 'Content-Type': 'application/json'
204
+ },
205
+ body: JSON.stringify(updateBody)
206
+ });
207
+ if (!updateResponse.ok) {
208
+ const errorData = await updateResponse.json().catch(() => ({}));
209
+ throw new Error(`Error updating task: ${updateResponse.status} ${updateResponse.statusText} - ${JSON.stringify(errorData)}`);
210
+ }
211
+ updatedTask = await updateResponse.json();
212
+ }
213
+ // If only tags were updated, fetch the task again to get the updated state
214
+ if (tags !== undefined && Object.keys(updateBody).length === 0) {
215
+ const refreshResponse = await fetch(`https://api.clickup.com/api/v2/task/${task_id}`, {
216
+ headers: { Authorization: config_1.CONFIG.apiKey },
217
+ });
218
+ if (refreshResponse.ok) {
219
+ updatedTask = await refreshResponse.json();
220
+ }
166
221
  }
167
- const updatedTask = await updateResponse.json();
168
222
  const responseLines = formatTaskResponse(updatedTask, 'updated', {
169
223
  name, append_description, status, priority, due_date, start_date, time_estimate, tags, parent_task_id, assignees
170
224
  }, userData);
225
+ // Add tag update results if any
226
+ if (tagUpdateResults.length > 0) {
227
+ responseLines.push('tag_warnings: ' + tagUpdateResults.join('; '));
228
+ }
171
229
  return {
172
230
  content: [
173
231
  {
@@ -329,9 +387,8 @@ function buildTaskRequestBody(params, currentUserId) {
329
387
  if (params.time_estimate !== undefined) {
330
388
  requestBody.time_estimate = Math.round(params.time_estimate * 60 * 60 * 1000);
331
389
  }
332
- if (params.tags !== undefined && params.tags.length > 0) {
333
- requestBody.tags = params.tags;
334
- }
390
+ // Tags are handled separately via dedicated API endpoints
391
+ // Do not include in the update request body
335
392
  if (params.assignees !== undefined) {
336
393
  requestBody.assignees = params.assignees;
337
394
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hauptsache.net/clickup-mcp",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Search, create, and retrieve tasks, add comments, and track time through natural language commands.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,8 @@
16
16
  "cli": "npx ts-node src/cli.ts",
17
17
  "prettier": "prettier --write src/**/*.ts",
18
18
  "prepublishOnly": "rm -r dist && npm run build",
19
- "release": "npm run build && npm publish --access public && git add . && git commit -m \"Release v$(node -p 'require(\"./package.json\").version')\" && git tag -a v$(node -p 'require(\"./package.json\").version') -m \"Release v$(node -p 'require(\"./package.json\").version')\" && git push && git push --tags"
19
+ "release": "npm run build && npm publish --access public && git add . && git commit -m \"Release v$(node -p 'require(\"./package.json\").version')\" && git tag -a v$(node -p 'require(\"./package.json\").version') -m \"Release v$(node -p 'require(\"./package.json\").version')\" && git push && git push --tags",
20
+ "dxt": "npm run build && npx dxt pack"
20
21
  },
21
22
  "keywords": [
22
23
  "clickup",