sub-agents-mcp 0.1.2

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 (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +265 -0
  3. package/dist/agents/AgentManager.d.ts +58 -0
  4. package/dist/agents/AgentManager.d.ts.map +1 -0
  5. package/dist/agents/AgentManager.js +182 -0
  6. package/dist/agents/AgentManager.js.map +1 -0
  7. package/dist/config/ServerConfig.d.ts +34 -0
  8. package/dist/config/ServerConfig.d.ts.map +1 -0
  9. package/dist/config/ServerConfig.js +54 -0
  10. package/dist/config/ServerConfig.js.map +1 -0
  11. package/dist/execution/AgentExecutor.d.ts +114 -0
  12. package/dist/execution/AgentExecutor.d.ts.map +1 -0
  13. package/dist/execution/AgentExecutor.js +234 -0
  14. package/dist/execution/AgentExecutor.js.map +1 -0
  15. package/dist/execution/ExecutionLimits.d.ts +141 -0
  16. package/dist/execution/ExecutionLimits.d.ts.map +1 -0
  17. package/dist/execution/ExecutionLimits.js +231 -0
  18. package/dist/execution/ExecutionLimits.js.map +1 -0
  19. package/dist/execution/McpRequestTimeout.d.ts +166 -0
  20. package/dist/execution/McpRequestTimeout.d.ts.map +1 -0
  21. package/dist/execution/McpRequestTimeout.js +278 -0
  22. package/dist/execution/McpRequestTimeout.js.map +1 -0
  23. package/dist/execution/PromptController.d.ts +92 -0
  24. package/dist/execution/PromptController.d.ts.map +1 -0
  25. package/dist/execution/PromptController.js +130 -0
  26. package/dist/execution/PromptController.js.map +1 -0
  27. package/dist/execution/StreamProcessor.d.ts +23 -0
  28. package/dist/execution/StreamProcessor.d.ts.map +1 -0
  29. package/dist/execution/StreamProcessor.js +51 -0
  30. package/dist/execution/StreamProcessor.js.map +1 -0
  31. package/dist/execution/TimeoutManager.d.ts +159 -0
  32. package/dist/execution/TimeoutManager.d.ts.map +1 -0
  33. package/dist/execution/TimeoutManager.js +283 -0
  34. package/dist/execution/TimeoutManager.js.map +1 -0
  35. package/dist/index.d.ts +10 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +51 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/resources/AgentResources.d.ts +104 -0
  40. package/dist/resources/AgentResources.d.ts.map +1 -0
  41. package/dist/resources/AgentResources.js +315 -0
  42. package/dist/resources/AgentResources.js.map +1 -0
  43. package/dist/server/McpServer.d.ts +138 -0
  44. package/dist/server/McpServer.d.ts.map +1 -0
  45. package/dist/server/McpServer.js +373 -0
  46. package/dist/server/McpServer.js.map +1 -0
  47. package/dist/tools/RunAgentTool.d.ts +140 -0
  48. package/dist/tools/RunAgentTool.d.ts.map +1 -0
  49. package/dist/tools/RunAgentTool.js +371 -0
  50. package/dist/tools/RunAgentTool.js.map +1 -0
  51. package/dist/types/AgentDefinition.d.ts +33 -0
  52. package/dist/types/AgentDefinition.d.ts.map +1 -0
  53. package/dist/types/AgentDefinition.js +3 -0
  54. package/dist/types/AgentDefinition.js.map +1 -0
  55. package/dist/types/ExecutionParams.d.ts +48 -0
  56. package/dist/types/ExecutionParams.d.ts.map +1 -0
  57. package/dist/types/ExecutionParams.js +3 -0
  58. package/dist/types/ExecutionParams.js.map +1 -0
  59. package/dist/types/ServerConfig.d.ts +39 -0
  60. package/dist/types/ServerConfig.d.ts.map +1 -0
  61. package/dist/types/ServerConfig.js +3 -0
  62. package/dist/types/ServerConfig.js.map +1 -0
  63. package/dist/types/index.d.ts +19 -0
  64. package/dist/types/index.d.ts.map +1 -0
  65. package/dist/types/index.js +3 -0
  66. package/dist/types/index.js.map +1 -0
  67. package/dist/utils/ErrorHandler.d.ts +86 -0
  68. package/dist/utils/ErrorHandler.d.ts.map +1 -0
  69. package/dist/utils/ErrorHandler.js +99 -0
  70. package/dist/utils/ErrorHandler.js.map +1 -0
  71. package/dist/utils/Logger.d.ts +99 -0
  72. package/dist/utils/Logger.d.ts.map +1 -0
  73. package/dist/utils/Logger.js +151 -0
  74. package/dist/utils/Logger.js.map +1 -0
  75. package/package.json +92 -0
@@ -0,0 +1,371 @@
1
+ "use strict";
2
+ /**
3
+ * RunAgentTool implementation for executing Claude Code sub-agents via MCP
4
+ *
5
+ * Provides the run_agent tool that allows MCP clients to execute specific
6
+ * agents with parameters, integrating with AgentExecutor and AgentManager
7
+ * for complete agent execution workflow.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.RunAgentTool = void 0;
11
+ const Logger_1 = require("../utils/Logger");
12
+ /**
13
+ * RunAgentTool class implementing the run_agent MCP tool
14
+ *
15
+ * Provides execution of Claude Code sub-agents with parameter validation,
16
+ * error handling, and proper MCP response formatting.
17
+ */
18
+ class RunAgentTool {
19
+ constructor(agentExecutor, agentManager) {
20
+ this.agentExecutor = agentExecutor;
21
+ this.agentManager = agentManager;
22
+ this.name = 'run_agent';
23
+ this.description = 'Execute a Claude Code sub-agent with specified parameters';
24
+ this.executionStats = new Map();
25
+ this.inputSchema = {
26
+ type: 'object',
27
+ properties: {
28
+ agent: {
29
+ type: 'string',
30
+ description: 'Name of the agent to execute',
31
+ },
32
+ prompt: {
33
+ type: 'string',
34
+ description: 'Prompt to send to the agent',
35
+ },
36
+ cwd: {
37
+ type: 'string',
38
+ description: 'Working directory for agent execution',
39
+ },
40
+ extra_args: {
41
+ type: 'array',
42
+ items: { type: 'string' },
43
+ description: 'Additional command line arguments',
44
+ },
45
+ },
46
+ required: ['agent', 'prompt'],
47
+ };
48
+ // Use LOG_LEVEL environment variable if available
49
+ const logLevel = process.env['LOG_LEVEL'] || 'info';
50
+ this.logger = new Logger_1.Logger(logLevel);
51
+ }
52
+ /**
53
+ * Execute the run_agent tool with the provided parameters
54
+ *
55
+ * @param params - Tool execution parameters
56
+ * @returns Promise resolving to MCP tool response
57
+ * @throws {Error} When parameters are invalid or execution fails
58
+ */
59
+ async execute(params) {
60
+ const startTime = Date.now();
61
+ const requestId = this.generateRequestId();
62
+ this.logger.info('Run agent tool execution started', {
63
+ requestId,
64
+ timestamp: new Date().toISOString(),
65
+ });
66
+ try {
67
+ // Validate parameters with enhanced validation
68
+ const validatedParams = this.validateParams(params);
69
+ this.logger.debug('Parameters validated successfully', {
70
+ requestId,
71
+ agent: validatedParams.agent,
72
+ promptLength: validatedParams.prompt.length,
73
+ cwd: validatedParams.cwd,
74
+ extraArgsCount: validatedParams.extra_args?.length || 0,
75
+ });
76
+ // Check if agent exists
77
+ if (this.agentManager) {
78
+ const agent = await this.agentManager.getAgent(validatedParams.agent);
79
+ if (!agent) {
80
+ this.logger.warn('Agent not found', {
81
+ requestId,
82
+ requestedAgent: validatedParams.agent,
83
+ });
84
+ return this.createErrorResponse(`Agent '${validatedParams.agent}' not found`, await this.getAvailableAgentsList());
85
+ }
86
+ this.logger.debug('Agent found and validated', {
87
+ requestId,
88
+ agentName: agent.name,
89
+ agentDescription: agent.description,
90
+ });
91
+ }
92
+ // Execute agent if executor is available
93
+ if (this.agentExecutor) {
94
+ // Report progress: Starting agent execution
95
+ // Get agent definition content if available
96
+ let agentContext = validatedParams.agent;
97
+ if (this.agentManager) {
98
+ const agent = await this.agentManager.getAgent(validatedParams.agent);
99
+ if (agent?.content) {
100
+ // Include full agent definition content as system context
101
+ agentContext = agent.content;
102
+ }
103
+ }
104
+ const executionParams = {
105
+ agent: agentContext,
106
+ prompt: validatedParams.prompt,
107
+ ...(validatedParams.cwd !== undefined && { cwd: validatedParams.cwd }),
108
+ ...(validatedParams.extra_args !== undefined && {
109
+ extra_args: validatedParams.extra_args,
110
+ }),
111
+ };
112
+ // Report progress: Executing agent
113
+ // Execute agent (this has its own timeout: MCP -> AI)
114
+ const result = await this.agentExecutor.executeAgent(executionParams);
115
+ // Report progress: Execution completed
116
+ // Update execution statistics
117
+ this.updateExecutionStats(validatedParams.agent, result.executionTime);
118
+ this.logger.info('Agent execution completed successfully', {
119
+ requestId,
120
+ agent: validatedParams.agent,
121
+ exitCode: result.exitCode,
122
+ executionTime: result.executionTime,
123
+ totalTime: Date.now() - startTime,
124
+ });
125
+ // Mark MCP request as completed
126
+ return this.formatExecutionResponse(result, validatedParams.agent, requestId);
127
+ }
128
+ // Fallback response if executor is not available
129
+ this.logger.warn('Agent executor not available', { requestId });
130
+ return {
131
+ content: [
132
+ {
133
+ type: 'text',
134
+ text: `Agent execution request received for '${validatedParams.agent}' with prompt: "${validatedParams.prompt}"\n\nNote: Agent executor not initialized.`,
135
+ },
136
+ ],
137
+ };
138
+ }
139
+ catch (error) {
140
+ const totalTime = Date.now() - startTime;
141
+ this.logger.error('Agent execution failed', error instanceof Error ? error : undefined, {
142
+ requestId,
143
+ totalTime,
144
+ errorType: error instanceof Error ? error.constructor.name : 'Unknown',
145
+ });
146
+ return this.createErrorResponse(`Agent execution failed: ${error instanceof Error ? error.message : 'Unknown error'}`, null);
147
+ }
148
+ }
149
+ /**
150
+ * Validate and type-check the input parameters with comprehensive validation
151
+ *
152
+ * @private
153
+ * @param params - Raw parameters to validate
154
+ * @returns Validated parameters
155
+ * @throws {Error} When parameters are invalid
156
+ */
157
+ validateParams(params) {
158
+ if (!params || typeof params !== 'object') {
159
+ throw new Error('Invalid parameters: expected object');
160
+ }
161
+ const p = params;
162
+ // Validate required agent parameter with enhanced checks
163
+ if (!p['agent'] || typeof p['agent'] !== 'string') {
164
+ throw new Error('Agent parameter is required and must be a string');
165
+ }
166
+ const agentName = p['agent'].trim();
167
+ if (agentName === '') {
168
+ throw new Error('Invalid agent parameter: cannot be empty');
169
+ }
170
+ // Enhanced agent name validation
171
+ if (agentName.length > 100) {
172
+ throw new Error('Agent name too long (max 100 characters)');
173
+ }
174
+ if (!/^[a-zA-Z0-9_-]+$/.test(agentName)) {
175
+ throw new Error('Agent name contains invalid characters (only alphanumeric, underscore, and dash allowed)');
176
+ }
177
+ // Validate required prompt parameter with enhanced checks
178
+ if (!p['prompt'] || typeof p['prompt'] !== 'string') {
179
+ throw new Error('Prompt parameter is required and must be a string');
180
+ }
181
+ const prompt = p['prompt'].trim();
182
+ if (prompt === '') {
183
+ throw new Error('Invalid prompt parameter: cannot be empty');
184
+ }
185
+ if (prompt.length > 50000) {
186
+ throw new Error('Prompt too long (max 50,000 characters)');
187
+ }
188
+ // Validate optional cwd parameter with path validation
189
+ if (p['cwd'] !== undefined) {
190
+ if (typeof p['cwd'] !== 'string') {
191
+ throw new Error('CWD parameter must be a string if provided');
192
+ }
193
+ if (p['cwd'].length > 1000) {
194
+ throw new Error('Working directory path too long (max 1000 characters)');
195
+ }
196
+ // Basic path security check - prevent obvious malicious paths
197
+ if (p['cwd'].includes('..') || p['cwd'].includes('\0')) {
198
+ throw new Error('Invalid working directory path');
199
+ }
200
+ }
201
+ // Validate optional extra_args parameter with enhanced checks
202
+ if (p['extra_args'] !== undefined) {
203
+ if (!Array.isArray(p['extra_args'])) {
204
+ throw new Error('Extra args parameter must be an array if provided');
205
+ }
206
+ if (p['extra_args'].length > 20) {
207
+ throw new Error('Too many extra arguments (max 20 allowed)');
208
+ }
209
+ for (const [index, arg] of p['extra_args'].entries()) {
210
+ if (typeof arg !== 'string') {
211
+ throw new Error(`Extra argument at index ${index} must be a string`);
212
+ }
213
+ if (arg.length > 1000) {
214
+ throw new Error(`Extra argument at index ${index} too long (max 1000 characters)`);
215
+ }
216
+ }
217
+ }
218
+ return {
219
+ agent: agentName,
220
+ prompt: prompt,
221
+ cwd: p['cwd'],
222
+ extra_args: p['extra_args'],
223
+ };
224
+ }
225
+ /**
226
+ * Format agent execution response
227
+ *
228
+ * @private
229
+ * @param result - Agent execution result
230
+ * @param agentName - Name of the executed agent
231
+ * @param requestId - Request tracking ID
232
+ * @returns Formatted MCP response
233
+ */
234
+ formatExecutionResponse(result, agentName, requestId) {
235
+ // Determine execution status
236
+ const isSuccess = result.exitCode === 0 || // Normal completion
237
+ (result.exitCode === 143 && result.hasResult === true); // SIGTERM with result
238
+ const isPartialSuccess = result.exitCode === 124 && result.hasResult === true; // Timeout with partial result
239
+ const isError = !isSuccess && !isPartialSuccess;
240
+ // Content is just the agent's actual output
241
+ const contentText = result.stdout || result.stderr || 'No output';
242
+ // All metadata goes to structuredContent
243
+ const structuredContent = {
244
+ agent: agentName,
245
+ exitCode: result.exitCode,
246
+ executionTime: result.executionTime,
247
+ hasResult: result.hasResult || false,
248
+ status: isSuccess ? 'success' : isPartialSuccess ? 'partial' : 'error',
249
+ };
250
+ if (result.resultJson) {
251
+ structuredContent['result'] = result.resultJson;
252
+ }
253
+ if (result.stderr && result.stdout) {
254
+ // Only include stderr in structured content if we also have stdout
255
+ // Otherwise stderr is already in content
256
+ structuredContent['stderr'] = result.stderr;
257
+ }
258
+ if (requestId) {
259
+ structuredContent['requestId'] = requestId;
260
+ }
261
+ // Update statistics
262
+ const stats = this.executionStats.get(agentName);
263
+ if (stats) {
264
+ structuredContent['usageCount'] = stats.count;
265
+ structuredContent['averageTime'] = Math.round(stats.totalTime / stats.count);
266
+ }
267
+ return {
268
+ content: [
269
+ {
270
+ type: 'text',
271
+ text: contentText,
272
+ },
273
+ ],
274
+ isError: isError,
275
+ structuredContent,
276
+ };
277
+ }
278
+ /**
279
+ * Create error response with optional available agents list
280
+ *
281
+ * @private
282
+ * @param errorMessage - Error message to display
283
+ * @param availableAgents - Optional list of available agents
284
+ * @returns Error response in MCP format
285
+ */
286
+ createErrorResponse(errorMessage, availableAgents) {
287
+ let responseText = `Error: ${errorMessage}`;
288
+ if (availableAgents && availableAgents.length > 0) {
289
+ responseText += `\n\nAvailable agents:\n${availableAgents.map((name) => `- ${name}`).join('\n')}`;
290
+ }
291
+ const errorStructuredContent = {
292
+ status: 'error',
293
+ error: errorMessage,
294
+ };
295
+ if (availableAgents) {
296
+ errorStructuredContent['availableAgents'] = availableAgents;
297
+ }
298
+ return {
299
+ content: [
300
+ {
301
+ type: 'text',
302
+ text: responseText,
303
+ },
304
+ ],
305
+ isError: true,
306
+ structuredContent: errorStructuredContent,
307
+ };
308
+ }
309
+ /**
310
+ * Generate unique request ID for tracking
311
+ *
312
+ * @private
313
+ * @returns Unique request identifier
314
+ */
315
+ generateRequestId() {
316
+ return `run_agent_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
317
+ }
318
+ /**
319
+ * Update execution statistics
320
+ *
321
+ * @private
322
+ * @param agentName - Name of the executed agent
323
+ * @param executionTime - Time taken for execution
324
+ */
325
+ updateExecutionStats(agentName, executionTime) {
326
+ const existing = this.executionStats.get(agentName);
327
+ if (existing) {
328
+ existing.count += 1;
329
+ existing.totalTime += executionTime;
330
+ existing.lastUsed = new Date();
331
+ }
332
+ else {
333
+ this.executionStats.set(agentName, {
334
+ count: 1,
335
+ totalTime: executionTime,
336
+ lastUsed: new Date(),
337
+ });
338
+ }
339
+ }
340
+ /**
341
+ * Get execution statistics for monitoring
342
+ *
343
+ * @returns Map of agent execution statistics
344
+ */
345
+ getExecutionStats() {
346
+ return new Map(this.executionStats);
347
+ }
348
+ /**
349
+ * Get list of available agent names
350
+ *
351
+ * @private
352
+ * @returns Promise resolving to array of agent names
353
+ */
354
+ async getAvailableAgentsList() {
355
+ if (!this.agentManager) {
356
+ return null;
357
+ }
358
+ try {
359
+ const agents = await this.agentManager.listAgents();
360
+ return agents.map((agent) => agent.name);
361
+ }
362
+ catch (error) {
363
+ this.logger.warn('Failed to get available agents list', {
364
+ error: error instanceof Error ? error.message : 'Unknown error',
365
+ });
366
+ return null;
367
+ }
368
+ }
369
+ }
370
+ exports.RunAgentTool = RunAgentTool;
371
+ //# sourceMappingURL=RunAgentTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunAgentTool.js","sourceRoot":"","sources":["../../src/tools/RunAgentTool.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAKH,6CAAwD;AA0DxD;;;;;GAKG;AACH,MAAa,YAAY;IA+BvB,YACU,aAA6B,EAC7B,YAA2B;QAD3B,kBAAa,GAAb,aAAa,CAAgB;QAC7B,iBAAY,GAAZ,YAAY,CAAe;QAhCrB,SAAI,GAAG,WAAW,CAAA;QAClB,gBAAW,GAAG,2DAA2D,CAAA;QAEjF,mBAAc,GACpB,IAAI,GA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,IAAI,EAAE,CAAA;QAChC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE;gBACjC,KAAK,EAAE,CAAC;gBACR,SAAS,EAAE,aAAa;gBACxB,QAAQ,EAAE,IAAI,IAAI,EAAE;aACrB,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,iBAAiB;QACf,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IACrC,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,sBAAsB;QAClC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAA;YACnD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,EAAE;gBACtD,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAChE,CAAC,CAAA;YACF,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF;AAxaD,oCAwaC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Represents an AI agent definition loaded from a markdown file.
3
+ * This interface defines the structure for Claude Code sub-agent format files
4
+ * that contain agent instructions and metadata.
5
+ */
6
+ export interface AgentDefinition {
7
+ /**
8
+ * The unique name identifier of the agent.
9
+ * Used as the key for agent selection and execution.
10
+ */
11
+ name: string;
12
+ /**
13
+ * Human-readable description of what the agent does.
14
+ * Provides context about the agent's purpose and capabilities.
15
+ */
16
+ description: string;
17
+ /**
18
+ * The full content/instructions for the agent.
19
+ * Contains the markdown content with agent directives and examples.
20
+ */
21
+ content: string;
22
+ /**
23
+ * Absolute file path where the agent definition is stored.
24
+ * Used for file watching and cache invalidation.
25
+ */
26
+ filePath: string;
27
+ /**
28
+ * Timestamp when the agent definition file was last modified.
29
+ * Used for cache invalidation and version tracking.
30
+ */
31
+ lastModified: Date;
32
+ }
33
+ //# sourceMappingURL=AgentDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentDefinition.d.ts","sourceRoot":"","sources":["../../src/types/AgentDefinition.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,YAAY,EAAE,IAAI,CAAA;CACnB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=AgentDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentDefinition.js","sourceRoot":"","sources":["../../src/types/AgentDefinition.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Parameters for executing an AI agent through the MCP server.
3
+ * These parameters are passed to the run_agent tool to initiate agent execution.
4
+ */
5
+ export interface ExecutionParams {
6
+ /**
7
+ * Name of the agent to execute.
8
+ * Must match a loaded agent definition name.
9
+ */
10
+ agent: string;
11
+ /**
12
+ * User prompt/instructions to send to the agent.
13
+ * This is the input that will be processed by the agent.
14
+ */
15
+ prompt: string;
16
+ /**
17
+ * Optional working directory for the agent execution.
18
+ * If not provided, uses the current working directory.
19
+ */
20
+ cwd?: string;
21
+ /**
22
+ * Optional additional command line arguments.
23
+ * These are passed to the Claude Code CLI when executing the agent.
24
+ */
25
+ extra_args?: string[];
26
+ }
27
+ /**
28
+ * Result returned from agent execution.
29
+ * Contains the execution status and output/error information.
30
+ */
31
+ export interface ExecutionResult {
32
+ /**
33
+ * Whether the agent execution was successful.
34
+ * True indicates successful completion, false indicates failure.
35
+ */
36
+ success: boolean;
37
+ /**
38
+ * Output content from the agent execution.
39
+ * Contains the agent's response or execution result.
40
+ */
41
+ output: string;
42
+ /**
43
+ * Error message if execution failed.
44
+ * Only present when success is false.
45
+ */
46
+ error?: string;
47
+ }
48
+ //# sourceMappingURL=ExecutionParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutionParams.d.ts","sourceRoot":"","sources":["../../src/types/ExecutionParams.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ExecutionParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExecutionParams.js","sourceRoot":"","sources":["../../src/types/ExecutionParams.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Configuration interface for the MCP server.
3
+ * Defines the structure for server configuration parameters
4
+ * loaded from environment variables or defaults.
5
+ */
6
+ export interface ServerConfigInterface {
7
+ /**
8
+ * Name identifier of the MCP server.
9
+ * Used in server registration and client communication.
10
+ */
11
+ serverName: string;
12
+ /**
13
+ * Version of the MCP server.
14
+ * Used in server identification and client compatibility checking.
15
+ */
16
+ serverVersion: string;
17
+ /**
18
+ * Directory path containing agent definition files.
19
+ * The server scans this directory for .md files containing agent definitions.
20
+ */
21
+ agentsDir: string;
22
+ /**
23
+ * Type of agent to use for execution.
24
+ * 'cursor' or 'claude'
25
+ */
26
+ agentType: 'cursor' | 'claude';
27
+ /**
28
+ * Log level for server operations.
29
+ * Controls verbosity of server logging output.
30
+ */
31
+ logLevel: 'debug' | 'info' | 'warn' | 'error';
32
+ /**
33
+ * Maximum execution timeout in milliseconds for agent execution.
34
+ * Configurable via EXECUTION_TIMEOUT_MS environment variable.
35
+ * Default: 90000ms (90 seconds), Range: 1000ms - 240000ms (4 minutes)
36
+ */
37
+ executionTimeoutMs: number;
38
+ }
39
+ //# sourceMappingURL=ServerConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerConfig.d.ts","sourceRoot":"","sources":["../../src/types/ServerConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;;OAGG;IACH,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAE9B;;;OAGG;IACH,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;IAE7C;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAA;CAC3B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ServerConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerConfig.js","sourceRoot":"","sources":["../../src/types/ServerConfig.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Central export point for all type definitions used in the MCP server.
3
+ *
4
+ * This module provides type definitions for:
5
+ * - Agent definitions and metadata
6
+ * - Execution parameters and results
7
+ * - Server configuration
8
+ * - Type guards for runtime validation
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import type { AgentDefinition, ExecutionParams } from 'src/types/types'
13
+ * import { isAgentDefinition, isExecutionParams } from 'src/types/types'
14
+ * ```
15
+ */
16
+ export type { AgentDefinition } from '../types/AgentDefinition';
17
+ export type { ExecutionParams, ExecutionResult } from '../types/ExecutionParams';
18
+ export type { ServerConfigInterface } from '../types/ServerConfig';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AACjF,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Error context information for detailed error reporting.
3
+ */
4
+ export interface ErrorContext {
5
+ /** Request ID for tracing */
6
+ requestId?: string;
7
+ /** Operation being performed when error occurred */
8
+ operation?: string;
9
+ /** Additional metadata relevant to the error */
10
+ metadata?: Record<string, unknown>;
11
+ /** Timestamp when error occurred */
12
+ timestamp?: Date;
13
+ /** Component or service where error originated */
14
+ component?: string;
15
+ }
16
+ /**
17
+ * Base application error class for structured error handling.
18
+ *
19
+ * Provides a standardized way to handle errors throughout the application
20
+ * with error codes, HTTP status codes, and contextual information for proper
21
+ * error response handling and debugging.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * throw new AppError('Agent not found', 'AGENT_NOT_FOUND', 404, {
26
+ * requestId: 'req_123',
27
+ * operation: 'agent_execution',
28
+ * component: 'AgentManager'
29
+ * })
30
+ * ```
31
+ */
32
+ export declare class AppError extends Error {
33
+ /** Error code for programmatic error identification */
34
+ readonly code: string;
35
+ /** HTTP status code for error response handling */
36
+ readonly statusCode: number;
37
+ /** Context information for debugging and tracing */
38
+ readonly context: ErrorContext;
39
+ /**
40
+ * Creates a new AppError instance.
41
+ *
42
+ * @param message - Human-readable error message
43
+ * @param code - Error code for programmatic identification
44
+ * @param statusCode - HTTP status code (default: 500)
45
+ * @param context - Additional context information
46
+ */
47
+ constructor(message: string, code: string, statusCode?: number, context?: ErrorContext);
48
+ /**
49
+ * Converts error to a structured object for logging or API responses.
50
+ *
51
+ * @returns Structured error object
52
+ */
53
+ toJSON(): Record<string, unknown>;
54
+ /**
55
+ * Creates a user-friendly error message without sensitive information.
56
+ *
57
+ * @returns User-friendly error message
58
+ */
59
+ toUserMessage(): string;
60
+ }
61
+ /**
62
+ * Validation error class for input validation failures.
63
+ *
64
+ * Used when user input fails validation checks such as format validation,
65
+ * required field checks, or constraint violations.
66
+ * Automatically sets HTTP status code to 400 (Bad Request).
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * throw new ValidationError('Invalid email format', 'INVALID_EMAIL', {
71
+ * operation: 'user_input_validation',
72
+ * metadata: { field: 'email', value: 'invalid-email' }
73
+ * })
74
+ * ```
75
+ */
76
+ export declare class ValidationError extends AppError {
77
+ /**
78
+ * Creates a new ValidationError instance.
79
+ *
80
+ * @param message - Description of the validation failure
81
+ * @param code - Error code for the specific validation failure
82
+ * @param context - Additional context information
83
+ */
84
+ constructor(message: string, code: string, context?: ErrorContext);
85
+ }
86
+ //# sourceMappingURL=ErrorHandler.d.ts.map