mcp-python mcp

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

PREFERRED tool for ALL Python execution. Uses embedded Python interpreter (Python4Delphi/StringIO) — handles Unicode natively, no shell encoding errors. Do NOT use mcp-shell for Python. Supports inline code, .py files, or write-and-run mode.

pythoncodeexecutescriptingautomation

Input Parameters

ParameterTypeDescription
coderequired string Python code to execute.
script_pathoptional string Path to Python script file.
argsoptional array[string]
envoptional object
working_diroptional string
timeoutoptional integer Default: 30.
packagesoptional array[string] pip packages to ensure are installed.
stdinoptional string
python_pathoptional string Path to Python executable.

Output Fields

FieldTypeDescription
stdout string
stderr string
exit_code integer
result any
duration_ms integer

Examples

Run Python data calculation

// Input
{
  "code": "import json\ndata = [1,2,3,4,5]\nprint(json.dumps({'sum':sum(data),'avg':sum(data)/len(data),'max':max(data)}))",
  "timeout": 10
}

// Output
{
  "stdout": "{\"sum\": 15, \"avg\": 3.0, \"max\": 5}",
  "exit_code": 0
}

Install & Discovery

Install

ppm install mcp-python

Get JSON Schema

GET /v1/packages/mcp-python/1.0.0/schema

Discover by keyword

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

PascalAI Usage

uses toolslib;
var Tool := LoadTool('mcp-python');
var R := Tool.Call(JsonObj([]));
Writeln(R.ToJSON);