mcp-code-exec mcp

v1.0.0 · MCP Tool · system · registry.pascalai.org

Execute code in multiple languages via local runtime. Operations: exec (run code snippet), exec_file (run a script file), eval_expr (evaluate expression). Supports Python, JavaScript, Lua, Shell. Requires the language runtime to be installed.

codeexecutepythonjavascriptscriptingsandbox

Input Parameters

ParameterTypeDescription
operationrequired string exec: run code string; exec_file: run a file; eval_expr: evaluate expression and return value. One of: exec, exec_file, eval_expr.
coderequired string Code to execute (for exec/eval_expr).
argsoptional string Command-line arguments JSON array or string.
timeoutSecoptional integer Execution timeout in seconds (default: 30). Default: 30.
databasePathoptional string SQLite database path for SQLite eval_expr operations.
workDiroptional string Working directory for execution.

Output Fields

FieldTypeDescription
stdout string
stderr string
exitCode integer
result string
ok boolean
error string

Examples

Execute Python code

// Input
{
  "operation": "exec",
  "code": "print(sum(range(10)))"
}

// Output
{
  "stdout": "45\n",
  "exitCode": 0,
  "ok": true
}

Install & Discovery

Install

ppm install mcp-code-exec

Get JSON Schema

GET /v1/packages/mcp-code-exec/1.0.0/schema

Discover by keyword

GET /v1/mcp/discover?q=code
Discovery hint: Install with ppm install mcp-code-exec or invoke remotely via POST /v1/invoke/mcp-code-exec on the MCP Service.

PascalAI Usage

uses toolslib;
var Tool := LoadTool('mcp-code-exec');
var R := Tool.Call(JsonObj(['operation','exec','code','print(1+1)']));
Writeln(R.ToJSON);