@taazkareem/clickup-mcp-server 0.4.63 → 0.4.65

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.
@@ -239,15 +239,6 @@ export class BaseClickUpService {
239
239
  * @param details - Details about the operation
240
240
  */
241
241
  logOperation(operation, details) {
242
- // This could be enhanced to use a proper logging framework
243
- console.log(`[ClickUpService] ${operation}:`, details);
244
- }
245
- /**
246
- * Protected helper method to check if cache is available
247
- * @param cacheService Optional cache service instance
248
- * @returns True if caching is available and enabled
249
- */
250
- isCacheEnabled(cacheService) {
251
- return !!cacheService && typeof cacheService.isEnabled === 'function' && cacheService.isEnabled();
242
+ console.log(`[${new Date().toISOString()}] ${operation}:`, details);
252
243
  }
253
244
  }
@@ -13,13 +13,11 @@ export { WorkspaceService } from './workspace.js';
13
13
  export { TaskService } from './task.js';
14
14
  export { ListService } from './list.js';
15
15
  export { FolderService } from './folder.js';
16
- export { InitializationService } from './initialization.js';
17
16
  // Import service classes for the factory function
18
17
  import { WorkspaceService } from './workspace.js';
19
18
  import { TaskService } from './task.js';
20
19
  import { ListService } from './list.js';
21
20
  import { FolderService } from './folder.js';
22
- import { InitializationService } from './initialization.js';
23
21
  /**
24
22
  * Factory function to create instances of all ClickUp services
25
23
  * @param config Configuration for the services
@@ -33,11 +31,6 @@ export function createClickUpServices(config) {
33
31
  workspace: workspaceService,
34
32
  task: new TaskService(apiKey, teamId, baseUrl, workspaceService),
35
33
  list: new ListService(apiKey, teamId, baseUrl, workspaceService),
36
- folder: new FolderService(apiKey, teamId, baseUrl, workspaceService),
37
- initialization: new InitializationService({
38
- apiKey,
39
- teamId,
40
- baseUrl
41
- })
34
+ folder: new FolderService(apiKey, teamId, baseUrl, workspaceService)
42
35
  };
43
36
  }
@@ -99,7 +99,7 @@ export class WorkspaceService extends BaseClickUpService {
99
99
  */
