mseep-mcp-safe-local-python-executor 0.1.2__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (14) hide show
  1. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/PKG-INFO +5 -9
  2. mseep_mcp_safe_local_python_executor-0.1.3/README.md +113 -0
  3. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/mseep_mcp_safe_local_python_executor.egg-info/PKG-INFO +5 -9
  4. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/mseep_mcp_safe_local_python_executor.egg-info/SOURCES.txt +0 -1
  5. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/pyproject.toml +8 -5
  6. mseep_mcp_safe_local_python_executor-0.1.2/README.md +0 -1
  7. mseep_mcp_safe_local_python_executor-0.1.2/setup.py +0 -20
  8. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/LICENSE +0 -0
  9. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/mseep_mcp_safe_local_python_executor.egg-info/dependency_links.txt +0 -0
  10. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/mseep_mcp_safe_local_python_executor.egg-info/requires.txt +0 -0
  11. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/mseep_mcp_safe_local_python_executor.egg-info/top_level.txt +0 -0
  12. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/setup.cfg +0 -0
  13. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/tests/test_local_python_executor.py +0 -0
  14. {mseep_mcp_safe_local_python_executor-0.1.2 → mseep_mcp_safe_local_python_executor-0.1.3}/tests/test_mcp_server.py +0 -0
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mseep-mcp_safe_local_python_executor
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: MCP server exposing tool for a safe local Python code execution
5
- Home-page:
6
- Author: mseep
7
5
  Author-email: mseep <support@skydeck.ai>
8
- Maintainer-email: mseep <support@skydeck.ai>
9
6
  License: MIT
7
+ Project-URL: Homepage, https://github.com/maxim-saplin/mcp_safe_local_python_executor/tree/main
10
8
  Classifier: Development Status :: 3 - Alpha
11
9
  Classifier: Intended Audience :: Developers
12
10
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
@@ -15,13 +13,11 @@ Classifier: Programming Language :: Python :: 3.11
15
13
  Classifier: Programming Language :: Python :: 3.12
16
14
  Classifier: Programming Language :: Python :: 3.13
17
15
  Classifier: Operating System :: OS Independent
18
- Requires-Python: >=3.6
19
- Description-Content-Type: text/markdown
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/plain
20
18
  License-File: LICENSE
21
19
  Requires-Dist: mcp[cli]>=1.5.0
22
20
  Requires-Dist: smolagents==1.12.0
23
- Dynamic: author
24
21
  Dynamic: license-file
25
- Dynamic: requires-python
26
22
 
