@taazkareem/clickup-mcp-server 0.6.9 → 0.7.0

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.
@@ -1,39 +0,0 @@
1
- /**
2
- * Parameter Processing Utilities
3
- *
4
- * Utilities for processing MCP tool parameters, especially handling
5
- * JSON string conversion for array and object parameters.
6
- */
7
- import { Logger } from '../logger.js';
8
- // Create a logger instance
9
- const logger = new Logger('ParamsUtils');
10
- /**
11
- * Process parameters that might contain JSON strings
12
- * Handles cases where the MCP protocol sends stringified JSON for array or object parameters
13
- *
14
- * @param params The raw parameters received from the MCP tool call
15
- * @returns Processed parameters with JSON strings parsed to objects/arrays
16
- */
17
- export function processParams(params) {
18
- if (!params)
19
- return {};
20
- const result = { ...params };
21
- // Process special parameters that could be JSON strings
22
- const jsonFields = ['tasks', 'options'];
23
- for (const field of jsonFields) {
24
- if (typeof result[field] === 'string') {
25
- try {
26
- if ((result[field].startsWith('[') && result[field].endsWith(']')) ||
27
- (result[field].startsWith('{') && result[field].endsWith('}'))) {
28
- result[field] = JSON.parse(result[field]);
29
- logger.debug(`Parsed JSON parameter: ${field}`);
30
- }
31
- }
32
- catch (error) {
33
- logger.error(`Failed to parse JSON for ${field}`, { error });
34
- // Keep original string if parse fails
35
- }
36
- }
37
- }
38
- return result;
39
- }
@@ -1,100 +0,0 @@
1
- /**
2
- * Sponsor Analytics Module
3
- *
4
- * This module provides analytics tracking for sponsor messages, including:
5
- * - Impression tracking
6
- * - URL tracking
7
- * - Analytics aggregation
8
- */
9
- import { Logger } from '../logger.js';
10
- import config from '../config.js';
11
- // Create logger instance for this module
12
- const logger = new Logger('SponsorAnalytics');
13
- // Initialize analytics storage
14
- const analytics = {
15
- impressions: {
16
- total: 0,
17
- byEndpoint: {},
18
- byDate: {}
19
- },
20
- urlClicks: {
21
- total: 0,
22
- byUrl: {}
23
- }
24
- };
25
- /**
26
- * Track a sponsor message impression
27
- * @param endpoint The endpoint/operation where the message was shown
28
- */
29
- export function trackImpression(endpoint) {
30
- if (!config.enableSponsorMessage)
31
- return;
32
- const today = new Date().toISOString().split('T')[0];
33
- // Update total impressions
34
- analytics.impressions.total++;
35
- // Update impressions by endpoint
36
- analytics.impressions.byEndpoint[endpoint] =
37
- (analytics.impressions.byEndpoint[endpoint] || 0) + 1;
38
- // Update impressions by date
39
- analytics.impressions.byDate[today] =
40
- (analytics.impressions.byDate[today] || 0) + 1;
41
- logger.debug('Sponsor message impression tracked', {
42
- endpoint,
43
- total: analytics.impressions.total,
44
- endpointTotal: analytics.impressions.byEndpoint[endpoint],
45
- dateTotal: analytics.impressions.byDate[today]
46
- });
47
- }
48
- /**
49
- * Generate a tracking URL for the sponsor link
50
- * @param originalUrl The original sponsor URL
51
- * @param source The source/endpoint that generated the URL
52
- * @returns Tracking URL
53
- */
54
- export function generateTrackingUrl(originalUrl, source) {
55
- // Add UTM parameters for tracking
56
- const url = new URL(originalUrl);
57
- // If it's a GitHub profile URL, modify it to be a sponsor URL
58
- if (url.pathname === '/taazkareem') {
59
- url.pathname = '/sponsors/taazkareem';
60
- }
61
- // Add minimal tracking parameters
62
- url.searchParams.set('ref', source);
63
- return url.toString();
64
- }
65
- /**
66
- * Track a sponsor URL click (called when tracking URL is generated)
67
- * @param url The tracking URL that was generated
68
- */
69
- export function trackUrlGenerated(url) {
70
- if (!config.enableSponsorMessage)
71
- return;
72
- // Update total clicks
73
- analytics.urlClicks.total++;
74
- // Update clicks by URL
75
- analytics.urlClicks.byUrl[url] =
76
- (analytics.urlClicks.byUrl[url] || 0) + 1;
77
- logger.debug('Sponsor URL tracking link generated', {
78
- url,
79
- total: analytics.urlClicks.total,
80
- urlTotal: analytics.urlClicks.byUrl[url]
81
- });
82
- }
83
- /**
84
- * Get current analytics data
85
- * @returns Copy of current analytics data
86
- */
87
- export function getAnalytics() {
88
- return JSON.parse(JSON.stringify(analytics));
89
- }
90
- /**
91
- * Reset analytics data
92
- */
93
- export function resetAnalytics() {
94
- analytics.impressions.total = 0;
95
- analytics.impressions.byEndpoint = {};
96
- analytics.impressions.byDate = {};
97
- analytics.urlClicks.total = 0;
98
- analytics.urlClicks.byUrl = {};
99
- logger.info('Sponsor analytics data reset');
100
- }
@@ -1,57 +0,0 @@
1
- /**
2
- * Sponsor Utility Functions
3
- *
4
- * This module provides utilities for adding sponsor information to responses.
5
- */
6
- import config from '../config.js';
7
- import { trackImpression, generateTrackingUrl, trackUrlGenerated } from './sponsor-analytics.js';
8
- /**
9
- * Generate a sponsor message to be included in task responses
10
- *
11
- * @param source The source/endpoint requesting the sponsor message
12
- * @returns Object containing sponsor message and URL, or null if sponsor messages are disabled
13
- */
14
- export function getSponsorMessage(source = 'unknown') {
15
- // Skip if sponsor message is disabled
16
- if (!config.enableSponsorMessage) {
17
- return null;
18
- }
19
- // Generate tracking URL
20
- const trackingUrl = generateTrackingUrl(config.sponsorUrl, source);
21
- trackUrlGenerated(trackingUrl);
22
- return {
23
- message: "❤️ Support this project: If you find this integration valuable, please consider sponsoring the developer.",
24
- url: trackingUrl
25
- };
26
- }
27
- /**
28
- * Enhances a task response with sponsor information if enabled
29
- *
30
- * @param taskResponse The original task response to enhance
31
- * @param source The source/endpoint of the response
32
- * @returns Enhanced task response with sponsor information
33
- */
34
- export function enhanceResponseWithSponsor(taskResponse, source = 'unknown') {
35
- // Skip if sponsor message is disabled
36
- if (!config.enableSponsorMessage) {
37
- return taskResponse;
38
- }
39
- const sponsorInfo = getSponsorMessage(source);
40
- if (!sponsorInfo) {
41
- return taskResponse;
42
- }
43
- // Track the impression
44
- trackImpression(source);
45
- // Create a new response with sponsor information
46
- const enhancedResponse = {
47
- ...taskResponse,
48
- content: [
49
- ...(taskResponse.content || []),
50
- {
51
- type: "text",
52
- text: `\n\n${sponsorInfo.message}\n${sponsorInfo.url}`
53
- }
54
- ]
55
- };
56
- return enhancedResponse;
57
- }