100
100
  async getWorkspaceHierarchy(forceRefresh = false) {
101
101
  try {
102
- // If we have a cached result and not forcing refresh, return it
102
+ // If we have the hierarchy in memory and not forcing refresh, return it
103
103
  if (this.workspaceHierarchy && !forceRefresh) {
104
104
  return this.workspaceHierarchy;
105
105
  }
@@ -164,9 +164,9 @@ export class WorkspaceService extends BaseClickUpService {
164
164
  }
165
165
  }
166
166
  /**
167
- * Invalidate the workspace hierarchy cache
167
+ * Clear the stored workspace hierarchy, forcing a fresh fetch on next request
168
168
  */
169
- invalidateWorkspaceCache() {
169
+ clearWorkspaceHierarchy() {
170
170
  this.workspaceHierarchy = null;
171
171
  }
172
172
  /**
@@ -50,71 +50,32 @@ export async function handleGetWorkspaceHierarchy() {
50
50
  */
51
51
  function formatHierarchyResponse(hierarchy) {
52
52
  try {
53
- // Helper function to format nodes by type
54
- const formatNodesByType = (nodes = []) => {
55
- const result = {
56
- spaces: [],
57
- folders: [],
58
- lists: []
59
- };
60
- for (const node of nodes) {
61
- if (node.type === 'space') {
62
- const spaceResult = {
63
- id: node.id,
64
- name: node.name,
65
- type: node.type,
66
- lists: [],
67
- folders: []
68
- };
69
- // Process children of space
70
- if (node.children && node.children.length > 0) {
71
- const childrenByType = formatNodesByType(node.children);
72
- spaceResult.lists = childrenByType.lists;
73
- spaceResult.folders = childrenByType.folders;
74
- }
75
- result.spaces.push(spaceResult);
76
- }
77
- else if (node.type === 'folder') {
78
- const folderResult = {
79
- id: node.id,
80
- name: node.name,
81
- type: node.type,
82
- lists: []
83
- };
84
- // Process children of folder (only lists)
85
- if (node.children && node.children.length > 0) {
86
- folderResult.lists = node.children
87
- .filter(child => child.type === 'list')
88
- .map(list => ({
89
- id: list.id,
90
- name: list.name,
91
- type: list.type
92
- }));
93
- }
94
- result.folders.push(folderResult);
95
- }
96
- else if (node.type === 'list') {
97
- result.lists.push({
98
- id: node.id,
99
- name: node.name,
100
- type: node.type
101
- });
102
- }
103
- }
104
- return result;
105
- };
106
- // Convert the workspace hierarchy to a simplified format
107
- const rootChildren = formatNodesByType(hierarchy.root.children);
108
- const formattedHierarchy = {
109
- workspaceId: hierarchy.root.id,
110
- workspaceName: hierarchy.root.name,
111
- spaces: rootChildren.spaces
53
+ // Helper function to format a node and its children as a tree
54
+ const formatNodeAsTree = (node, level = 0, isLast = true, parentPrefix = '') => {
55
+ const lines = [];
56
+ // Calculate the current line's prefix
57
+ const currentPrefix = level === 0 ? '' : parentPrefix + (isLast ? '└── ' : '├── ');
58
+ // Format current node with descriptive ID type
59
+ const idType = 'type' in node ? `${node.type.charAt(0).toUpperCase() + node.type.slice(1)} ID` : 'Workspace ID';
60
+ lines.push(`${currentPrefix}${node.name} (${idType}: ${node.id})`);
61
+ // Calculate the prefix for children
62
+ const childPrefix = level === 0 ? '' : parentPrefix + (isLast ? ' ' : '│ ');
63
+ // Process children
64
+ const children = node.children || [];
65
+ children.forEach((child, index) => {
66
+ const childLines = formatNodeAsTree(child, level + 1, index === children.length - 1, childPrefix);
67
+ lines.push(...childLines);
68
+ });
69
+ return lines;
112
70
  };
71
+ // Generate tree representation
72
+ const treeLines = formatNodeAsTree(hierarchy.root);
73
+ const treeOutput = treeLines.join('\n');
113
74
  return {
114
75
  content: [
115
76
  {
116
77
  type: "text",
117
- text: JSON.stringify(formattedHierarchy, null, 2)
78
+ text: treeOutput
118
79
  }
119
80
  ]
120
81
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taazkareem/clickup-mcp-server",
3
- "version": "0.4.63",
3
+ "version": "0.4.65",
4
4
  "description": "ClickUp MCP Server - Integrate ClickUp tasks with AI through Model Context Protocol",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -18,9 +18,7 @@
18
18
  "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
19
19
  "start": "node build/index.js",
20
20
  "dev": "tsc -w",
21
- "prepare": "npm run build",
22
- "prepublishOnly": "npm test",
23
- "test": "echo \"No tests specified\" && exit 0"
21
+ "prepare": "npm run build"
24
22
  },
25
23
  "keywords": [
26
24
  "clickup",
@@ -1,28 +0,0 @@
1
- import { WorkspaceService } from "./workspace.js";
2
- /**
3
- * Service responsible for initializing the server state
4
- * Handles preloading workspace data
5
- */
6
- export class InitializationService {
7
- constructor(config) {
8
- // Create workspace service
9
- this.workspaceService = new WorkspaceService(config.apiKey, config.teamId, config.baseUrl);
10
- }
11
- /**
12
- * Preload workspace hierarchy data on server startup
13
- * This loads the entire workspace tree for faster initial access
14
- */
15
- async preloadWorkspaceData() {
16
- try {
17
- console.log("Preloading workspace data...");
18
- const startTime = Date.now();
19
- // Force refresh to get the latest data
20
- await this.workspaceService.getWorkspaceHierarchy(true);
21
- const duration = (Date.now() - startTime) / 1000;
22
- console.log(`Workspace data preloaded successfully in ${duration.toFixed(2)}s`);
23
- }
24
- catch (error) {
25
- console.error("Failed to preload workspace data:", error);
26
- }
27
- }
28
- }