@elliotding/ai-agent-mcp 0.1.26 → 0.1.27
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/dist/api/cached-client.d.ts +48 -0
- package/dist/api/cached-client.d.ts.map +1 -0
- package/dist/api/cached-client.js +126 -0
- package/dist/api/cached-client.js.map +1 -0
- package/dist/api/client.d.ts +281 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +371 -0
- package/dist/api/client.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +26 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/middleware.d.ts +36 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +194 -0
- package/dist/auth/middleware.js.map +1 -0
- package/dist/auth/permissions.d.ts +60 -0
- package/dist/auth/permissions.d.ts.map +1 -0
- package/dist/auth/permissions.js +262 -0
- package/dist/auth/permissions.js.map +1 -0
- package/dist/auth/token-validator.d.ts +52 -0
- package/dist/auth/token-validator.d.ts.map +1 -0
- package/dist/auth/token-validator.js +215 -0
- package/dist/auth/token-validator.js.map +1 -0
- package/dist/cache/cache-manager.d.ts +49 -0
- package/dist/cache/cache-manager.d.ts.map +1 -0
- package/dist/cache/cache-manager.js +191 -0
- package/dist/cache/cache-manager.js.map +1 -0
- package/dist/cache/index.d.ts +6 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +12 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/redis-client.d.ts +45 -0
- package/dist/cache/redis-client.d.ts.map +1 -0
- package/dist/cache/redis-client.js +210 -0
- package/dist/cache/redis-client.js.map +1 -0
- package/dist/config/constants.d.ts +28 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +31 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/index.d.ts +71 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +190 -0
- package/dist/config/index.js.map +1 -0
- package/dist/filesystem/manager.d.ts +45 -0
- package/dist/filesystem/manager.d.ts.map +1 -0
- package/dist/filesystem/manager.js +246 -0
- package/dist/filesystem/manager.js.map +1 -0
- package/dist/git/multi-source-manager.d.ts +78 -0
- package/dist/git/multi-source-manager.d.ts.map +1 -0
- package/dist/git/multi-source-manager.js +577 -0
- package/dist/git/multi-source-manager.js.map +1 -0
- package/dist/git/operations.d.ts +27 -0
- package/dist/git/operations.d.ts.map +1 -0
- package/dist/git/operations.js +83 -0
- package/dist/git/operations.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +122 -0
- package/dist/index.js.map +1 -0
- package/dist/monitoring/health.d.ts +35 -0
- package/dist/monitoring/health.d.ts.map +1 -0
- package/dist/monitoring/health.js +105 -0
- package/dist/monitoring/health.js.map +1 -0
- package/dist/prompts/cache.d.ts +69 -0
- package/dist/prompts/cache.d.ts.map +1 -0
- package/dist/prompts/cache.js +163 -0
- package/dist/prompts/cache.js.map +1 -0
- package/dist/prompts/generator.d.ts +49 -0
- package/dist/prompts/generator.d.ts.map +1 -0
- package/dist/prompts/generator.js +160 -0
- package/dist/prompts/generator.js.map +1 -0
- package/dist/prompts/index.d.ts +13 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +24 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/manager.d.ts +207 -0
- package/dist/prompts/manager.d.ts.map +1 -0
- package/dist/prompts/manager.js +566 -0
- package/dist/prompts/manager.js.map +1 -0
- package/dist/resources/index.d.ts +6 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +10 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/loader.d.ts +88 -0
- package/dist/resources/loader.d.ts.map +1 -0
- package/dist/resources/loader.js +492 -0
- package/dist/resources/loader.js.map +1 -0
- package/dist/server/http.d.ts +57 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +435 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +201 -0
- package/dist/server.js.map +1 -0
- package/dist/session/manager.d.ts +91 -0
- package/dist/session/manager.d.ts.map +1 -0
- package/dist/session/manager.js +251 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/telemetry/index.d.ts +3 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +7 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/manager.d.ts +151 -0
- package/dist/telemetry/manager.d.ts.map +1 -0
- package/dist/telemetry/manager.js +367 -0
- package/dist/telemetry/manager.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +29 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/manage-subscription.d.ts +47 -0
- package/dist/tools/manage-subscription.d.ts.map +1 -0
- package/dist/tools/manage-subscription.js +317 -0
- package/dist/tools/manage-subscription.js.map +1 -0
- package/dist/tools/registry.d.ts +40 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +85 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/resolve-prompt-content.d.ts +35 -0
- package/dist/tools/resolve-prompt-content.d.ts.map +1 -0
- package/dist/tools/resolve-prompt-content.js +99 -0
- package/dist/tools/resolve-prompt-content.js.map +1 -0
- package/dist/tools/search-resources.d.ts +35 -0
- package/dist/tools/search-resources.d.ts.map +1 -0
- package/dist/tools/search-resources.js +159 -0
- package/dist/tools/search-resources.js.map +1 -0
- package/dist/tools/sync-resources.d.ts +54 -0
- package/dist/tools/sync-resources.d.ts.map +1 -0
- package/dist/tools/sync-resources.js +735 -0
- package/dist/tools/sync-resources.js.map +1 -0
- package/dist/tools/track-usage.d.ts +63 -0
- package/dist/tools/track-usage.d.ts.map +1 -0
- package/dist/tools/track-usage.js +90 -0
- package/dist/tools/track-usage.js.map +1 -0
- package/dist/tools/uninstall-resource.d.ts +30 -0
- package/dist/tools/uninstall-resource.d.ts.map +1 -0
- package/dist/tools/uninstall-resource.js +174 -0
- package/dist/tools/uninstall-resource.js.map +1 -0
- package/dist/tools/upload-resource.d.ts +81 -0
- package/dist/tools/upload-resource.d.ts.map +1 -0
- package/dist/tools/upload-resource.js +393 -0
- package/dist/tools/upload-resource.js.map +1 -0
- package/dist/transport/sse.d.ts +29 -0
- package/dist/transport/sse.d.ts.map +1 -0
- package/dist/transport/sse.js +271 -0
- package/dist/transport/sse.js.map +1 -0
- package/dist/types/errors.d.ts +60 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +112 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +23 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mcp.d.ts +50 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +6 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/resources.d.ts +109 -0
- package/dist/types/resources.d.ts.map +1 -0
- package/dist/types/resources.js +7 -0
- package/dist/types/resources.js.map +1 -0
- package/dist/types/tools.d.ts +253 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +6 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/utils/cursor-paths.d.ts +84 -0
- package/dist/utils/cursor-paths.d.ts.map +1 -0
- package/dist/utils/cursor-paths.js +166 -0
- package/dist/utils/cursor-paths.js.map +1 -0
- package/dist/utils/log-cleaner.d.ts +18 -0
- package/dist/utils/log-cleaner.d.ts.map +1 -0
- package/dist/utils/log-cleaner.js +112 -0
- package/dist/utils/log-cleaner.js.map +1 -0
- package/dist/utils/logger.d.ts +59 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +292 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/validation.d.ts +58 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +214 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SSE Transport Implementation
|
|
4
|
+
* MCP protocol over Server-Sent Events
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.sseTransport = exports.SSETransport = void 0;
|
|
8
|
+
const logger_1 = require("../utils/logger");
|
|
9
|
+
const manager_1 = require("../session/manager");
|
|
10
|
+
const registry_1 = require("../tools/registry");
|
|
11
|
+
const middleware_1 = require("../auth/middleware");
|
|
12
|
+
class SSETransport {
|
|
13
|
+
constructor() {
|
|
14
|
+
logger_1.logger.info('SSE transport initialized');
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Handle incoming message from client
|
|
18
|
+
*/
|
|
19
|
+
async handleMessage(sessionId, message) {
|
|
20
|
+
const messageStartTime = Date.now();
|
|
21
|
+
logger_1.logger.info({
|
|
22
|
+
type: 'sse_message_received',
|
|
23
|
+
sessionId,
|
|
24
|
+
method: message.method,
|
|
25
|
+
messageId: message.id,
|
|
26
|
+
hasParams: !!message.params,
|
|
27
|
+
timestamp: new Date().toISOString()
|
|
28
|
+
}, `SSE message received: ${message.method}`);
|
|
29
|
+
try {
|
|
30
|
+
// Validate session
|
|
31
|
+
(0, logger_1.logToolStep)('sse', 'Validating session', { sessionId });
|
|
32
|
+
const session = manager_1.sessionManager.getSession(sessionId);
|
|
33
|
+
if (!session) {
|
|
34
|
+
logger_1.logger.error({
|
|
35
|
+
type: 'sse_error',
|
|
36
|
+
sessionId,
|
|
37
|
+
method: message.method,
|
|
38
|
+
error: 'session_not_found',
|
|
39
|
+
timestamp: new Date().toISOString()
|
|
40
|
+
}, 'Session not found or expired');
|
|
41
|
+
throw new Error('Session not found or expired');
|
|
42
|
+
}
|
|
43
|
+
logger_1.logger.debug({
|
|
44
|
+
type: 'sse_session_validated',
|
|
45
|
+
sessionId,
|
|
46
|
+
userId: session.userId,
|
|
47
|
+
email: session.email,
|
|
48
|
+
groups: session.groups,
|
|
49
|
+
timestamp: new Date().toISOString()
|
|
50
|
+
}, 'Session validated');
|
|
51
|
+
// Update session activity
|
|
52
|
+
manager_1.sessionManager.updateActivity(sessionId);
|
|
53
|
+
(0, logger_1.logToolStep)('sse', 'Session activity updated', { sessionId });
|
|
54
|
+
// Handle MCP message
|
|
55
|
+
if (message.method === 'tools/list') {
|
|
56
|
+
(0, logger_1.logToolStep)('sse', 'Handling tools/list request', { sessionId });
|
|
57
|
+
const tools = registry_1.toolRegistry.getMCPToolDefinitions();
|
|
58
|
+
logger_1.logger.info({
|
|
59
|
+
type: 'sse_tools_list',
|
|
60
|
+
sessionId,
|
|
61
|
+
toolCount: tools.length,
|
|
62
|
+
toolNames: tools.map(t => t.name),
|
|
63
|
+
timestamp: new Date().toISOString()
|
|
64
|
+
}, `Returning ${tools.length} tool definitions`);
|
|
65
|
+
const response = {
|
|
66
|
+
jsonrpc: '2.0',
|
|
67
|
+
id: message.id,
|
|
68
|
+
result: { tools },
|
|
69
|
+
};
|
|
70
|
+
this.sendMessage(sessionId, response);
|
|
71
|
+
}
|
|
72
|
+
else if (message.method === 'tools/call') {
|
|
73
|
+
const params = message.params;
|
|
74
|
+
const toolName = params.name;
|
|
75
|
+
const args = params.arguments || {};
|
|
76
|
+
logger_1.logger.info({
|
|
77
|
+
type: 'sse_tool_call',
|
|
78
|
+
sessionId,
|
|
79
|
+
toolName,
|
|
80
|
+
userId: session.userId,
|
|
81
|
+
email: session.email,
|
|
82
|
+
argsPreview: JSON.stringify(args).substring(0, 200),
|
|
83
|
+
timestamp: new Date().toISOString()
|
|
84
|
+
}, `Executing tool: ${toolName}`);
|
|
85
|
+
(0, logger_1.logToolStep)(toolName, 'Tool call initiated via SSE', {
|
|
86
|
+
sessionId,
|
|
87
|
+
userId: session.userId,
|
|
88
|
+
email: session.email
|
|
89
|
+
});
|
|
90
|
+
try {
|
|
91
|
+
// Check permissions if user is authenticated
|
|
92
|
+
if (session.userId && session.groups && session.groups.length > 0) {
|
|
93
|
+
(0, logger_1.logToolStep)(toolName, 'Checking tool permissions', {
|
|
94
|
+
userId: session.userId,
|
|
95
|
+
email: session.email,
|
|
96
|
+
groups: session.groups
|
|
97
|
+
});
|
|
98
|
+
const permissionStartTime = Date.now();
|
|
99
|
+
const permissionCheck = (0, middleware_1.checkToolCallPermission)(toolName, {
|
|
100
|
+
userId: session.userId,
|
|
101
|
+
email: session.email,
|
|
102
|
+
groups: session.groups,
|
|
103
|
+
});
|
|
104
|
+
const permissionDuration = Date.now() - permissionStartTime;
|
|
105
|
+
if (!permissionCheck.allowed) {
|
|
106
|
+
logger_1.logger.warn({
|
|
107
|
+
type: 'sse_permission_denied',
|
|
108
|
+
sessionId,
|
|
109
|
+
userId: session.userId,
|
|
110
|
+
email: session.email,
|
|
111
|
+
groups: session.groups,
|
|
112
|
+
toolName,
|
|
113
|
+
reason: permissionCheck.reason,
|
|
114
|
+
duration: permissionDuration,
|
|
115
|
+
timestamp: new Date().toISOString()
|
|
116
|
+
}, `Tool call permission denied for ${toolName}`);
|
|
117
|
+
const errorResponse = {
|
|
118
|
+
jsonrpc: '2.0',
|
|
119
|
+
id: message.id,
|
|
120
|
+
error: {
|
|
121
|
+
code: -32600, // Invalid Request
|
|
122
|
+
message: permissionCheck.reason || 'Permission denied',
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
this.sendMessage(sessionId, errorResponse);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
logger_1.logger.debug({
|
|
129
|
+
type: 'sse_permission_granted',
|
|
130
|
+
sessionId,
|
|
131
|
+
userId: session.userId,
|
|
132
|
+
toolName,
|
|
133
|
+
duration: permissionDuration,
|
|
134
|
+
timestamp: new Date().toISOString()
|
|
135
|
+
}, `Permission granted for ${toolName}`);
|
|
136
|
+
}
|
|
137
|
+
(0, logger_1.logToolStep)(toolName, 'Executing tool handler', { args });
|
|
138
|
+
const toolStartTime = Date.now();
|
|
139
|
+
const result = await registry_1.toolRegistry.callTool(toolName, args);
|
|
140
|
+
const toolDuration = Date.now() - toolStartTime;
|
|
141
|
+
// Log complete result
|
|
142
|
+
logger_1.logger.info({
|
|
143
|
+
type: 'sse_tool_success',
|
|
144
|
+
sessionId,
|
|
145
|
+
toolName,
|
|
146
|
+
userId: session.userId,
|
|
147
|
+
resultType: typeof result,
|
|
148
|
+
resultPreview: JSON.stringify(result).substring(0, 500),
|
|
149
|
+
duration: toolDuration,
|
|
150
|
+
timestamp: new Date().toISOString()
|
|
151
|
+
}, `Tool ${toolName} executed successfully`);
|
|
152
|
+
(0, logger_1.logToolStep)(toolName, 'Tool execution completed', {
|
|
153
|
+
duration: toolDuration,
|
|
154
|
+
resultSize: JSON.stringify(result).length
|
|
155
|
+
});
|
|
156
|
+
const response = {
|
|
157
|
+
jsonrpc: '2.0',
|
|
158
|
+
id: message.id,
|
|
159
|
+
result,
|
|
160
|
+
};
|
|
161
|
+
this.sendMessage(sessionId, response);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
const toolDuration = Date.now() - messageStartTime;
|
|
165
|
+
logger_1.logger.error({
|
|
166
|
+
type: 'sse_tool_error',
|
|
167
|
+
sessionId,
|
|
168
|
+
toolName,
|
|
169
|
+
userId: session.userId,
|
|
170
|
+
error: error instanceof Error ? {
|
|
171
|
+
message: error.message,
|
|
172
|
+
stack: error.stack,
|
|
173
|
+
name: error.name
|
|
174
|
+
} : String(error),
|
|
175
|
+
duration: toolDuration,
|
|
176
|
+
timestamp: new Date().toISOString()
|
|
177
|
+
}, `Tool ${toolName} execution failed`);
|
|
178
|
+
const errorResponse = {
|
|
179
|
+
jsonrpc: '2.0',
|
|
180
|
+
id: message.id,
|
|
181
|
+
error: {
|
|
182
|
+
code: -32603,
|
|
183
|
+
message: error instanceof Error ? error.message : 'Tool execution failed',
|
|
184
|
+
data: error,
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
this.sendMessage(sessionId, errorResponse);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
else if (message.method === 'initialize') {
|
|
191
|
+
logger_1.logger.info({
|
|
192
|
+
type: 'sse_initialize',
|
|
193
|
+
sessionId,
|
|
194
|
+
timestamp: new Date().toISOString()
|
|
195
|
+
}, 'Client initialization request');
|
|
196
|
+
const response = {
|
|
197
|
+
jsonrpc: '2.0',
|
|
198
|
+
id: message.id,
|
|
199
|
+
result: {
|
|
200
|
+
protocolVersion: '2024-11-05',
|
|
201
|
+
capabilities: {
|
|
202
|
+
tools: {},
|
|
203
|
+
},
|
|
204
|
+
serverInfo: {
|
|
205
|
+
name: 'csp-ai-agent-mcp',
|
|
206
|
+
version: '0.2.0',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
this.sendMessage(sessionId, response);
|
|
211
|
+
}
|
|
212
|
+
else if (message.method === 'ping') {
|
|
213
|
+
// Keepalive ping
|
|
214
|
+
logger_1.logger.debug({
|
|
215
|
+
type: 'sse_ping',
|
|
216
|
+
sessionId,
|
|
217
|
+
timestamp: new Date().toISOString()
|
|
218
|
+
}, 'Keepalive ping received');
|
|
219
|
+
const response = {
|
|
220
|
+
jsonrpc: '2.0',
|
|
221
|
+
id: message.id,
|
|
222
|
+
result: { type: 'pong' },
|
|
223
|
+
};
|
|
224
|
+
this.sendMessage(sessionId, response);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
// Unknown method
|
|
228
|
+
logger_1.logger.warn({
|
|
229
|
+
type: 'sse_unknown_method',
|
|
230
|
+
sessionId,
|
|
231
|
+
method: message.method,
|
|
232
|
+
timestamp: new Date().toISOString()
|
|
233
|
+
}, `Unknown method: ${message.method}`);
|
|
234
|
+
const errorResponse = {
|
|
235
|
+
jsonrpc: '2.0',
|
|
236
|
+
id: message.id,
|
|
237
|
+
error: {
|
|
238
|
+
code: -32601,
|
|
239
|
+
message: `Method not found: ${message.method}`,
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
this.sendMessage(sessionId, errorResponse);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
logger_1.logger.error({ error, sessionId }, 'Error handling message');
|
|
247
|
+
const errorResponse = {
|
|
248
|
+
jsonrpc: '2.0',
|
|
249
|
+
id: message.id,
|
|
250
|
+
error: {
|
|
251
|
+
code: -32603,
|
|
252
|
+
message: error instanceof Error ? error.message : 'Internal error',
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
this.sendMessage(sessionId, errorResponse);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Send message to client via SSE
|
|
260
|
+
*/
|
|
261
|
+
sendMessage(sessionId, message) {
|
|
262
|
+
const sent = manager_1.sessionManager.sendMessage(sessionId, message);
|
|
263
|
+
if (!sent) {
|
|
264
|
+
logger_1.logger.warn({ sessionId, messageId: message.id }, 'Failed to send message to client');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
exports.SSETransport = SSETransport;
|
|
269
|
+
// Singleton instance
|
|
270
|
+
exports.sseTransport = new SSETransport();
|
|
271
|
+
//# sourceMappingURL=sse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.js","sourceRoot":"","sources":["../../src/transport/sse.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4CAAsD;AACtD,gDAAoD;AACpD,gDAAiD;AACjD,mDAA6D;AAe7D,MAAa,YAAY;IACvB;QACE,eAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,SAAiB,EAAE,OAAmB;QACxD,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEpC,e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C;CACF;AAzRD,oCAyRC;AAED,qBAAqB;AACR,QAAA,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Error Types
|
|
3
|
+
* Typed errors for different failure scenarios
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Base Error for MCP Server operations
|
|
7
|
+
*/
|
|
8
|
+
export declare class MCPServerError extends Error {
|
|
9
|
+
readonly code: string;
|
|
10
|
+
readonly details?: unknown | undefined;
|
|
11
|
+
constructor(message: string, code: string, details?: unknown | undefined);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Git Operation Error
|
|
15
|
+
*/
|
|
16
|
+
export declare class GitError extends MCPServerError {
|
|
17
|
+
readonly operation: string;
|
|
18
|
+
readonly repositoryUrl?: string | undefined;
|
|
19
|
+
constructor(message: string, operation: string, repositoryUrl?: string | undefined, details?: unknown);
|
|
20
|
+
private redactCredentials;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* API Request Error
|
|
24
|
+
*/
|
|
25
|
+
export declare class APIError extends MCPServerError {
|
|
26
|
+
readonly statusCode?: number | undefined;
|
|
27
|
+
readonly method?: string | undefined;
|
|
28
|
+
readonly url?: string | undefined;
|
|
29
|
+
readonly retryCount?: number | undefined;
|
|
30
|
+
constructor(message: string, statusCode?: number | undefined, method?: string | undefined, url?: string | undefined, retryCount?: number | undefined, details?: unknown);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resource Validation Error
|
|
34
|
+
*/
|
|
35
|
+
export declare class ValidationError extends MCPServerError {
|
|
36
|
+
readonly filePath?: string | undefined;
|
|
37
|
+
readonly expectedFormat?: string | undefined;
|
|
38
|
+
readonly validationReason?: string | undefined;
|
|
39
|
+
constructor(message: string, filePath?: string | undefined, expectedFormat?: string | undefined, validationReason?: string | undefined, details?: unknown);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Filesystem Operation Error
|
|
43
|
+
*/
|
|
44
|
+
export declare class FileSystemError extends MCPServerError {
|
|
45
|
+
readonly operation: string;
|
|
46
|
+
readonly path?: string | undefined;
|
|
47
|
+
readonly systemErrorCode?: string | undefined;
|
|
48
|
+
readonly suggestedResolution?: string | undefined;
|
|
49
|
+
constructor(message: string, operation: string, path?: string | undefined, systemErrorCode?: string | undefined, suggestedResolution?: string | undefined, details?: unknown);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Error Factory Functions
|
|
53
|
+
*/
|
|
54
|
+
export declare function createGitError(operation: string, error: Error, repositoryUrl?: string): GitError;
|
|
55
|
+
export declare function createAPIError(method: string, url: string, error: Error, statusCode?: number, retryCount?: number): APIError;
|
|
56
|
+
export declare function createValidationError(filePath: string, expectedFormat: string, reason: string): ValidationError;
|
|
57
|
+
export declare function createFileSystemError(operation: string, path: string, error: Error & {
|
|
58
|
+
code?: string;
|
|
59
|
+
}, suggestedResolution?: string): FileSystemError;
|
|
60
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;aAGrB,IAAI,EAAE,MAAM;aACZ,OAAO,CAAC,EAAE,OAAO;gBAFjC,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,YAAA;CAMpC;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,cAAc;aAGxB,SAAS,EAAE,MAAM;aACjB,aAAa,CAAC,EAAE,MAAM;gBAFtC,OAAO,EAAE,MAAM,EACC,SAAS,EAAE,MAAM,EACjB,aAAa,CAAC,EAAE,MAAM,YAAA,EACtC,OAAO,CAAC,EAAE,OAAO;IAUnB,OAAO,CAAC,iBAAiB;CAG1B;AAED;;GAEG;AACH,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AK,EAAE,KAAK,EACZ,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,QAAQ,CAGV;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb,eAAe,CAOjB;AAED,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,mBAAmB,CAAC,EAAE,MAAM,GAC3B,eAAe,CASjB"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Custom Error Types
|
|
4
|
+
* Typed errors for different failure scenarios
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FileSystemError = exports.ValidationError = exports.APIError = exports.GitError = exports.MCPServerError = void 0;
|
|
8
|
+
exports.createGitError = createGitError;
|
|
9
|
+
exports.createAPIError = createAPIError;
|
|
10
|
+
exports.createValidationError = createValidationError;
|
|
11
|
+
exports.createFileSystemError = createFileSystemError;
|
|
12
|
+
/**
|
|
13
|
+
* Base Error for MCP Server operations
|
|
14
|
+
*/
|
|
15
|
+
class MCPServerError extends Error {
|
|
16
|
+
code;
|
|
17
|
+
details;
|
|
18
|
+
constructor(message, code, details) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.code = code;
|
|
21
|
+
this.details = details;
|
|
22
|
+
this.name = this.constructor.name;
|
|
23
|
+
Error.captureStackTrace(this, this.constructor);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.MCPServerError = MCPServerError;
|
|
27
|
+
/**
|
|
28
|
+
* Git Operation Error
|
|
29
|
+
*/
|
|
30
|
+
class GitError extends MCPServerError {
|
|
31
|
+
operation;
|
|
32
|
+
repositoryUrl;
|
|
33
|
+
constructor(message, operation, repositoryUrl, details) {
|
|
34
|
+
super(message, 'GIT_ERROR', details);
|
|
35
|
+
this.operation = operation;
|
|
36
|
+
this.repositoryUrl = repositoryUrl;
|
|
37
|
+
// Redact credentials from repository URL
|
|
38
|
+
if (this.repositoryUrl) {
|
|
39
|
+
this.repositoryUrl = this.redactCredentials(this.repositoryUrl);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
redactCredentials(url) {
|
|
43
|
+
return url.replace(/:\/\/([^:]+):([^@]+)@/, '://***:***@');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.GitError = GitError;
|
|
47
|
+
/**
|
|
48
|
+
* API Request Error
|
|
49
|
+
*/
|
|
50
|
+
class APIError extends MCPServerError {
|
|
51
|
+
statusCode;
|
|
52
|
+
method;
|
|
53
|
+
url;
|
|
54
|
+
retryCount;
|
|
55
|
+
constructor(message, statusCode, method, url, retryCount, details) {
|
|
56
|
+
super(message, 'API_ERROR', details);
|
|
57
|
+
this.statusCode = statusCode;
|
|
58
|
+
this.method = method;
|
|
59
|
+
this.url = url;
|
|
60
|
+
this.retryCount = retryCount;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.APIError = APIError;
|
|
64
|
+
/**
|
|
65
|
+
* Resource Validation Error
|
|
66
|
+
*/
|
|
67
|
+
class ValidationError extends MCPServerError {
|
|
68
|
+
filePath;
|
|
69
|
+
expectedFormat;
|
|
70
|
+
validationReason;
|
|
71
|
+
constructor(message, filePath, expectedFormat, validationReason, details) {
|
|
72
|
+
super(message, 'VALIDATION_ERROR', details);
|
|
73
|
+
this.filePath = filePath;
|
|
74
|
+
this.expectedFormat = expectedFormat;
|
|
75
|
+
this.validationReason = validationReason;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.ValidationError = ValidationError;
|
|
79
|
+
/**
|
|
80
|
+
* Filesystem Operation Error
|
|
81
|
+
*/
|
|
82
|
+
class FileSystemError extends MCPServerError {
|
|
83
|
+
operation;
|
|
84
|
+
path;
|
|
85
|
+
systemErrorCode;
|
|
86
|
+
suggestedResolution;
|
|
87
|
+
constructor(message, operation, path, systemErrorCode, suggestedResolution, details) {
|
|
88
|
+
super(message, 'FILESYSTEM_ERROR', details);
|
|
89
|
+
this.operation = operation;
|
|
90
|
+
this.path = path;
|
|
91
|
+
this.systemErrorCode = systemErrorCode;
|
|
92
|
+
this.suggestedResolution = suggestedResolution;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.FileSystemError = FileSystemError;
|
|
96
|
+
/**
|
|
97
|
+
* Error Factory Functions
|
|
98
|
+
*/
|
|
99
|
+
function createGitError(operation, error, repositoryUrl) {
|
|
100
|
+
return new GitError(`Git ${operation} failed: ${error.message}`, operation, repositoryUrl, { originalError: error });
|
|
101
|
+
}
|
|
102
|
+
function createAPIError(method, url, error, statusCode, retryCount) {
|
|
103
|
+
const message = `API ${method} ${url} failed: ${error.message}`;
|
|
104
|
+
return new APIError(message, statusCode, method, url, retryCount, { originalError: error });
|
|
105
|
+
}
|
|
106
|
+
function createValidationError(filePath, expectedFormat, reason) {
|
|
107
|
+
return new ValidationError(`Resource validation failed: ${reason}`, filePath, expectedFormat, reason);
|
|
108
|
+
}
|
|
109
|
+
function createFileSystemError(operation, path, error, suggestedResolution) {
|
|
110
|
+
return new FileSystemError(`Filesystem ${operation} failed: ${error.message}`, operation, path, error.code, suggestedResolution, { originalError: error });
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA2FH,wCAWC;AAED,wCASC;AAED,sDAWC;AAED,sDAcC;AA5ID;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAGrB;IACA;IAHlB,YACE,OAAe,EACC,IAAY,EACZ,OAAiB;QAEjC,KAAK,CAAC,OAAO,CA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B,MAAM,EAAE,EACvC,QAAQ,EACR,cAAc,EACd,MAAM,CACP,CAAC;AACJ,CAAC;AAED,SAAgB,qBAAqB,CACnC,SAAiB,EACjB,IAAY,EACZ,KAAgC,EAChC,mBAA4B;IAE5B,OAAO,IAAI,eAAe,CACxB,cAAc,SAAS,YAAY,KAAK,CAAC,OAAO,EAAE,EAClD,SAAS,EACT,IAAI,EACJ,KAAK,CAAC,IAAI,EACV,mBAAmB,EACnB,EAAE,aAAa,EAAE,KAAK,EAAE,CACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type Exports
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./mcp"), exports);
|
|
21
|
+
__exportStar(require("./tools"), exports);
|
|
22
|
+
__exportStar(require("./errors"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Protocol Types
|
|
3
|
+
*/
|
|
4
|
+
export interface MCPToolSchema {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, {
|
|
7
|
+
type: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
enum?: string[];
|
|
10
|
+
default?: unknown;
|
|
11
|
+
}>;
|
|
12
|
+
required?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface MCPToolDefinition {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: MCPToolSchema;
|
|
18
|
+
}
|
|
19
|
+
export interface MCPInitializeRequest {
|
|
20
|
+
protocolVersion: string;
|
|
21
|
+
capabilities: {
|
|
22
|
+
tools?: Record<string, never>;
|
|
23
|
+
};
|
|
24
|
+
clientInfo: {
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface MCPInitializeResponse {
|
|
30
|
+
protocolVersion: string;
|
|
31
|
+
capabilities: {
|
|
32
|
+
tools?: Record<string, never>;
|
|
33
|
+
};
|
|
34
|
+
serverInfo: {
|
|
35
|
+
name: string;
|
|
36
|
+
version: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface MCPToolCallRequest {
|
|
40
|
+
name: string;
|
|
41
|
+
arguments?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export interface MCPToolCallResponse {
|
|
44
|
+
content: Array<{
|
|
45
|
+
type: 'text';
|
|
46
|
+
text: string;
|
|
47
|
+
}>;
|
|
48
|
+
isError?: boolean;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;QACzB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAGD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,aAAa,CAAC;CAC5B;AAGD,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC/B,CAAC;IACF,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAGD,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC/B,CAAC;IACF,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAGD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EA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