motionmcp 1.0.2 → 2.1.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.
- package/LICENSE +202 -0
- package/README.md +241 -450
- package/dist/handlers/CommentHandler.d.ts +9 -0
- package/dist/handlers/CommentHandler.d.ts.map +1 -0
- package/dist/handlers/CommentHandler.js +66 -0
- package/dist/handlers/CommentHandler.js.map +1 -0
- package/dist/handlers/CustomFieldHandler.d.ts +14 -0
- package/dist/handlers/CustomFieldHandler.d.ts.map +1 -0
- package/dist/handlers/CustomFieldHandler.js +95 -0
- package/dist/handlers/CustomFieldHandler.js.map +1 -0
- package/dist/handlers/HandlerFactory.d.ts +15 -0
- package/dist/handlers/HandlerFactory.d.ts.map +1 -0
- package/dist/handlers/HandlerFactory.js +58 -0
- package/dist/handlers/HandlerFactory.js.map +1 -0
- package/dist/handlers/ProjectHandler.d.ts +10 -0
- package/dist/handlers/ProjectHandler.d.ts.map +1 -0
- package/dist/handlers/ProjectHandler.js +63 -0
- package/dist/handlers/ProjectHandler.js.map +1 -0
- package/dist/handlers/RecurringTaskHandler.d.ts +10 -0
- package/dist/handlers/RecurringTaskHandler.d.ts.map +1 -0
- package/dist/handlers/RecurringTaskHandler.js +68 -0
- package/dist/handlers/RecurringTaskHandler.js.map +1 -0
- package/dist/handlers/ScheduleHandler.d.ts +8 -0
- package/dist/handlers/ScheduleHandler.d.ts.map +1 -0
- package/dist/handlers/ScheduleHandler.js +43 -0
- package/dist/handlers/ScheduleHandler.js.map +1 -0
- package/dist/handlers/SearchHandler.d.ts +10 -0
- package/dist/handlers/SearchHandler.d.ts.map +1 -0
- package/dist/handlers/SearchHandler.js +116 -0
- package/dist/handlers/SearchHandler.js.map +1 -0
- package/dist/handlers/StatusHandler.d.ts +8 -0
- package/dist/handlers/StatusHandler.d.ts.map +1 -0
- package/dist/handlers/StatusHandler.js +22 -0
- package/dist/handlers/StatusHandler.js.map +1 -0
- package/dist/handlers/TaskHandler.d.ts +22 -0
- package/dist/handlers/TaskHandler.d.ts.map +1 -0
- package/dist/handlers/TaskHandler.js +324 -0
- package/dist/handlers/TaskHandler.js.map +1 -0
- package/dist/handlers/UserHandler.d.ts +9 -0
- package/dist/handlers/UserHandler.d.ts.map +1 -0
- package/dist/handlers/UserHandler.js +36 -0
- package/dist/handlers/UserHandler.js.map +1 -0
- package/dist/handlers/WorkspaceHandler.d.ts +10 -0
- package/dist/handlers/WorkspaceHandler.d.ts.map +1 -0
- package/dist/handlers/WorkspaceHandler.js +49 -0
- package/dist/handlers/WorkspaceHandler.js.map +1 -0
- package/dist/handlers/base/BaseHandler.d.ts +16 -0
- package/dist/handlers/base/BaseHandler.d.ts.map +1 -0
- package/dist/handlers/base/BaseHandler.js +31 -0
- package/dist/handlers/base/BaseHandler.js.map +1 -0
- package/dist/handlers/base/HandlerInterface.d.ts +18 -0
- package/dist/handlers/base/HandlerInterface.d.ts.map +1 -0
- package/dist/handlers/base/HandlerInterface.js +3 -0
- package/dist/handlers/base/HandlerInterface.js.map +1 -0
- package/dist/handlers/index.d.ts +14 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +31 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/mcp-server.d.ts +15 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +145 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/schemas/motion.d.ts +4971 -0
- package/dist/schemas/motion.d.ts.map +1 -0
- package/dist/schemas/motion.js +328 -0
- package/dist/schemas/motion.js.map +1 -0
- package/dist/services/motionApi.d.ts +199 -0
- package/dist/services/motionApi.d.ts.map +1 -0
- package/dist/services/motionApi.js +1950 -0
- package/dist/services/motionApi.js.map +1 -0
- package/dist/tools/ToolConfigurator.d.ts +19 -0
- package/dist/tools/ToolConfigurator.d.ts.map +1 -0
- package/dist/tools/ToolConfigurator.js +89 -0
- package/dist/tools/ToolConfigurator.js.map +1 -0
- package/dist/tools/ToolDefinitions.d.ts +25 -0
- package/dist/tools/ToolDefinitions.d.ts.map +1 -0
- package/dist/tools/ToolDefinitions.js +508 -0
- package/dist/tools/ToolDefinitions.js.map +1 -0
- package/dist/tools/ToolRegistry.d.ts +16 -0
- package/dist/tools/ToolRegistry.d.ts.map +1 -0
- package/dist/tools/ToolRegistry.js +89 -0
- package/dist/tools/ToolRegistry.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +21 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types/mcp-tool-args.d.ts +123 -0
- package/dist/types/mcp-tool-args.d.ts.map +1 -0
- package/dist/types/mcp-tool-args.js +7 -0
- package/dist/types/mcp-tool-args.js.map +1 -0
- package/dist/types/mcp.d.ts +32 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +3 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/motion.d.ts +304 -0
- package/dist/types/motion.d.ts.map +1 -0
- package/dist/types/motion.js +3 -0
- package/dist/types/motion.js.map +1 -0
- package/dist/utils/cache.d.ts +25 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +135 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/constants.d.ts +88 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +188 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/errorHandling.d.ts +50 -0
- package/dist/utils/errorHandling.d.ts.map +1 -0
- package/dist/utils/errorHandling.js +86 -0
- package/dist/utils/errorHandling.js.map +1 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +38 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +13 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +47 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/pagination.d.ts +61 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +168 -0
- package/dist/utils/pagination.js.map +1 -0
- package/dist/utils/paginationNew.d.ts +44 -0
- package/dist/utils/paginationNew.d.ts.map +1 -0
- package/dist/utils/paginationNew.js +149 -0
- package/dist/utils/paginationNew.js.map +1 -0
- package/dist/utils/parameterUtils.d.ts +79 -0
- package/dist/utils/parameterUtils.d.ts.map +1 -0
- package/dist/utils/parameterUtils.js +189 -0
- package/dist/utils/parameterUtils.js.map +1 -0
- package/dist/utils/responseFormatters.d.ts +95 -0
- package/dist/utils/responseFormatters.d.ts.map +1 -0
- package/dist/utils/responseFormatters.js +342 -0
- package/dist/utils/responseFormatters.js.map +1 -0
- package/dist/utils/responseWrapper.d.ts +38 -0
- package/dist/utils/responseWrapper.d.ts.map +1 -0
- package/dist/utils/responseWrapper.js +201 -0
- package/dist/utils/responseWrapper.js.map +1 -0
- package/dist/utils/sanitize.d.ts +51 -0
- package/dist/utils/sanitize.d.ts.map +1 -0
- package/dist/utils/sanitize.js +138 -0
- package/dist/utils/sanitize.js.map +1 -0
- package/dist/utils/validator.d.ts +37 -0
- package/dist/utils/validator.d.ts.map +1 -0
- package/dist/utils/validator.js +74 -0
- package/dist/utils/validator.js.map +1 -0
- package/dist/utils/workspaceResolver.d.ts +40 -0
- package/dist/utils/workspaceResolver.d.ts.map +1 -0
- package/dist/utils/workspaceResolver.js +207 -0
- package/dist/utils/workspaceResolver.js.map +1 -0
- package/package.json +41 -17
- package/.claude/settings.local.json +0 -15
- package/.env.example +0 -3
- package/sample.png +0 -0
- package/src/index.js +0 -179
- package/src/mcp-server.js +0 -1137
- package/src/routes/motion.js +0 -152
- package/src/services/motionApi.js +0 -1177
- package/src/worker.js +0 -248
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SimpleCache = void 0;
|
|
4
|
+
const logger_1 = require("./logger");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
class SimpleCache {
|
|
7
|
+
constructor(ttlSeconds = 300, maxSize = 1000, options = {}) {
|
|
8
|
+
this.cleanupInterval = null;
|
|
9
|
+
this.cache = new Map();
|
|
10
|
+
this.ttlMs = ttlSeconds * 1000;
|
|
11
|
+
this.maxSize = maxSize;
|
|
12
|
+
// Set up automatic cleanup if requested
|
|
13
|
+
if (options.autoCleanup !== false) { // Default to true for automatic cleanup
|
|
14
|
+
// Run cleanup periodically at half the TTL interval for efficiency
|
|
15
|
+
this.cleanupInterval = setInterval(() => this.cleanup(), Math.max(30000, this.ttlMs / 2));
|
|
16
|
+
// Allow process to exit even if interval is active
|
|
17
|
+
if (typeof this.cleanupInterval.unref === 'function') {
|
|
18
|
+
this.cleanupInterval.unref();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Destroy the cache and clean up resources
|
|
24
|
+
*/
|
|
25
|
+
destroy() {
|
|
26
|
+
if (this.cleanupInterval) {
|
|
27
|
+
clearInterval(this.cleanupInterval);
|
|
28
|
+
this.cleanupInterval = null;
|
|
29
|
+
}
|
|
30
|
+
this.cache.clear();
|
|
31
|
+
}
|
|
32
|
+
set(key, value) {
|
|
33
|
+
// Enforce size limit - remove oldest entry if at capacity
|
|
34
|
+
if (this.cache.size >= this.maxSize && !this.cache.has(key)) {
|
|
35
|
+
const oldestKey = this.cache.keys().next().value;
|
|
36
|
+
if (oldestKey !== undefined) {
|
|
37
|
+
this.cache.delete(oldestKey);
|
|
38
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.DEBUG, 'Cache eviction - removed oldest entry', {
|
|
39
|
+
key: oldestKey,
|
|
40
|
+
reason: 'maxSize',
|
|
41
|
+
currentSize: this.cache.size
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
this.cache.set(key, {
|
|
46
|
+
value,
|
|
47
|
+
expiry: Date.now() + this.ttlMs
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
get(key) {
|
|
51
|
+
const item = this.cache.get(key);
|
|
52
|
+
if (!item)
|
|
53
|
+
return null;
|
|
54
|
+
if (Date.now() > item.expiry) {
|
|
55
|
+
this.cache.delete(key);
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
// Implement LRU: move accessed item to the end of insertion order
|
|
59
|
+
// This makes it the "most recently used" item
|
|
60
|
+
this.cache.delete(key);
|
|
61
|
+
this.cache.set(key, item);
|
|
62
|
+
return item.value;
|
|
63
|
+
}
|
|
64
|
+
invalidate(pattern = null) {
|
|
65
|
+
if (!pattern) {
|
|
66
|
+
this.cache.clear();
|
|
67
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.DEBUG, 'Cache cleared', { size: 0 });
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Invalidate keys matching pattern - use startsWith for precision
|
|
71
|
+
let invalidatedCount = 0;
|
|
72
|
+
for (const key of this.cache.keys()) {
|
|
73
|
+
if (key.startsWith(pattern)) {
|
|
74
|
+
this.cache.delete(key);
|
|
75
|
+
invalidatedCount++;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (invalidatedCount > 0) {
|
|
79
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.DEBUG, 'Cache invalidation', {
|
|
80
|
+
pattern,
|
|
81
|
+
invalidatedCount,
|
|
82
|
+
remainingSize: this.cache.size
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Decorator for caching method results with error handling
|
|
87
|
+
async withCache(key, fn) {
|
|
88
|
+
const cached = this.get(key);
|
|
89
|
+
if (cached !== null) {
|
|
90
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.DEBUG, 'Cache hit', { key });
|
|
91
|
+
return cached;
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
const result = await fn();
|
|
95
|
+
this.set(key, result);
|
|
96
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.DEBUG, 'Cache miss - storing', { key });
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.ERROR, 'Cache function failed', {
|
|
101
|
+
key,
|
|
102
|
+
error: error instanceof Error ? error.message : String(error)
|
|
103
|
+
});
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Utility method to get cache statistics
|
|
108
|
+
getStats() {
|
|
109
|
+
return {
|
|
110
|
+
size: this.cache.size,
|
|
111
|
+
maxSize: this.maxSize,
|
|
112
|
+
ttlSeconds: this.ttlMs / 1000
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// Clean up expired entries (can be called periodically if needed)
|
|
116
|
+
cleanup() {
|
|
117
|
+
const now = Date.now();
|
|
118
|
+
let cleanedCount = 0;
|
|
119
|
+
for (const [key, item] of this.cache.entries()) {
|
|
120
|
+
if (now > item.expiry) {
|
|
121
|
+
this.cache.delete(key);
|
|
122
|
+
cleanedCount++;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (cleanedCount > 0) {
|
|
126
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.DEBUG, 'Cache cleanup', {
|
|
127
|
+
cleanedCount,
|
|
128
|
+
remainingSize: this.cache.size
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.SimpleCache = SimpleCache;
|
|
134
|
+
exports.default = SimpleCache;
|
|
135
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/utils/cache.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAClC,2CAAyC;AAOzC,MAAa,WAAW;IAMtB,YAAY,aAAqB,GAAG,EAAE,UAAkB,IAAI,EAAE,UAAqC,EAAE;QAF7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,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED,yCAAyC;IACzC,QAAQ;QACN,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI;SAC9B,CAAC;IACJ,CAAC;IAED,kEAAkE;IAClE,OAAO;QACL,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,YAAY,GAAG,CAAC,CAAC;QAErB,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAC/C,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;gBACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACvB,YAAY,EAAE,CAAC;YACjB,CAAC;QACH,CAAC;QAED,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACrB,IAAA,eAAM,EAAC,sBAAU,CAAC,KAAK,EAAE,eAAe,EAAE;gBACxC,YAAY;gBACZ,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;aAC/B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAnJD,kCAmJC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants and error codes for Motion MCP Server utilities
|
|
3
|
+
*/
|
|
4
|
+
export declare const ERROR_CODES: {
|
|
5
|
+
readonly WORKSPACE_NOT_FOUND: "WORKSPACE_NOT_FOUND";
|
|
6
|
+
readonly WORKSPACE_ACCESS_DENIED: "WORKSPACE_ACCESS_DENIED";
|
|
7
|
+
readonly NO_DEFAULT_WORKSPACE: "NO_DEFAULT_WORKSPACE";
|
|
8
|
+
readonly INVALID_PARAMETERS: "INVALID_PARAMETERS";
|
|
9
|
+
readonly MISSING_REQUIRED_PARAM: "MISSING_REQUIRED_PARAM";
|
|
10
|
+
readonly INVALID_PRIORITY: "INVALID_PRIORITY";
|
|
11
|
+
readonly INVALID_DATE_FORMAT: "INVALID_DATE_FORMAT";
|
|
12
|
+
readonly MOTION_API_ERROR: "MOTION_API_ERROR";
|
|
13
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
14
|
+
readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
|
|
15
|
+
readonly RETRY_EXHAUSTED: "RETRY_EXHAUSTED";
|
|
16
|
+
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
17
|
+
};
|
|
18
|
+
export type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
|
|
19
|
+
export declare const WORKSPACE_TYPES: {
|
|
20
|
+
readonly PERSONAL: "personal";
|
|
21
|
+
readonly TEAM: "team";
|
|
22
|
+
readonly UNKNOWN: "unknown";
|
|
23
|
+
};
|
|
24
|
+
export type WorkspaceType = typeof WORKSPACE_TYPES[keyof typeof WORKSPACE_TYPES];
|
|
25
|
+
export declare const MCP_RESPONSE_TYPES: {
|
|
26
|
+
readonly TEXT: "text";
|
|
27
|
+
readonly JSON: "json";
|
|
28
|
+
};
|
|
29
|
+
export type McpResponseType = typeof MCP_RESPONSE_TYPES[keyof typeof MCP_RESPONSE_TYPES];
|
|
30
|
+
export declare const DEFAULTS: {
|
|
31
|
+
readonly WORKSPACE_FALLBACK_TO_DEFAULT: true;
|
|
32
|
+
readonly WORKSPACE_VALIDATE_ACCESS: false;
|
|
33
|
+
readonly WORKSPACE_USE_CACHE: true;
|
|
34
|
+
readonly SEARCH_LIMIT: 40;
|
|
35
|
+
readonly SEARCH_SCOPE: "both" | "tasks" | "projects";
|
|
36
|
+
readonly MAX_SUGGESTIONS: 5;
|
|
37
|
+
readonly TIMEFRAME: "today" | "this_week" | "this_month";
|
|
38
|
+
readonly INCLUDE_PROJECTS: true;
|
|
39
|
+
};
|
|
40
|
+
export declare const RETRY_CONFIG: {
|
|
41
|
+
readonly MAX_RETRIES: 3;
|
|
42
|
+
readonly INITIAL_BACKOFF_MS: 250;
|
|
43
|
+
readonly MAX_BACKOFF_MS: 30000;
|
|
44
|
+
readonly JITTER_FACTOR: 0.2;
|
|
45
|
+
readonly BACKOFF_MULTIPLIER: 2;
|
|
46
|
+
};
|
|
47
|
+
export declare const CACHE_TTL: {
|
|
48
|
+
readonly WORKSPACES: 600;
|
|
49
|
+
readonly USERS: 600;
|
|
50
|
+
readonly PROJECTS: 300;
|
|
51
|
+
readonly COMMENTS: 60;
|
|
52
|
+
readonly CUSTOM_FIELDS: 600;
|
|
53
|
+
readonly RECURRING_TASKS: 300;
|
|
54
|
+
readonly SCHEDULES: 300;
|
|
55
|
+
};
|
|
56
|
+
export declare const LIMITS: {
|
|
57
|
+
readonly COMMENT_MAX_LENGTH: 5000;
|
|
58
|
+
readonly COMMENT_DISPLAY_LENGTH: 120;
|
|
59
|
+
readonly CUSTOM_FIELD_NAME_MAX_LENGTH: 255;
|
|
60
|
+
readonly CUSTOM_FIELD_OPTIONS_MAX_COUNT: 100;
|
|
61
|
+
readonly DEFAULT_PAGE_SIZE: 50;
|
|
62
|
+
readonly MAX_PAGE_SIZE: 200;
|
|
63
|
+
readonly MAX_PAGES: 10;
|
|
64
|
+
readonly ABSOLUTE_MAX_PAGES: 50;
|
|
65
|
+
readonly MAX_SEARCH_RESULTS: 100;
|
|
66
|
+
};
|
|
67
|
+
export declare const LOG_LEVELS: {
|
|
68
|
+
readonly DEBUG: "debug";
|
|
69
|
+
readonly INFO: "info";
|
|
70
|
+
readonly WARN: "warn";
|
|
71
|
+
readonly ERROR: "error";
|
|
72
|
+
};
|
|
73
|
+
export type LogLevel = typeof LOG_LEVELS[keyof typeof LOG_LEVELS];
|
|
74
|
+
export declare const NULL_UNDEFINED_POLICY: {};
|
|
75
|
+
export declare function convertUndefinedToNull<T extends Record<string, any>>(obj: T): T;
|
|
76
|
+
/**
|
|
77
|
+
* Creates a minimal payload by removing null, undefined, and empty values
|
|
78
|
+
* This prevents API validation errors from unexpected fields
|
|
79
|
+
* @param obj - The object to minimize
|
|
80
|
+
* @returns Clean object with only meaningful values
|
|
81
|
+
*/
|
|
82
|
+
export declare function createMinimalPayload<T extends Record<string, any>>(obj: T): Partial<T>;
|
|
83
|
+
export declare function convertNullToUndefined<T extends Record<string, any>>(obj: T): T;
|
|
84
|
+
export declare const VALID_PRIORITIES: readonly ["ASAP", "HIGH", "MEDIUM", "LOW"];
|
|
85
|
+
export type ValidPriority = typeof VALID_PRIORITIES[number];
|
|
86
|
+
export declare function isValidPriority(priority: string): priority is ValidPriority;
|
|
87
|
+
export declare function parseFilterDate(dateInput: string): string | null;
|
|
88
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAoBd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAGrE,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAGjF,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,OAAO,kBAAkB,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAGzF,eAAO,MAAM,QAAQ;;;;;2BAOK,MAAM,GAAG,OAAO,GAAG,UAAU;;wBAM3B,OAAO,GAAG,WAAW,GAAG,YAAY;;CAEtD,CAAC;AAGX,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC;AAGX,eAAO,MAAM,SAAS;;;;;;;;CAQZ,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;;;;CAYT,CAAC;AAGX,eAAO,MAAM,UAAU;;;;;CAKb,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAGlE,eAAO,MAAM,qBAAqB,IAYxB,CAAC;AAGX,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAQ/E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAyBtF;AAGD,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAQ/E;AAGD,eAAO,MAAM,gBAAgB,4CAA6C,CAAC;AAC3E,MAAM,MAAM,aAAa,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAG5D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,aAAa,CAE3E;AAGD,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA8BhE"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared constants and error codes for Motion MCP Server utilities
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VALID_PRIORITIES = exports.NULL_UNDEFINED_POLICY = exports.LOG_LEVELS = exports.LIMITS = exports.CACHE_TTL = exports.RETRY_CONFIG = exports.DEFAULTS = exports.MCP_RESPONSE_TYPES = exports.WORKSPACE_TYPES = exports.ERROR_CODES = void 0;
|
|
7
|
+
exports.convertUndefinedToNull = convertUndefinedToNull;
|
|
8
|
+
exports.createMinimalPayload = createMinimalPayload;
|
|
9
|
+
exports.convertNullToUndefined = convertNullToUndefined;
|
|
10
|
+
exports.isValidPriority = isValidPriority;
|
|
11
|
+
exports.parseFilterDate = parseFilterDate;
|
|
12
|
+
// Error codes for different types of failures
|
|
13
|
+
exports.ERROR_CODES = {
|
|
14
|
+
// Workspace related errors
|
|
15
|
+
WORKSPACE_NOT_FOUND: 'WORKSPACE_NOT_FOUND',
|
|
16
|
+
WORKSPACE_ACCESS_DENIED: 'WORKSPACE_ACCESS_DENIED',
|
|
17
|
+
NO_DEFAULT_WORKSPACE: 'NO_DEFAULT_WORKSPACE',
|
|
18
|
+
// Validation errors
|
|
19
|
+
INVALID_PARAMETERS: 'INVALID_PARAMETERS',
|
|
20
|
+
MISSING_REQUIRED_PARAM: 'MISSING_REQUIRED_PARAM',
|
|
21
|
+
INVALID_PRIORITY: 'INVALID_PRIORITY',
|
|
22
|
+
INVALID_DATE_FORMAT: 'INVALID_DATE_FORMAT',
|
|
23
|
+
// API related errors
|
|
24
|
+
MOTION_API_ERROR: 'MOTION_API_ERROR',
|
|
25
|
+
NETWORK_ERROR: 'NETWORK_ERROR',
|
|
26
|
+
RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED',
|
|
27
|
+
RETRY_EXHAUSTED: 'RETRY_EXHAUSTED',
|
|
28
|
+
// General errors
|
|
29
|
+
INTERNAL_ERROR: 'INTERNAL_ERROR'
|
|
30
|
+
};
|
|
31
|
+
// Workspace types
|
|
32
|
+
exports.WORKSPACE_TYPES = {
|
|
33
|
+
PERSONAL: 'personal',
|
|
34
|
+
TEAM: 'team',
|
|
35
|
+
UNKNOWN: 'unknown'
|
|
36
|
+
};
|
|
37
|
+
// MCP response types
|
|
38
|
+
exports.MCP_RESPONSE_TYPES = {
|
|
39
|
+
TEXT: 'text',
|
|
40
|
+
JSON: 'json'
|
|
41
|
+
};
|
|
42
|
+
// Default values for common parameters
|
|
43
|
+
exports.DEFAULTS = {
|
|
44
|
+
WORKSPACE_FALLBACK_TO_DEFAULT: true,
|
|
45
|
+
WORKSPACE_VALIDATE_ACCESS: false,
|
|
46
|
+
WORKSPACE_USE_CACHE: true,
|
|
47
|
+
// Search defaults
|
|
48
|
+
SEARCH_LIMIT: 40,
|
|
49
|
+
SEARCH_SCOPE: 'both',
|
|
50
|
+
// Suggestion defaults
|
|
51
|
+
MAX_SUGGESTIONS: 5,
|
|
52
|
+
// Workload analysis defaults
|
|
53
|
+
TIMEFRAME: 'this_week',
|
|
54
|
+
INCLUDE_PROJECTS: true
|
|
55
|
+
};
|
|
56
|
+
// Retry configuration
|
|
57
|
+
exports.RETRY_CONFIG = {
|
|
58
|
+
MAX_RETRIES: 3,
|
|
59
|
+
INITIAL_BACKOFF_MS: 250,
|
|
60
|
+
MAX_BACKOFF_MS: 30000, // 30 seconds max
|
|
61
|
+
JITTER_FACTOR: 0.2, // 20% jitter
|
|
62
|
+
BACKOFF_MULTIPLIER: 2
|
|
63
|
+
};
|
|
64
|
+
// Cache TTL configuration (in seconds)
|
|
65
|
+
exports.CACHE_TTL = {
|
|
66
|
+
WORKSPACES: 600, // 10 minutes
|
|
67
|
+
USERS: 600, // 10 minutes
|
|
68
|
+
PROJECTS: 300, // 5 minutes
|
|
69
|
+
COMMENTS: 60, // 1 minute
|
|
70
|
+
CUSTOM_FIELDS: 600, // 10 minutes
|
|
71
|
+
RECURRING_TASKS: 300, // 5 minutes (same as projects)
|
|
72
|
+
SCHEDULES: 300 // 5 minutes (schedule data changes frequently)
|
|
73
|
+
};
|
|
74
|
+
// Content limits and validation
|
|
75
|
+
exports.LIMITS = {
|
|
76
|
+
COMMENT_MAX_LENGTH: 5000, // Maximum comment length in characters
|
|
77
|
+
COMMENT_DISPLAY_LENGTH: 120, // Maximum length for display before truncation
|
|
78
|
+
CUSTOM_FIELD_NAME_MAX_LENGTH: 255, // Maximum custom field name length
|
|
79
|
+
CUSTOM_FIELD_OPTIONS_MAX_COUNT: 100, // Maximum number of options for select fields
|
|
80
|
+
// Pagination limits to prevent resource exhaustion
|
|
81
|
+
DEFAULT_PAGE_SIZE: 50, // Default number of items per page
|
|
82
|
+
MAX_PAGE_SIZE: 200, // Maximum allowed page size
|
|
83
|
+
MAX_PAGES: 10, // Maximum number of pages to fetch
|
|
84
|
+
ABSOLUTE_MAX_PAGES: 50, // Absolute maximum pages to prevent infinite loops
|
|
85
|
+
MAX_SEARCH_RESULTS: 100 // Maximum search results to return
|
|
86
|
+
};
|
|
87
|
+
// Logging levels for MCP compliance
|
|
88
|
+
exports.LOG_LEVELS = {
|
|
89
|
+
DEBUG: 'debug',
|
|
90
|
+
INFO: 'info',
|
|
91
|
+
WARN: 'warn',
|
|
92
|
+
ERROR: 'error'
|
|
93
|
+
};
|
|
94
|
+
// Null vs Undefined Policy
|
|
95
|
+
exports.NULL_UNDEFINED_POLICY = {
|
|
96
|
+
// Use undefined for:
|
|
97
|
+
// - Optional parameters that weren't provided
|
|
98
|
+
// - Missing object properties
|
|
99
|
+
// - Function returns when item not found
|
|
100
|
+
// - Uninitialized values
|
|
101
|
+
// Use null for:
|
|
102
|
+
// - Explicit absence of value from API
|
|
103
|
+
// - Database null values
|
|
104
|
+
// - Cleared/reset state (e.g., cache reset)
|
|
105
|
+
// - Values that need to be explicitly sent as null to external APIs
|
|
106
|
+
};
|
|
107
|
+
// Helper to convert undefined to null for API compatibility
|
|
108
|
+
function convertUndefinedToNull(obj) {
|
|
109
|
+
const result = { ...obj };
|
|
110
|
+
for (const key in result) {
|
|
111
|
+
if (result[key] === undefined) {
|
|
112
|
+
result[key] = null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Creates a minimal payload by removing null, undefined, and empty values
|
|
119
|
+
* This prevents API validation errors from unexpected fields
|
|
120
|
+
* @param obj - The object to minimize
|
|
121
|
+
* @returns Clean object with only meaningful values
|
|
122
|
+
*/
|
|
123
|
+
function createMinimalPayload(obj) {
|
|
124
|
+
const result = {};
|
|
125
|
+
for (const key in obj) {
|
|
126
|
+
const value = obj[key];
|
|
127
|
+
// Skip null, undefined, empty strings, and empty arrays
|
|
128
|
+
if (value === null || value === undefined || value === '') {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
// Skip empty arrays
|
|
132
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
// Skip empty objects (but preserve objects with properties)
|
|
136
|
+
if (typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length === 0) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
result[key] = value;
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
// Helper to convert null to undefined for internal consistency
|
|
144
|
+
function convertNullToUndefined(obj) {
|
|
145
|
+
const result = { ...obj };
|
|
146
|
+
for (const key in result) {
|
|
147
|
+
if (result[key] === null) {
|
|
148
|
+
delete result[key]; // This makes it undefined
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
// Valid priority levels for Motion tasks
|
|
154
|
+
exports.VALID_PRIORITIES = ['ASAP', 'HIGH', 'MEDIUM', 'LOW'];
|
|
155
|
+
// Helper to validate priority values
|
|
156
|
+
function isValidPriority(priority) {
|
|
157
|
+
return exports.VALID_PRIORITIES.includes(priority);
|
|
158
|
+
}
|
|
159
|
+
// Helper to parse and validate date formats
|
|
160
|
+
function parseFilterDate(dateInput) {
|
|
161
|
+
if (!dateInput)
|
|
162
|
+
return null;
|
|
163
|
+
// Handle relative dates
|
|
164
|
+
const today = new Date();
|
|
165
|
+
const normalizedInput = dateInput.toLowerCase().trim();
|
|
166
|
+
switch (normalizedInput) {
|
|
167
|
+
case 'today':
|
|
168
|
+
return today.toISOString().split('T')[0];
|
|
169
|
+
case 'tomorrow':
|
|
170
|
+
const tomorrow = new Date(today);
|
|
171
|
+
tomorrow.setDate(today.getDate() + 1);
|
|
172
|
+
return tomorrow.toISOString().split('T')[0];
|
|
173
|
+
case 'yesterday':
|
|
174
|
+
const yesterday = new Date(today);
|
|
175
|
+
yesterday.setDate(today.getDate() - 1);
|
|
176
|
+
return yesterday.toISOString().split('T')[0];
|
|
177
|
+
}
|
|
178
|
+
// Validate YYYY-MM-DD format
|
|
179
|
+
const datePattern = /^\d{4}-\d{2}-\d{2}$/;
|
|
180
|
+
if (datePattern.test(dateInput)) {
|
|
181
|
+
const parsedDate = new Date(dateInput + 'T00:00:00Z');
|
|
182
|
+
if (!isNaN(parsedDate.getTime())) {
|
|
183
|
+
return dateInput;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA2HH,wDAQC;AAQD,oDAyBC;AAGD,wDAQC;AAOD,0CAEC;AAGD,0CA8BC;AAvND,8CAA8C;AACjC,QAAA,WAAW,GAAG;IACzB,2BAA2B;IAC3B,mBAAmB,EAAE,qBAAqB;IAC1C,uBAAuB,EAAE,yBAAyB;IAClD,oBAAoB,EAAE,sBAAsB;IAE5C,oBAAoB;IACpB,kBAAkB,EAAE,oBAAoB;IACxC,sBAAsB,EAAE,wBAAwB;IAChD,gBAAgB,EAAE,kBAAkB;IACpC,mBAAmB,EAAE,qBAAqB;IAE1C,qBAAqB;IACrB,gBAAgB,EAAE,kBAAkB;IACpC,aAAa,EAAE,eAAe;IAC9B,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;IAElC,iBAAiB;IACjB,cAAc,EAAE,gBAAgB;CACxB,CAAC;AAIX,kBAAkB;AACL,QAAA,eAAe,GAAG;IAC7B,QAAQ,EAAE,UAAU;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AE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,KAAK,UAAU;YACb,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;YACjC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;YACtC,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9C,KAAK,WAAW;YACd,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;YAClC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;YACvC,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,6BAA6B;IAC7B,MAAM,WAAW,GAAG,qBAAqB,CAAC;IAC1C,IAAI,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC;QACtD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;YACjC,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Handling Utilities - Custom error classes and MCP response formatters
|
|
3
|
+
*
|
|
4
|
+
* This module provides custom error classes and MCP-compliant error response
|
|
5
|
+
* formatting to ensure consistent error handling across all handlers.
|
|
6
|
+
*/
|
|
7
|
+
import { ErrorCode } from './constants';
|
|
8
|
+
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
9
|
+
interface ErrorContext {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Base error class for Motion API related errors
|
|
14
|
+
*/
|
|
15
|
+
export declare class MotionApiError extends Error {
|
|
16
|
+
readonly code: ErrorCode;
|
|
17
|
+
readonly context: ErrorContext;
|
|
18
|
+
constructor(message: string, code?: ErrorCode, context?: ErrorContext);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Error class for parameter validation failures
|
|
22
|
+
*/
|
|
23
|
+
export declare class ValidationError extends Error {
|
|
24
|
+
readonly code: ErrorCode;
|
|
25
|
+
readonly parameter: string | null;
|
|
26
|
+
readonly context: ErrorContext;
|
|
27
|
+
constructor(message: string, parameter?: string | null, context?: ErrorContext);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Error class for workspace-specific issues
|
|
31
|
+
*/
|
|
32
|
+
export declare class WorkspaceError extends Error {
|
|
33
|
+
readonly code: ErrorCode;
|
|
34
|
+
readonly context: ErrorContext;
|
|
35
|
+
constructor(message: string, code?: ErrorCode, context?: ErrorContext);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Format an error for MCP protocol response
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatMcpError(error: Error | MotionApiError, _context?: ErrorContext): CallToolResult;
|
|
41
|
+
/**
|
|
42
|
+
* Format a success response for MCP protocol
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatMcpSuccess(text: string): CallToolResult;
|
|
45
|
+
/**
|
|
46
|
+
* Create a standardized error response with context
|
|
47
|
+
*/
|
|
48
|
+
export declare function createErrorResponse(message: string, code?: ErrorCode, context?: ErrorContext): CallToolResult;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=errorHandling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandling.d.ts","sourceRoot":"","sources":["../../src/utils/errorHandling.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAmC,SAAS,EAAE,MAAM,aAAa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
+
*
|
|
5
|
+
* This module provides custom error classes and MCP-compliant error response
|
|
6
|
+
* formatting to ensure consistent error handling across all handlers.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.WorkspaceError = exports.ValidationError = exports.MotionApiError = void 0;
|
|
10
|
+
exports.formatMcpError = formatMcpError;
|
|
11
|
+
exports.formatMcpSuccess = formatMcpSuccess;
|
|
12
|
+
exports.createErrorResponse = createErrorResponse;
|
|
13
|
+
const constants_1 = require("./constants");
|
|
14
|
+
/**
|
|
15
|
+
* Base error class for Motion API related errors
|
|
16
|
+
*/
|
|
17
|
+
class MotionApiError extends Error {
|
|
18
|
+
constructor(message, code = constants_1.ERROR_CODES.MOTION_API_ERROR, context = {}) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'MotionApiError';
|
|
21
|
+
this.code = code;
|
|
22
|
+
this.context = context;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.MotionApiError = MotionApiError;
|
|
26
|
+
/**
|
|
27
|
+
* Error class for parameter validation failures
|
|
28
|
+
*/
|
|
29
|
+
class ValidationError extends Error {
|
|
30
|
+
constructor(message, parameter = null, context = {}) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = 'ValidationError';
|
|
33
|
+
this.code = constants_1.ERROR_CODES.INVALID_PARAMETERS;
|
|
34
|
+
this.parameter = parameter;
|
|
35
|
+
this.context = context;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ValidationError = ValidationError;
|
|
39
|
+
/**
|
|
40
|
+
* Error class for workspace-specific issues
|
|
41
|
+
*/
|
|
42
|
+
class WorkspaceError extends Error {
|
|
43
|
+
constructor(message, code = constants_1.ERROR_CODES.WORKSPACE_NOT_FOUND, context = {}) {
|
|
44
|
+
super(message);
|
|
45
|
+
this.name = 'WorkspaceError';
|
|
46
|
+
this.code = code;
|
|
47
|
+
this.context = context;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.WorkspaceError = WorkspaceError;
|
|
51
|
+
/**
|
|
52
|
+
* Format an error for MCP protocol response
|
|
53
|
+
*/
|
|
54
|
+
function formatMcpError(error, _context = {}) {
|
|
55
|
+
const errorMessage = error.message || 'An unknown error occurred';
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: constants_1.MCP_RESPONSE_TYPES.TEXT,
|
|
60
|
+
text: `Error: ${errorMessage}`
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
isError: true
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Format a success response for MCP protocol
|
|
68
|
+
*/
|
|
69
|
+
function formatMcpSuccess(text) {
|
|
70
|
+
return {
|
|
71
|
+
content: [
|
|
72
|
+
{
|
|
73
|
+
type: constants_1.MCP_RESPONSE_TYPES.TEXT,
|
|
74
|
+
text
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create a standardized error response with context
|
|
81
|
+
*/
|
|
82
|
+
function createErrorResponse(message, code = constants_1.ERROR_CODES.INTERNAL_ERROR, context = {}) {
|
|
83
|
+
const error = new MotionApiError(message, code, context);
|
|
84
|
+
return formatMcpError(error, context);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=errorHandling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandling.js","sourceRoot":"","sources":["../../src/utils/errorHandling.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA2DH,wCAYC;AAKD,4CASC;AAKD,kDAOC;AA/FD,2CAAyE;AAOzE;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAIvC,YAAY,OAAe,EAAE,OAAkB,uBAAW,CAAC,gBAAgB,EAAE,UAAwB,EAAE;QACrG,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB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AC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,OAAe,EACf,OAAkB,uBAAW,CAAC,cAAc,EAC5C,UAAwB,EAAE;IAE1B,MAAM,KAAK,GAAG,IAAI,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACzD,OAAO,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central export point for Motion MCP Server utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides a single import point for all utility functions,
|
|
5
|
+
* classes, and constants used throughout the Motion MCP Server.
|
|
6
|
+
*/
|
|
7
|
+
export * from './constants';
|
|
8
|
+
export * from './errorHandling';
|
|
9
|
+
export * from './responseFormatters';
|
|
10
|
+
export * from './parameterUtils';
|
|
11
|
+
export { WorkspaceResolver } from './workspaceResolver';
|
|
12
|
+
export { mcpLog } from './logger';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,aAAa,CAAC;AAG5B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Central export point for Motion MCP Server utilities
|
|
4
|
+
*
|
|
5
|
+
* This module provides a single import point for all utility functions,
|
|
6
|
+
* classes, and constants used throughout the Motion MCP Server.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.mcpLog = exports.WorkspaceResolver = void 0;
|
|
24
|
+
// Export all constants
|
|
25
|
+
__exportStar(require("./constants"), exports);
|
|
26
|
+
// Export error handling utilities
|
|
27
|
+
__exportStar(require("./errorHandling"), exports);
|
|
28
|
+
// Export response formatters
|
|
29
|
+
__exportStar(require("./responseFormatters"), exports);
|
|
30
|
+
// Export parameter utilities
|
|
31
|
+
__exportStar(require("./parameterUtils"), exports);
|
|
32
|
+
// Export WorkspaceResolver
|
|
33
|
+
var workspaceResolver_1 = require("./workspaceResolver");
|
|
34
|
+
Object.defineProperty(exports, "WorkspaceResolver", { enumerable: true, get: function () { return workspaceResolver_1.WorkspaceResolver; } });
|
|
35
|
+
// Export logger
|
|
36
|
+
var logger_1 = require("./logger");
|
|
37
|
+
Object.defineProperty(exports, "mcpLog", { enumerable: true, get: function () { return logger_1.mcpLog; } });
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAEH,uBAAuB;AACvB,8CAA4B;AAE5B,kCAAkC;AAClC,kDAAgC;AAEhC,6BAA6B;AAC7B,uDAAqC;AAErC,6BAA6B;AAC7B,mDAAiC;AAEjC,2BAA2B;AAC3B,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAE1B,gBAAgB;AAChB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized MCP-compliant logger
|
|
3
|
+
* Outputs structured JSON logs to stderr as required by MCP protocol
|
|
4
|
+
*/
|
|
5
|
+
import { LogLevel } from './constants';
|
|
6
|
+
/**
|
|
7
|
+
* MCP-compliant logger that outputs to stderr in JSON format
|
|
8
|
+
* @param level - Log level (ERROR, WARN, INFO, DEBUG)
|
|
9
|
+
* @param message - Log message
|
|
10
|
+
* @param extra - Additional context data
|
|
11
|
+
*/
|
|
12
|
+
export declare const mcpLog: (level: LogLevel, message: string, extra?: Record<string, any>) => void;
|
|
13
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAyBvC;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,QAAQ,EAAE,SAAS,MAAM,EAAE,QAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,KAAG,IAY1F,CAAC"}
|