MCP Python Executor
by bsmi021
The MCP Python Executor is a Model Context Protocol (MCP) server designed for executing Python code and managing Python packages within a controlled environment. It provides a secure and configurable way to run Python scripts and install necessary dependencies.
Last updated: N/A
What is MCP Python Executor?
The MCP Python Executor is a server that allows you to execute Python code and manage Python packages. It is designed to provide a safe and controlled environment for running Python scripts, with features like resource limits and pre-configured packages.
How to use MCP Python Executor?
The server is configured through environment variables in the MCP settings. You can use the execute_python
tool to run Python code either inline or from a script path. The install_packages
tool allows you to install Python packages.
Key features of MCP Python Executor
Execute Python code with safety constraints
Install and manage Python packages
Pre-configure commonly used packages
Resource monitoring and limits
Health checks and metrics
Structured logging
Use cases of MCP Python Executor
Executing Python code snippets in a sandboxed environment
Running automated Python scripts as part of a larger system
Providing a Python execution environment for users with limited access
Managing Python dependencies for different projects
FAQ from MCP Python Executor
How do I specify which Python packages to pre-install?
How do I specify which Python packages to pre-install?
Use the PREINSTALLED_PACKAGES
environment variable to define a space-separated list of packages.
How can I limit the memory usage of a Python execution?
How can I limit the memory usage of a Python execution?
Set the MAX_MEMORY_MB
environment variable to the desired memory limit in megabytes.
What happens if a Python execution takes too long?
What happens if a Python execution takes too long?
The execution will be terminated after the time specified in the EXECUTION_TIMEOUT_MS
environment variable.
How do I execute a Python script from a file?
How do I execute a Python script from a file?
Use the scriptPath
parameter in the execute_python
tool and provide the path to your script.
What logging levels are supported?
What logging levels are supported?
The supported logging levels are debug, info, and error. You can configure it with the LOG_LEVEL
environment variable.