mcp_safe_local_python_executor

mcp_safe_local_python_executor

18

The Safe Local Python Executor is an MCP server designed to securely execute Python code generated by LLMs locally. It offers a custom Python runtime without requiring Docker or virtual machines, ensuring safer execution through restricted operations and imports.

Safe Local Python Executor

An MCP server that wraps Hugging Face's LocalPythonExecutor, providing a custom Python runtime for securely executing Python code generated by LLMs locally, without the need for Docker or virtual machines.

Features

  • Exposes a run_python tool for safer Python code execution
  • Operates within a restricted environment with a limited set of imports
  • Ensures no file I/O operations are allowed

Security

Promotes safer code execution on local machines without relying on less secure methods like direct command line execution or eval().

Installation and Execution

  • Can be installed via Smithery or manually
  • Requires uv installation

Configuring Claude Desktop

Instructions to integrate and use with Claude for Desktop are provided, ensuring the Python executor tool is accessible.

Development

Development setup instructions include creating a virtual environment, installing dependencies, and running tests.