@taazkareem/clickup-mcp-server
Version:
ClickUp MCP Server - Integrate ClickUp tasks with AI through Model Context Protocol
88 lines (87 loc) • 3.02 kB
JavaScript
/**
* SPDX-FileCopyrightText: © 2025 Talib Kareem <taazkareem@icloud.com>
* SPDX-License-Identifier: MIT
*
* ClickUp MCP Server
*
* This custom server implements the Model Context Protocol (MCP) specification to enable
* AI applications to interact with ClickUp workspaces. It provides a standardized
* interface for managing tasks, lists, folders and other ClickUp entities using Natural Language.
*
* Key Features:
* - Complete task management (CRUD operations, moving, duplicating)
* - Workspace organization (spaces, folders, lists)
* - Bulk operations with concurrent processing
* - Natural language date parsing
* - File attachments support
* - Name-based entity resolution
* - Markdown formatting
* - Built-in rate limiting
* - Multiple transport options (STDIO, SSE, HTTP Streamable)
*
* For full documentation and usage examples, please refer to the README.md file.
*/
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { configureServer, server } from './server.js';
import { info, error } from './logger.js';
import config from './config.js';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { startSSEServer } from './sse_server.js';
// Get directory name for module paths
const __dirname = dirname(fileURLToPath(import.meta.url));
// Handle uncaught exceptions
process.on('uncaughtException', (err) => {
error("Uncaught Exception", { message: err.message, stack: err.stack });
process.exit(1);
});
// Handle unhandled promise rejections
process.on('unhandledRejection', (reason, promise) => {
error("Unhandled Rejection", { reason });
process.exit(1);
});
async function startStdioServer() {
info('Starting ClickUp MCP Server...');
// Log essential information about the environment
info('Server environment', {
pid: process.pid,
node: process.version,
os: process.platform,
arch: process.arch,
});
// Configure the server with all handlers
info('Configuring server request handlers');
await configureServer();
// Connect using stdio transport
info('Connecting to MCP stdio transport');
const transport = new StdioServerTransport();
await server.connect(transport);
info('Server startup complete - ready to handle requests');
}
/**
* Application entry point that configures and starts the MCP server.
*/
async function main() {
try {
if (config.enableSSE) {
// Start the new SSE server with HTTP Streamable support
startSSEServer();
}
else {
// Start the traditional STDIO server
await startStdioServer();
}
}
catch (err) {
error('Error during server startup', {
message: err.message,
stack: err.stack,
});
process.exit(1);
}
}
main().catch((err) => {
error("Unhandled server error", { message: err.message, stack: err.stack });
process.exit(1);
});