@taazkareem/clickup-mcp-server 0.6.7 → 0.6.8
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/README.md +1 -1
- package/build/tools/task/handlers.js +45 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
A Model Context Protocol (MCP) server for integrating ClickUp tasks with AI applications. This server allows AI agents to interact with ClickUp tasks, spaces, lists, and folders through a standardized protocol.
|
|
8
8
|
|
|
9
|
-
> 🚧 **Status Update:** Rolling out v0.6.
|
|
9
|
+
> 🚧 **Status Update:** Rolling out v0.6.7 will add Global Task Lookup with smart disambiguation, Start Date Support for tasks with natural language expressions, Complete Tag Support including natural language tag color commands, Subtasks Support, Custom ID Support, and Logging Fixes
|
|
10
10
|
|
|
11
11
|
## Setup
|
|
12
12
|
|
|
@@ -21,6 +21,8 @@ const { task: taskService, list: listService } = clickUpServices;
|
|
|
21
21
|
const bulkService = new BulkService(taskService);
|
|
22
22
|
// Create a logger instance for task handlers
|
|
23
23
|
const logger = new Logger('TaskHandlers');
|
|
24
|
+
// Token limit constant for workspace tasks
|
|
25
|
+
const WORKSPACE_TASKS_TOKEN_LIMIT = 50000;
|
|
24
26
|
// Cache for task context between sequential operations
|
|
25
27
|
const taskContextCache = new Map();
|
|
26
28
|
const TASK_CONTEXT_TTL = 5 * 60 * 1000; // 5 minutes
|
|
@@ -446,6 +448,39 @@ export async function createTaskCommentHandler(params) {
|
|
|
446
448
|
throw error;
|
|
447
449
|
}
|
|
448
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* Estimate tokens for a task response
|
|
453
|
+
* This is a simplified estimation - adjust based on actual token counting needs
|
|
454
|
+
*/
|
|
455
|
+
function estimateTaskResponseTokens(task) {
|
|
456
|
+
// Base estimation for task structure
|
|
457
|
+
let tokenCount = 0;
|
|
458
|
+
// Core fields
|
|
459
|
+
tokenCount += (task.name?.length || 0) / 4; // Approximate tokens for name
|
|
460
|
+
tokenCount += (task.description?.length || 0) / 4; // Approximate tokens for description
|
|
461
|
+
tokenCount += (task.text_content?.length || 0) / 4; // Use text_content instead of markdown_description
|
|
462
|
+
// Status and other metadata
|
|
463
|
+
tokenCount += 5; // Basic metadata fields
|
|
464
|
+
// Custom fields
|
|
465
|
+
if (task.custom_fields) {
|
|
466
|
+
tokenCount += Object.keys(task.custom_fields).length * 10; // Rough estimate per custom field
|
|
467
|
+
}
|
|
468
|
+
// Add overhead for JSON structure
|
|
469
|
+
tokenCount *= 1.1;
|
|
470
|
+
return Math.ceil(tokenCount);
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Check if response would exceed token limit
|
|
474
|
+
*/
|
|
475
|
+
function wouldExceedTokenLimit(response) {
|
|
476
|
+
if (!response.tasks?.length)
|
|
477
|
+
return false;
|
|
478
|
+
// Calculate total estimated tokens
|
|
479
|
+
const totalTokens = response.tasks.reduce((sum, task) => sum + estimateTaskResponseTokens(task), 0);
|
|
480
|
+
// Add overhead for response structure
|
|
481
|
+
const estimatedTotal = totalTokens * 1.1;
|
|
482
|
+
return estimatedTotal > WORKSPACE_TASKS_TOKEN_LIMIT;
|
|
483
|
+
}
|
|
449
484
|
/**
|
|
450
485
|
* Handler for getting workspace tasks with filtering
|
|
451
486
|
*/
|
|
@@ -495,6 +530,16 @@ export async function getWorkspaceTasksHandler(taskService, params) {
|
|
|
495
530
|
};
|
|
496
531
|
// Get tasks with adaptive response format support
|
|
497
532
|
const response = await taskService.getWorkspaceTasks(filters);
|
|
533
|
+
// Check token limit at handler level
|
|
534
|
+
if (params.detail_level !== 'summary' && wouldExceedTokenLimit(response)) {
|
|
535
|
+
logger.info('Response would exceed token limit, fetching summary format instead');
|
|
536
|
+
// Refetch with summary format
|
|
537
|
+
const summaryResponse = await taskService.getWorkspaceTasks({
|
|
538
|
+
...filters,
|
|
539
|
+
detail_level: 'summary'
|
|
540
|
+
});
|
|
541
|
+
return summaryResponse;
|
|
542
|
+
}
|
|
498
543
|
// Return the response without adding the redundant _note field
|
|
499
544
|
return response;
|
|
500
545
|
}
|
package/package.json
CHANGED