MS

maxim-saplin/mcp_safe_local_python_executor

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

48 stars 12 forks 품질 66 트렌드 13MIT

스트로디 MCP Hugging Faces `smolagents` 프레임 워크에서 사용자 정의 파이썬 실행 시간 (LocalPythonExecutor)를 감싸는 서버.

개요

Hugging Face의 LocalPythonExecutor (smolagents 프레임 워크에서)를 감싸는 MCP 서버 (스트 다이 전송). 로컬 LLMs에 의해 생성 된 파이썬 코드를 실행할 때 기본 고립 / 보안을 제공하는 사용자 정의 파이썬 실행 시간입니다. Docker 또는 VM이 필요하지 않습니다. 이 패키지는 Claude Desktop, Cursor 또는 다른 MCP 호환 클라이언트와 같은 LLM 응용 프로그램에 대한 도구로 MCP (모델 Context Protocol)을 통해 파이썬 실행기를 노출 할 수 있습니다. Claude Desktop의 경우이 도구는 누락 된 코드 Interpreter를 추가하는 쉬운 방법입니다 ( 이미 ChatGPT의 플러그인으로 사용 가능).

개요(AI 번역)

MCP 서버(스트디오 전송)는 Hugging Face의 LocalPythonExecutor를 감싸는 ([T1]] 프레임 워크에서). 사용자 정의 파이썬 실행 시간입니다. 로컬 LLM에 의해 생성된 Python 코드를 실행할 때 기본 격리/security를 제공합니다. Docker 또는 VM이 필요하지 않습니다. 이 패키지는 Claude Desktop, Cursor 또는 다른 MCP 호환 클라이언트와 같은 LLM 응용 프로그램에 대한 도구로 MCP (모델 Context Protocol)을 통해 파이썬 실행기를 노출 할 수 있습니다. Claude Desktop의 경우이 도구는 누락 된 코드 Interpreter를 추가하는 쉬운 방법입니다 ( 이미 ChatGPT의 플러그인으로 사용 가능).

특징

  • 노출 run_python 도구
  • Python의 직접 사용과 비교하여 Python 코드의 Safer 실행 eva()l
  • Python venv에서 uv를 통해 Ran
  • 파일 없음 I/O ops 허용
  • 수입의 제한 목록
  • 수집
  • 일정
  • 의자
  • 수학
  • 큐
  • 무작위
  • 재
  • 통계
  • 통계
  • 시간
  • 유니코드데이터

보안

머신에서 LLM에 의해 생성된 코드의 실행에 주의해, 명령행을 통해 파이썬을 실행하거나 eval()]를 사용하여 MCP 서버에서 머물 수 있습니다. 가장 안전한 옵션은 VM 또는 도커 컨테이너를 사용하지만 설정에 대한 노력이 필요하지만 리소스 / 슬로우를 소비합니다.

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

Safe Local Python Executor

An MCP server (stdio transport) that wraps Hugging Face’s LocalPythonExecutor (from the smolagents framework). It is a custom Python runtime that provides basic isolation/security when running Python code generated by LLMs locally. It does not require Docker or VM. 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. 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).

Features

  • Exposes run_python tool
  • Safer execution of Python code compared to direct use of Python eva()l
  • Ran via uv in Python venv
  • No file I/O ops are allowed
  • Restricted list of imports
    • collections
    • datetime
    • itertools
    • math
    • queue
    • random
    • re
    • stat
    • statistics
    • time
    • unicodedata

Security

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.

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:

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.

Read more here.

Installation and Execution

Installing via Smithery

To install Safe Local Python Executor for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @maxim-saplin/mcp_safe_local_python_executor --client claude

Installing Manually

  1. Install uv (e.h. brew install uv on macOS or use official docs)
  2. Clone the repo, change the directory cd mcp_safe_local_python_executor
GitHub에서 전체 README 보기

설치

npx -y @smithery/cli install @maxim-saplin/mcp_safe_local_python_executor --client claude
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "safe-local-python-executor": { "command": "uv", "args": [ "--directory", "/path/to/mcp_local_python_executor/", "run", "mcp_server.py" ] } } }