@justanothermldude/mcp-exec 0.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/README.md +344 -0
- package/dist/bridge/index.d.ts +3 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +3 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge/server.d.ts +84 -0
- package/dist/bridge/server.d.ts.map +1 -0
- package/dist/bridge/server.js +352 -0
- package/dist/bridge/server.js.map +1 -0
- package/dist/codegen/index.d.ts +6 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/index.js +6 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/module-resolver.d.ts +95 -0
- package/dist/codegen/module-resolver.d.ts.map +1 -0
- package/dist/codegen/module-resolver.js +152 -0
- package/dist/codegen/module-resolver.js.map +1 -0
- package/dist/codegen/wrapper-generator.d.ts +22 -0
- package/dist/codegen/wrapper-generator.d.ts.map +1 -0
- package/dist/codegen/wrapper-generator.js +282 -0
- package/dist/codegen/wrapper-generator.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -0
- package/dist/sandbox/config.d.ts +37 -0
- package/dist/sandbox/config.d.ts.map +1 -0
- package/dist/sandbox/config.js +36 -0
- package/dist/sandbox/config.js.map +1 -0
- package/dist/sandbox/executor.d.ts +63 -0
- package/dist/sandbox/executor.d.ts.map +1 -0
- package/dist/sandbox/executor.js +240 -0
- package/dist/sandbox/executor.js.map +1 -0
- package/dist/sandbox/index.d.ts +8 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +9 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/server.d.ts +110 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +150 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/execute-batch.d.ts +111 -0
- package/dist/tools/execute-batch.d.ts.map +1 -0
- package/dist/tools/execute-batch.js +325 -0
- package/dist/tools/execute-batch.js.map +1 -0
- package/dist/tools/execute-code.d.ts +65 -0
- package/dist/tools/execute-code.d.ts.map +1 -0
- package/dist/tools/execute-code.js +141 -0
- package/dist/tools/execute-code.js.map +1 -0
- package/dist/tools/execute-with-context.d.ts +80 -0
- package/dist/tools/execute-with-context.d.ts.map +1 -0
- package/dist/tools/execute-with-context.js +223 -0
- package/dist/tools/execute-with-context.js.map +1 -0
- package/dist/tools/execute-with-wrappers.d.ts +69 -0
- package/dist/tools/execute-with-wrappers.d.ts.map +1 -0
- package/dist/tools/execute-with-wrappers.js +219 -0
- package/dist/tools/execute-with-wrappers.js.map +1 -0
- package/dist/tools/get-tool-schema.d.ts +59 -0
- package/dist/tools/get-tool-schema.d.ts.map +1 -0
- package/dist/tools/get-tool-schema.js +101 -0
- package/dist/tools/get-tool-schema.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +16 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-servers.d.ts +48 -0
- package/dist/tools/list-servers.d.ts.map +1 -0
- package/dist/tools/list-servers.js +85 -0
- package/dist/tools/list-servers.js.map +1 -0
- package/dist/types/execution.d.ts +25 -0
- package/dist/types/execution.d.ts.map +1 -0
- package/dist/types/execution.js +5 -0
- package/dist/types/execution.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool definition for get_mcp_tool_schema
|
|
3
|
+
*/
|
|
4
|
+
export const getMcpToolSchemaTool = {
|
|
5
|
+
name: 'get_mcp_tool_schema',
|
|
6
|
+
description: 'Get the full schema for a specific MCP tool. Use this to discover tool parameters before calling them.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
server: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The name of the MCP server that has the tool',
|
|
13
|
+
},
|
|
14
|
+
tool: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'The name of the tool to get the schema for',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['server', 'tool'],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Creates the get_mcp_tool_schema handler function
|
|
24
|
+
*
|
|
25
|
+
* @param pool - ServerPool instance for managing connections
|
|
26
|
+
* @returns Handler function for get_mcp_tool_schema tool
|
|
27
|
+
*/
|
|
28
|
+
export function createGetToolSchemaHandler(pool) {
|
|
29
|
+
/**
|
|
30
|
+
* Get tool schema handler - fetches schema for a specific tool from a server
|
|
31
|
+
*/
|
|
32
|
+
return async function getToolSchemaHandler(args) {
|
|
33
|
+
const { server, tool } = args;
|
|
34
|
+
try {
|
|
35
|
+
// Get connection to the specified server
|
|
36
|
+
const connection = await pool.getConnection(server);
|
|
37
|
+
// Fetch all tools from the server
|
|
38
|
+
const tools = await connection.getTools();
|
|
39
|
+
// Find the matching tool by name
|
|
40
|
+
const matchedTool = tools.find((t) => t.name === tool);
|
|
41
|
+
if (!matchedTool) {
|
|
42
|
+
// Provide helpful error with available tool names
|
|
43
|
+
const availableTools = tools.map((t) => t.name).sort();
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: `Tool '${tool}' not found on server '${server}'. Available tools: ${availableTools.join(', ')}`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
isError: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// Return the full tool schema
|
|
55
|
+
return {
|
|
56
|
+
content: [{ type: 'text', text: JSON.stringify(matchedTool, null, 2) }],
|
|
57
|
+
isError: false,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
62
|
+
// Check if it's a connection/server error and provide helpful suggestions
|
|
63
|
+
if (errorMessage.includes('not found') ||
|
|
64
|
+
errorMessage.includes('unknown server')) {
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: 'text',
|
|
69
|
+
text: `Error connecting to server '${server}': ${errorMessage}. Use list_available_mcp_servers to see available servers.`,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
isError: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{
|
|
78
|
+
type: 'text',
|
|
79
|
+
text: `Error getting tool schema: ${errorMessage}`,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
isError: true,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Type guard for GetToolSchemaInput
|
|
89
|
+
*/
|
|
90
|
+
export function isGetToolSchemaInput(args) {
|
|
91
|
+
if (typeof args !== 'object' || args === null) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const input = args;
|
|
95
|
+
// Both server and tool are required and must be strings
|
|
96
|
+
if (typeof input.server !== 'string' || typeof input.tool !== 'string') {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=get-tool-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-tool-schema.js","sourceRoot":"","sources":["../../src/tools/get-tool-schema.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,wGAAwG;IAC1G,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,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|
+
export { executeCodeTool, createExecuteCodeHandler, isExecuteCodeInput, type CallToolResult, type TextContent, type ExecuteCodeHandlerConfig, } from './execute-code.js';
|
|
5
|
+
export { listAvailableMcpServersTool, createListServersHandler, isListServersInput, type ListServersInput, } from './list-servers.js';
|
|
6
|
+
export { getMcpToolSchemaTool, createGetToolSchemaHandler, isGetToolSchemaInput, type GetToolSchemaInput, } from './get-tool-schema.js';
|
|
7
|
+
export { executeCodeWithWrappersTool, createExecuteWithWrappersHandler, isExecuteWithWrappersInput, type ExecuteWithWrappersInput, type ExecuteWithWrappersHandlerConfig, } from './execute-with-wrappers.js';
|
|
8
|
+
export { executeBatchTool, createExecuteBatchHandler, isExecuteBatchInput, type ExecuteBatchInput, type ExecuteBatchHandlerConfig, type Snippet, type SnippetResult, } from './execute-batch.js';
|
|
9
|
+
export { executeWithContextTool, createExecuteWithContextHandler, isExecuteWithContextInput, type ExecuteWithContextInput, type ExecuteWithContextHandlerConfig, } from './execute-with-context.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,wBAAwB,GAC9B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,kBAAkB,GACxB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,gCAAgC,GACtC,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,OAAO,EACZ,KAAK,aAAa,GACnB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAC/B,yBAAyB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,+BAA+B,GACrC,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tools module exports for mcp-exec
|
|
3
|
+
*/
|
|
4
|
+
// Export execute_code tool
|
|
5
|
+
export { executeCodeTool, createExecuteCodeHandler, isExecuteCodeInput, } from './execute-code.js';
|
|
6
|
+
// Export list_available_mcp_servers tool
|
|
7
|
+
export { listAvailableMcpServersTool, createListServersHandler, isListServersInput, } from './list-servers.js';
|
|
8
|
+
// Export get_mcp_tool_schema tool
|
|
9
|
+
export { getMcpToolSchemaTool, createGetToolSchemaHandler, isGetToolSchemaInput, } from './get-tool-schema.js';
|
|
10
|
+
// Export execute_code_with_wrappers tool
|
|
11
|
+
export { executeCodeWithWrappersTool, createExecuteWithWrappersHandler, isExecuteWithWrappersInput, } from './execute-with-wrappers.js';
|
|
12
|
+
// Export execute_batch tool
|
|
13
|
+
export { executeBatchTool, createExecuteBatchHandler, isExecuteBatchInput, } from './execute-batch.js';
|
|
14
|
+
// Export execute_with_context tool
|
|
15
|
+
export { executeWithContextTool, createExecuteWithContextHandler, isExecuteWithContextInput, } from './execute-with-context.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,2BAA2B;AAC3B,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,kBAAkB,GAInB,MAAM,mBAAmB,CAAC;AAE3B,yCAAyC;AACzC,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,GAEnB,MAAM,mBAAmB,CAAC;AAE3B,kCAAkC;AAClC,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,GAErB,MAAM,sBAAsB,CAAC;AAE9B,yCAAyC;AACzC,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,GAG3B,MAAM,4BAA4B,CAAC;AAEpC,4BAA4B;AAC5B,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,GAKpB,MAAM,oBAAoB,CAAC;AAE5B,mCAAmC;AACnC,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAC/B,yBAAyB,GAG1B,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input type for list_available_mcp_servers tool
|
|
3
|
+
*/
|
|
4
|
+
export interface ListServersInput {
|
|
5
|
+
filter?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* MCP Tool definition for list_available_mcp_servers
|
|
9
|
+
*/
|
|
10
|
+
export declare const listAvailableMcpServersTool: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object";
|
|
15
|
+
properties: {
|
|
16
|
+
filter: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
required: string[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* CallToolResult content item
|
|
26
|
+
*/
|
|
27
|
+
export interface TextContent {
|
|
28
|
+
type: 'text';
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Standard MCP CallToolResult format
|
|
33
|
+
*/
|
|
34
|
+
export interface CallToolResult {
|
|
35
|
+
content: TextContent[];
|
|
36
|
+
isError?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates the list_available_mcp_servers handler function
|
|
40
|
+
*
|
|
41
|
+
* @returns Handler function for list_available_mcp_servers tool
|
|
42
|
+
*/
|
|
43
|
+
export declare function createListServersHandler(): (args: ListServersInput) => Promise<CallToolResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Type guard for ListServersInput
|
|
46
|
+
*/
|
|
47
|
+
export declare function isListServersInput(args: unknown): args is ListServersInput;
|
|
48
|
+
//# sourceMappingURL=list-servers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-servers.d.ts","sourceRoot":"","sources":["../../src/tools/list-servers.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;kBAYpB,MAAM,EAAE;;CAE3B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,KAKpC,MAAM,gBAAgB,KACrB,OAAO,CAAC,cAAc,CAAC,CAwC3B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,gBAAgB,CAU1E"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* list_available_mcp_servers MCP tool handler
|
|
3
|
+
* Lists all available MCP servers with optional filtering
|
|
4
|
+
*/
|
|
5
|
+
import { listServers } from '@justanothermldude/meta-mcp-core';
|
|
6
|
+
/**
|
|
7
|
+
* MCP Tool definition for list_available_mcp_servers
|
|
8
|
+
*/
|
|
9
|
+
export const listAvailableMcpServersTool = {
|
|
10
|
+
name: 'list_available_mcp_servers',
|
|
11
|
+
description: 'List available MCP servers with their names, descriptions, and tags. Optionally filter by name or tag.',
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
filter: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'Optional filter string to match server names, descriptions, or tags',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: [],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Creates the list_available_mcp_servers handler function
|
|
25
|
+
*
|
|
26
|
+
* @returns Handler function for list_available_mcp_servers tool
|
|
27
|
+
*/
|
|
28
|
+
export function createListServersHandler() {
|
|
29
|
+
/**
|
|
30
|
+
* List servers handler - gets available servers and applies optional filter
|
|
31
|
+
*/
|
|
32
|
+
return async function listServersHandler(args) {
|
|
33
|
+
const { filter } = args;
|
|
34
|
+
try {
|
|
35
|
+
// Get all available servers from the registry
|
|
36
|
+
let servers = listServers();
|
|
37
|
+
// Apply filter if provided
|
|
38
|
+
if (filter && typeof filter === 'string') {
|
|
39
|
+
const filterLower = filter.toLowerCase();
|
|
40
|
+
servers = servers.filter((server) => {
|
|
41
|
+
// Match against name
|
|
42
|
+
if (server.name.toLowerCase().includes(filterLower)) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
// Match against description
|
|
46
|
+
if (server.description?.toLowerCase().includes(filterLower)) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
// Match against tags
|
|
50
|
+
if (server.tags?.some((tag) => tag.toLowerCase().includes(filterLower))) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Format and return result
|
|
57
|
+
return {
|
|
58
|
+
content: [{ type: 'text', text: JSON.stringify(servers, null, 2) }],
|
|
59
|
+
isError: false,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
64
|
+
return {
|
|
65
|
+
content: [{ type: 'text', text: `Error listing servers: ${errorMessage}` }],
|
|
66
|
+
isError: true,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Type guard for ListServersInput
|
|
73
|
+
*/
|
|
74
|
+
export function isListServersInput(args) {
|
|
75
|
+
if (typeof args !== 'object' || args === null) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const input = args;
|
|
79
|
+
// filter is optional, but if provided must be a string
|
|
80
|
+
if ('filter' in input && typeof input.filter !== 'string') {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=list-servers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-servers.js","sourceRoot":"","sources":["../../src/tools/list-servers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WAAW,EAA4B,MAAM,kCAAkC,CAAC;AASzF;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,4BAA4B;IAClC,WAAW,EACT,wGAAwG;IAC1G,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qEAAqE;aACnF;SACF;QACD,QAAQ,EAAE,EAAc;KACzB;CACF,CAAC;AAkBF;;;;GAIG;AACH,MAAM,UAAU,wBAAwB;IACtC;;OAEG;IACH,OAAO,KAAK,UAAU,kBAAkB,CACtC,IAAsB;QAEtB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAExB,IAAI,CAAC;YACH,8CAA8C;YAC9C,IAAI,OAAO,G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A0B,YAAY,EAAE,EAAE,CAAC;gBAC3E,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAa;IAC9C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,IAA+B,CAAC;IAC9C,uDAAuD;IACvD,IAAI,QAAQ,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input for code execution requests
|
|
3
|
+
*/
|
|
4
|
+
export interface ExecuteCodeInput {
|
|
5
|
+
/** The code to execute */
|
|
6
|
+
code: string;
|
|
7
|
+
/** Execution timeout in milliseconds (default: 30000) */
|
|
8
|
+
timeout_ms?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Result of code execution
|
|
12
|
+
*/
|
|
13
|
+
export interface ExecutionResult {
|
|
14
|
+
/** Output lines from execution */
|
|
15
|
+
output: string[];
|
|
16
|
+
/** Error message if execution failed */
|
|
17
|
+
error?: string;
|
|
18
|
+
/** Execution duration in milliseconds */
|
|
19
|
+
durationMs: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Default timeout for code execution (30 seconds)
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
25
|
+
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/types/execution.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/types/execution.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,cAAc,gBAAgB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@justanothermldude/mcp-exec",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP execution utilities for sandboxed code execution with OS-level isolation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"dev": "tsc --watch",
|
|
14
|
+
"clean": "rm -rf dist",
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"test:integration": "vitest run tests/integration.test.ts"
|
|
17
|
+
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"mcp-exec": "dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@anthropic-ai/sandbox-runtime": "^0.0.19",
|
|
23
|
+
"@justanothermldude/meta-mcp-core": "^0.1.0",
|
|
24
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
25
|
+
"esbuild": "^0.24.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@modelcontextprotocol/server-filesystem": "^2025.11.25",
|
|
29
|
+
"@types/node": "^20.10.6",
|
|
30
|
+
"typescript": "^5.3.3"
|
|
31
|
+
}
|
|
32
|
+
}
|