Runs Python code in the LocalPythonExecutor runtime from Hugging Face smolagents, which restricts allowed operations and imports.
Setup
Choose your client, copy the config, then fill in any required environment variables.
claude mcp add safe-local-python-executor -- uv --directory /path/to/mcp_local_python_executor/ run mcp_server.py~/.codex/config.toml
[mcp_servers.safe-local-python-executor]
command = "uv"
args = ["--directory", "/path/to/mcp_local_python_executor/", "run", "mcp_server.py"]
# codex mcp add safe-local-python-executor -- uv --directory /path/to/mcp_local_python_executor/ run mcp_server.py~/.cursor/mcp.json
{
"mcpServers": {
"safe-local-python-executor": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp_local_python_executor/",
"run",
"mcp_server.py"
]
}
}
}.vscode/mcp.json
{
"servers": {
"safe-local-python-executor": {
"type": "stdio",
"command": "uv",
"args": [
"--directory",
"/path/to/mcp_local_python_executor/",
"run",
"mcp_server.py"
]
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"safe-local-python-executor": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp_local_python_executor/",
"run",
"mcp_server.py"
]
}
}
}claude_desktop_config.json
{
"mcpServers": {
"safe-local-python-executor": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp_local_python_executor/",
"run",
"mcp_server.py"
]
}
}
}.trae/mcp.json
{
"mcpServers": {
"safe-local-python-executor": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp_local_python_executor/",
"run",
"mcp_server.py"
]
}
}
}