mcp-python-interpreter
v1.2.3MCP server for Python code execution and environment management
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_python_environments
List all available Python environments (system Python and conda environments).
list_installed_packages
List installed packages for a specific Python environment. Args: environment: Name of the Python environment
| Parameter | Type | Description |
|---|---|---|
environment | string |
run_python_code
Execute Python code with flexible execution modes. Args: code: Python code to execute execution_mode: Execution mode - "inline" (default, fast, in-process) or "subprocess" (isolated) session_id: Session ID for inline mode to maintain state across executions environment: Python environment name (only for subprocess mode) save_as: Optional filename to save the code before execution timeout: Maximum execution time in seconds (only enforced for subprocess mode) Returns: Execution result with output Execution mo…
| Parameter | Type | Description |
|---|---|---|
code * | string | |
environment | string | |
execution_mode | string | |
save_as | ||
session_id | string | |
timeout | integer |
run_python_file
Execute a Python file (always uses subprocess for file execution). Args: file_path: Path to the Python file to execute environment: Name of the Python environment to use arguments: List of command-line arguments to pass to the script timeout: Maximum execution time in seconds (default: 300)
| Parameter | Type | Description |
|---|---|---|
file_path * | string | |
arguments | ||
environment | string | |
timeout | integer |
install_package
Install a Python package in the specified environment. Args: package_name: Name of the package to install environment: Name of the Python environment upgrade: Whether to upgrade if already installed timeout: Maximum execution time in seconds
| Parameter | Type | Description |
|---|---|---|
package_name * | string | |
environment | string | |
timeout | integer | |
upgrade | boolean |
read_file
Read the content of any file, with size limits for safety. Args: file_path: Path to the file max_size_kb: Maximum file size to read in KB
| Parameter | Type | Description |
|---|---|---|
file_path * | string | |
max_size_kb | integer |
write_file
Write content to a file. Args: file_path: Path to the file to write content: Content to write overwrite: Whether to overwrite if exists
| Parameter | Type | Description |
|---|---|---|
content * | string | |
file_path * | string | |
overwrite | boolean |
list_directory
List all Python files in a directory. Args: directory_path: Path to directory (empty for working directory)
| Parameter | Type | Description |
|---|---|---|
directory_path | string |
clear_session
Clear a REPL session's state and history. Args: session_id: Session ID to clear
| Parameter | Type | Description |
|---|---|---|
session_id | string |
list_sessions
List all active REPL sessions.