27
- # Package managed by MseeP.ai
23
+ Package managed by MseeP.ai
@@ -0,0 +1,113 @@
1
+ # Safe Local Python Executor
2
+
3
+ An MCP server (stdio transport) that wraps Hugging Face's [`LocalPythonExecutor`](https://github.com/huggingface/smolagents/blob/main/src/smolagents/local_python_executor.py)
4
+ (from the [`smolagents`](https://huggingface.co/docs/smolagents/en/index) framework). It is a custom Python runtime that
5
+ provides basic isolation/security when running Python code generated by LLMs locally. It does not require Docker or VM.
6
+ This package allows to expose the Python executor via MCP (Model Context Protocol) as a tool for LLM apps like Claude Desktop, Cursor or any other MCP compatible client.
7
+ In case of Claude Desktop this tool is an easy way to add a missing Code Interpreter (available as a plugin in ChatGPT for quite a while already).
8
+
9
+ <img width="1032" alt="image" src="https://github.com/user-attachments/assets/3b820bfc-970a-4315-8f2d-970591c6fdae" />
10
+
11
+ ## Features
12
+
13
+ - Exposes `run_python` tool
14
+ - Safer execution of Python code compared to direct use of Python `eva()l`
15
+ - Ran via uv in Python venv
16
+ - No file I/O ops are allowed
17
+ - Restricted list of imports
18
+ - collections
19
+ - datetime
20
+ - itertools
21
+ - math
22
+ - queue
23
+ - random
24
+ - re
25
+ - stat
26
+ - statistics
27
+ - time
28
+ - unicodedata
29
+
30
+ ## Security
31
+
32
+ Be careful with execution of code produced by LLM on your machine, stay away from MCP servers that run Python via command line or using `eval()`. The safest option is using a VM or a docker container, though it requires some effort to set-up, consumes resources/slower. There're 3rd party servcices providing Python runtime, though they require registration, API keys etc.
33
+
34
+ `LocalPythonExecutor` provides a good balance between direct use of local Python environment (which is easier to set-up) AND remote execution in Dokcer container or a VM/3rd party service (which is safe). Hugginng Face team has invested time into creating a quick and safe option to run LLM generated code used by their code agents. This MCP server builds upon it:
35
+
36
+ >To add a first layer of security, code execution in smolagents is not performed by the vanilla Python interpreter. We have re-built a more secure LocalPythonExecutor from the ground up.
37
+
38
+ Read more [here](https://huggingface.co/docs/smolagents/en/tutorials/secure_code_execution#local-code-execution).
39
+
40
+ ## Installation and Execution
41
+
42
+ ### Installing via Smithery
43
+
44
+ To install Safe Local Python Executor for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@maxim-saplin/mcp_safe_local_python_executor):
45
+
46
+ ```bash
47
+ npx -y @smithery/cli install @maxim-saplin/mcp_safe_local_python_executor --client claude
48
+ ```
49
+
50
+ ### Installing Manually
51
+ 1. Install `uv` (e.h. `brew install uv` on macOS or use [official docs](https://docs.astral.sh/uv/getting-started/installation/#__tabbed_1_2))
52
+ 2. Clone the repo, change the directory `cd mcp_safe_local_python_executor`
53
+ 3. The server can be started via command line `uv run mcp_server.py`, venv will be created automatically, depedencies (smollagents, mcp) will be installed
54
+
55
+
56
+ ## Configuring Claude Desktop
57
+
58
+ 1. Make sure you have Claude for Desktop installed (download from [claude.ai](https://claude.ai/desktop))
59
+ 2. Edit your Claude for Desktop configuration file:
60
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
61
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
62
+ - Or open Claude Desktop -> Settings -> Developer -> click "Edit Config" button
63
+
64
+ 3. Add the following configuration:
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "safe-local-python-executor": {
70
+ "command": "uv",
71
+ "args": [
72
+ "--directory",
73
+ "/path/to/mcp_local_python_executor/",
74
+ "run",
75
+ "mcp_server.py"
76
+ ]
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ 4. Restart Claude for Desktop
83
+ 5. The Python executor tool will now be available in Claude (you'll see hammer icon in the message input field)
84
+
85
+ ## Example Prompts
86
+
87
+ Once configured, you can use prompts like:
88
+
89
+ - "Calculate the factorial of 5 using Python"
90
+ - "Create a list of prime numbers up to 100"
91
+ - "Solve this equation (use Python): x^2 + 5x + 6 = 0"
92
+
93
+
94
+ ## Development
95
+
96
+ Clone the repo. Use `uv` to create venv, install dev dependencies, run tests:
97
+
98
+ ```
99
+ uv venv .venv
100
+ uv sync --group dev
101
+ python -m pytest tests/
102
+ ```
103
+
104
+ -----------------------
105
+
106
+ <a href="https://glama.ai/mcp/servers/@maxim-saplin/mcp_safe_local_python_executor">
107
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/@maxim-saplin/mcp_safe_local_python_executor/badge" />
108
+ </a>
109
+
110
+ [![smithery badge](https://smithery.ai/badge/@maxim-saplin/mcp_safe_local_python_executor)](https://smithery.ai/server/@maxim-saplin/mcp_safe_local_python_executor)
111
+
112
+ [![MseeP.ai Security Assessment Badge](https://mseep.net/pr/maxim-saplin-mcp-safe-local-python-executor-badge.png)](https://mseep.ai/app/maxim-saplin-mcp-safe-local-python-executor)
113
+
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mseep-mcp_safe_local_python_executor
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: MCP server exposing tool for a safe local Python code execution
5
- Home-page:
6
- Author: mseep
7
5
  Author-email: mseep <support@skydeck.ai>
8
- Maintainer-email: mseep <support@skydeck.ai>
9
6
  License: MIT
7
+ Project-URL: Homepage, https://github.com/maxim-saplin/mcp_safe_local_python_executor/tree/main
10
8
  Classifier: Development Status :: 3 - Alpha
11
9
  Classifier: Intended Audience :: Developers
12
10
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
@@ -15,13 +13,11 @@ Classifier: Programming Language :: Python :: 3.11
15
13
  Classifier: Programming Language :: Python :: 3.12
16
14
  Classifier: Programming Language :: Python :: 3.13
17
15
  Classifier: Operating System :: OS Independent
18
- Requires-Python: >=3.6
19
- Description-Content-Type: text/markdown
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/plain
20
18
  License-File: LICENSE
21
19
  Requires-Dist: mcp[cli]>=1.5.0
22
20
  Requires-Dist: smolagents==1.12.0
23
- Dynamic: author
24
21
  Dynamic: license-file
25
- Dynamic: requires-python
26
22
 
27
- # Package managed by MseeP.ai
23
+ Package managed by MseeP.ai
@@ -1,7 +1,6 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- setup.py
5
4
  mseep_mcp_safe_local_python_executor.egg-info/PKG-INFO
6
5
  mseep_mcp_safe_local_python_executor.egg-info/SOURCES.txt
7
6
  mseep_mcp_safe_local_python_executor.egg-info/dependency_links.txt
@@ -7,9 +7,8 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "mseep-mcp_safe_local_python_executor"
10
- version = "0.1.2"
10
+ version = "0.1.3"
11
11
  description = "MCP server exposing tool for a safe local Python code execution"
12
- readme = "README.md"
13
12
  authors = [
14
13
  { name = "mseep", email = "support@skydeck.ai" },
15
14
  ]
@@ -28,13 +27,17 @@ dependencies = [
28
27
  "mcp[cli]>=1.5.0",
29
28
  "smolagents==1.12.0",
30
29
  ]
31
- maintainers = [
32
- { name = "mseep", email = "support@skydeck.ai" },
33
- ]
30
+
31
+ [project.readme]
32
+ content-type = "text/plain"
33
+ text = "Package managed by MseeP.ai"
34
34
 
35
35
  [project.license]
36
36
  text = "MIT"
37
37
 
38
+ [project.urls]
39
+ Homepage = "https://github.com/maxim-saplin/mcp_safe_local_python_executor/tree/main"
40
+
38
41
  [dependency-groups]
39
42
  dev = [
40
43
  "pytest>=7.0.0",
@@ -1 +0,0 @@
1
- # Package managed by MseeP.ai
@@ -1,20 +0,0 @@
1
-
2
- from setuptools import setup, find_packages
3
-
4
- setup(
5
- name="mseep-mcp_safe_local_python_executor",
6
- version="0.1.0",
7
- description="MCP server exposing tool for a safe local Python code execution",
8
- author="mseep",
9
- author_email="support@skydeck.ai",
10
- url="",
11
- packages=find_packages(),
12
- classifiers=[
13
- "Programming Language :: Python :: 3",
14
- "License :: OSI Approved :: MIT License",
15
- "Operating System :: OS Independent",
16
- ],
17
- python_requires=">=3.6",
18
- install_requires=['mcp[cli]>=1.5.0', 'smolagents==1.12.0'],
19
- keywords=["mseep"] + [],
20
- )