@taazkareem/clickup-mcp-server 0.4.31 → 0.4.41

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 (2) hide show
  1. package/build/index.js +74 -216
  2. package/package.json +2 -2
package/build/index.js CHANGED
@@ -7,228 +7,86 @@
7
7
  *
8
8
  * @module clickup-mcp-server
9
9
  */
10
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
10
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
11
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
12
+ import { z } from 'zod';
12
13
  import { ClickUpService } from "./services/clickup.js";
13
14
  import config from "./config.js";
14
- import { handleWorkspaceHierarchy, handleCreateTask, handleCreateBulkTasks, handleCreateList, handleCreateFolder, handleCreateListInFolder } from "./handlers/tools.js";
15
- import { handleSummarizeTasks, handleAnalyzeTaskPriorities } from "./handlers/prompts.js";
16
- import { logError, logInfo, logDebug } from "./utils/logger.js";
17
- import { z } from 'zod';
18
- // Set up global error handlers
19
- process.on('uncaughtException', (error) => {
20
- logError('server.uncaught', error);
21
- process.exit(1);
22
- });
23
- process.on('unhandledRejection', (reason) => {
24
- logError('server.unhandled_rejection', reason);
25
- process.exit(1);
26
- });
27
- logInfo('server', { status: 'starting' });
28
- logInfo('config', {
29
- clickupApiKey: config.clickupApiKey ? '***' : 'missing',
30
- teamId: config.teamId || 'missing'
31
- });
32
- // Initialize ClickUp service singleton
33
- let clickup;
34
- try {
35
- logDebug('clickup', { status: 'initializing' });
36
- clickup = ClickUpService.initialize(config.clickupApiKey);
37
- logInfo('clickup', { status: 'initialized' });
38
- }
39
- catch (error) {
40
- logError('clickup.initialization', error);
41
- process.exit(1);
42
- }
43
- // Create and configure the MCP server instance
44
- logDebug('mcp', { status: 'creating' });
45
- const mcpServer = new McpServer({
46
- name: "clickup-mcp-server",
47
- version: "0.4.30"
48
- });
49
- // Register a simple test tool first to verify functionality
50
- mcpServer.tool('ping', 'A simple ping tool that returns pong', {}, async () => {
51
- return {
52
- content: [{
53
- type: "text",
54
- text: "pong"
55
- }]
56
- };
57
- });
58
- // Tool schemas as raw shapes
59
- const workspaceHierarchySchema = {
60
- teamId: z.string().optional()
61
- };
62
- const taskSchema = {
63
- name: z.string(),
64
- description: z.string().optional(),
65
- status: z.string().optional(),
66
- priority: z.number().optional(),
67
- dueDate: z.string().optional(),
68
- listId: z.string().optional(),
69
- listName: z.string().optional()
70
- };
71
- const bulkTasksSchema = {
72
- tasks: z.array(z.object(taskSchema)),
73
- listId: z.string().optional(),
74
- listName: z.string().optional()
75
- };
76
- const listSchema = {
77
- name: z.string(),
78
- spaceId: z.string().optional(),
79
- spaceName: z.string().optional(),
80
- content: z.string().optional()
81
- };
82
- const folderSchema = {
83
- name: z.string(),
84
- spaceId: z.string().optional(),
85
- spaceName: z.string().optional(),
86
- override_statuses: z.boolean().optional()
87
- };
88
- const listInFolderSchema = {
89
- name: z.string(),
90
- folderId: z.string().optional(),
91
- folderName: z.string().optional(),
92
- spaceId: z.string().optional(),
93
- spaceName: z.string().optional(),
94
- content: z.string().optional()
95
- };
96
- // Register tools with proper schemas
97
- mcpServer.tool('workspace_hierarchy', 'List complete hierarchy of the ClickUp workspace', workspaceHierarchySchema, async (args) => {
98
- const result = await handleWorkspaceHierarchy(clickup, config.teamId);
99
- return {
100
- content: [{
101
- type: "text",
102
- text: JSON.stringify(result, null, 2)
103
- }]
104
- };
105
- });
106
- mcpServer.tool('create_task', 'Create a new task in ClickUp', taskSchema, async (args) => {
107
- const result = await handleCreateTask(clickup, config.teamId, args);
108
- return {
109
- content: [{
110
- type: "text",
111
- text: JSON.stringify(result, null, 2)
112
- }]
113
- };
114
- });
115
- mcpServer.tool('create_bulk_tasks', 'Create multiple tasks simultaneously in a list', bulkTasksSchema, async (args) => {
116
- const result = await handleCreateBulkTasks(clickup, config.teamId, args);
117
- return {
118
- content: [{
119
- type: "text",
120
- text: JSON.stringify(result, null, 2)
121
- }]
122
- };
123
- });
124
- mcpServer.tool('create_list', 'Create a new list in a space', listSchema, async (args) => {
125
- const result = await handleCreateList(clickup, config.teamId, args);
126
- return {
127
- content: [{
128
- type: "text",
129
- text: JSON.stringify(result, null, 2)
130
- }]
131
- };
132
- });
133
- mcpServer.tool('create_folder', 'Create a new folder in a space', folderSchema, async (args) => {
134
- const result = await handleCreateFolder(clickup, config.teamId, args);
135
- return {
136
- content: [{
137
- type: "text",
138
- text: JSON.stringify(result, null, 2)
139
- }]
140
- };
141
- });
142
- mcpServer.tool('create_list_in_folder', 'Create a new list within a folder', listInFolderSchema, async (args) => {
143
- const result = await handleCreateListInFolder(clickup, config.teamId, args);
144
- return {
145
- content: [{
146
- type: "text",
147
- text: JSON.stringify(result, null, 2)
148
- }]
149
- };
150
- });
151
- // Register prompts with descriptions
152
- mcpServer.prompt('summarize_tasks', 'Provide a comprehensive summary of tasks', async () => {
153
- const summary = await handleSummarizeTasks(clickup, config.teamId);
154
- return {
155
- messages: [{
156
- role: 'assistant',
157
- content: {
15
+ import { handleWorkspaceHierarchy, handleCreateTask } from "./handlers/tools.js";
16
+ async function main() {
17
+ // Initialize ClickUp service
18
+ const clickup = ClickUpService.initialize(config.clickupApiKey);
19
+ console.log('Creating MCP server...');
20
+ const server = new McpServer({
21
+ name: "clickup",
22
+ version: "0.1.0",
23
+ capabilities: {
24
+ resources: { listChanged: true },
25
+ tools: { listChanged: true },
26
+ prompts: { listChanged: true },
27
+ }
28
+ });
29
+ console.log('MCP server created');
30
+ // Add a simple ping tool
31
+ server.tool('ping', 'A simple ping tool that returns pong', {}, async () => {
32
+ return {
33
+ content: [{
158
34
  type: 'text',
159
- text: summary
160
- }
161
- }],
162
- description: 'Task Summary'
163
- };
164
- });
165
- mcpServer.prompt('analyze_task_priorities', 'Analyze task priorities and provide recommendations', async () => {
166
- const analysis = await handleAnalyzeTaskPriorities(clickup, config.teamId);
167
- return {
168
- messages: [{
169
- role: 'assistant',
170
- content: {
35
+ text: 'pong'
36
+ }]
37
+ };
38
+ });
39
+ // Add workspace hierarchy tool
40
+ server.tool('workspace_hierarchy', 'List complete hierarchy of the ClickUp workspace', {}, async () => {
41
+ const result = await handleWorkspaceHierarchy(clickup, config.teamId);
42
+ return {
43
+ content: [{
171
44
  type: 'text',
172
- text: analysis
173
- }
174
- }],
175
- description: 'Priority Analysis'
176
- };
177
- });
178
- // TODO: Implement resource handler properly after consulting MCP SDK documentation
179
- // Resource handler temporarily disabled due to type issues
180
- /*
181
- mcpServer.resource(
182
- 'clickup',
183
- 'clickup://task/{id}',
184
- async (uri: URL) => {
185
- try {
186
- const taskId = uri.pathname.split('/').pop() || '';
187
- const task = await clickup.getTask(taskId);
188
- return {
189
- uri: uri.toString(),
190
- mimeType: "application/json",
191
- text: JSON.stringify(task, null, 2),
192
- tags: []
193
- };
194
- } catch (error) {
195
- logError('resources.read', error);
196
- throw error;
197
- }
198
- }
199
- );
200
- */
201
- // Server startup logic
202
- if (process.argv.includes('--stdio')) {
203
- logInfo('server', { status: 'stdio.starting' });
45
+ text: JSON.stringify(result, null, 2)
46
+ }]
47
+ };
48
+ });
49
+ // Add create task tool
50
+ server.tool('create_task', 'Create a new task in ClickUp', {
51
+ name: z.string(),
52
+ description: z.string().optional(),
53
+ status: z.string().optional(),
54
+ priority: z.number().optional(),
55
+ dueDate: z.string().optional(),
56
+ listId: z.string().optional(),
57
+ listName: z.string().optional()
58
+ }, async (args) => {
59
+ const taskData = {
60
+ name: args.name,
61
+ description: args.description,
62
+ status: args.status,
63
+ priority: args.priority,
64
+ due_date: args.dueDate,
65
+ listId: args.listId,
66
+ listName: args.listName
67
+ };
68
+ const result = await handleCreateTask(clickup, config.teamId, taskData);
69
+ return {
70
+ content: [{
71
+ type: 'text',
72
+ text: JSON.stringify(result, null, 2)
73
+ }]
74
+ };
75
+ });
204
76
  // Create stdio transport
205
77
  const transport = new StdioServerTransport();
206
- // Connect server with better error handling
207
- mcpServer.server.connect(transport)
208
- .then(() => {
209
- logInfo('server', { status: 'connected' });
210
- logInfo('server', { status: 'ready' });
211
- // Keep the process alive
212
- process.stdin.resume();
213
- // Handle process termination
214
- process.on('SIGINT', () => {
215
- logInfo('server', { status: 'shutdown.sigint' });
216
- transport.close();
217
- process.exit(0);
218
- });
219
- process.on('SIGTERM', () => {
220
- logInfo('server', { status: 'shutdown.sigterm' });
221
- transport.close();
222
- process.exit(0);
223
- });
224
- })
225
- .catch(error => {
226
- logError('server', error);
78
+ // Connect to the transport
79
+ try {
80
+ await server.server.connect(transport);
81
+ console.error('Server started successfully'); // Using stderr for logging
82
+ }
83
+ catch (error) {
84
+ console.error('Failed to start server:', error);
227
85
  process.exit(1);
228
- });
86
+ }
229
87
  }
230
- // Note: Non-stdio initialization removed as it was unused
231
- // Prevent unhandled promise rejections from crashing the server
232
- process.on('unhandledRejection', (error) => {
233
- logError('server.unhandled', error);
88
+ // Start the server
89
+ main().catch(error => {
90
+ console.error('Unhandled error:', error);
91
+ process.exit(1);
234
92
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taazkareem/clickup-mcp-server",
3
- "version": "0.4.31",
3
+ "version": "0.4.41",
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",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "homepage": "https://github.com/taazkareem/clickup-mcp-server#readme",
44
44
  "dependencies": {
45
- "@modelcontextprotocol/sdk": "^1.5.0",
45
+ "@modelcontextprotocol/sdk": "^1.0.1",
46
46
  "@modelcontextprotocol/server-github": "^2025.1.23",
47
47
  "axios": "^1.6.7",
48
48
  "dotenv": "^16.4.1",