MCP 코드 샌드박스 서버
격리된 샌드박스 환경에서 안전한 코드 실행 기능을 제공하는 확장 가능한 메시지 통신 프로토콜(MCP) 서버입니다. 이 서버는 MCP 표준을 준수하므로 Claude for Desktop 및 기타 MCP 클라이언트와 호환됩니다.
특징
코드 실행을 위한 격리된 샌드박스 환경 생성
Python 코드를 안전하게 실행하세요
파일 작업 수행(나열, 읽기, 쓰기)
샌드박스에 Python 패키지 설치
추상화된 코드 인터프리터 인터페이스를 갖춘 확장 가능한 아키텍처
관심사를 깔끔하게 분리한 모듈식 디자인
건축학
서버는 모듈식 확장 가능 아키텍처로 구축되었습니다.
핵심 구성 요소
추상 인터프리터 인터페이스 : 다양한 코드 실행 백엔드를 통합할 수 있습니다.
샌드박스 관리 : 샌드박스 환경을 만들고 관리하기 위한 도구
코드 실행 : 코드 실행 및 패키지 설치를 위한 도구
파일 작업 : 샌드박스 내에서 파일을 관리하기 위한 도구
프로젝트 구조
지엑스피1
필수 조건
Python 3.10 이상
E2B API 키(기본 E2B 인터프리터용)
설치
이 저장소를 복제하세요:
git clone https://github.com/yourusername/mcp-code-sandbox.git cd mcp-code-sandbox가상 환경 설정:
# Using venv python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Or using uv (recommended) uv init uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate필요한 패키지를 설치하세요:
# Using pip pip install fastmcp python-dotenv e2b-code-interpreter # Or using uv uv add fastmcp python-dotenv e2b-code-interpreter환경 변수 구성:
# Create a .env file with the following variables E2B_API_KEY=your_e2b_api_key_here INTERPRETER_TYPE=e2b # Default, can be changed to other implemented interpreters
용법
서버 독립 실행형 실행
명령줄에서 직접 서버를 실행할 수 있습니다.
이렇게 하면 stdio 전송을 사용하여 서버가 시작되어 데스크톱용 Claude와 호환됩니다.
Claude와 함께 데스크톱 사용
Claude for Desktop의 최신 버전이 설치되어 있는지 확인하세요.
Claude for Desktop 구성 파일을 엽니다.
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
코드 샌드박스 서버 구성을 추가합니다.
{ "mcpServers": { "code-sandbox": { "command": "python", "args": [ "/ABSOLUTE/PATH/TO/main.py" ] } } }또는
uv사용하는 경우:{ "mcpServers": { "code-sandbox": { "command": "uv", "args": [ "--directory", "/ABSOLUTE/PATH/TO/PROJECT_DIRECTORY", "run", "main.py" ] } } }파일을 저장하고 Claude for Desktop을 다시 시작하세요.
사용 가능한 도구
서버는 다음과 같은 도구를 제공합니다.
샌드박스 관리
create_sandbox : 새로운 샌드박스 환경을 만듭니다.
close_sandbox : 샌드박스를 닫고 정리합니다.
get_sandbox_status : 샌드박스 상태 확인
코드 실행
execute_code : 샌드박스에서 Python 코드 실행
install_package : Python 패키지를 설치합니다
create_run_close : 샌드박스를 생성하고, 코드를 실행하고, 정리하는 올인원 도구
파일 작업
list_files : 샌드박스에 있는 파일 목록
read_file : 파일의 내용을 읽습니다
write_file : 파일에 내용을 씁니다.
upload_file : 샌드박스에 파일 업로드
새로운 통역사로 확장
이 시스템은 확장 가능하도록 설계되었습니다. 새 코드 인터프리터를 추가하려면 다음을 수행하세요.
인터프리터 구현을 위해
src/sandbox/아래에 새 디렉토리를 만듭니다.src/sandbox/code_interpreter.py및src/sandbox/file_interface.py에 정의된 인터페이스를 구현합니다.src/sandbox/interpreter_factory.py에 새로운 인터프리터 유형을 추가합니다.새 인터프리터에 환경 변수
INTERPRETER_TYPE구성하세요.
새로운 인터프리터를 구현하는 예:
모듈 설명
샌드박스 코어( src/sandbox/ )
code_interpreter.py: 코드 인터프리터를 위한 추상 기본 클래스file_interface.py: 파일 작업을 위한 추상 인터페이스interpreter_factory.py: 코드 인터프리터 인스턴스를 생성하기 위한 팩토리
E2B 구현( src/sandbox/e2b/ )
e2b_interpreter.py: 코드 인터프리터의 E2B 구현e2b_file_interface.py: 파일 작업의 E2B 구현
도구( tools/ )
sandbox_tools.py: 샌드박스 관리 도구code_execution_tools.py: 코드 실행 도구file_tools.py: 파일 작업을 위한 도구
주요 응용 프로그램
main.py: 메인 애플리케이션 진입점
문제 해결
문제가 발생하는 경우:
선택한 인터프리터에 맞는 올바른 API 키가 있는지 확인하세요.
자세한 오류 메시지는 로그에서 확인하세요.
모든 필수 패키지가 설치되었는지 확인하세요
Claude for Desktop이 스크립트에 대한 올바른 경로로 구성되었는지 확인하세요.
보안 고려 사항
안전을 위해 코드 실행은 샌드박스 환경에서 이루어집니다.
프로덕션 환경에서 신뢰할 수 없는 코드를 실행하려면 이 서버를 사용하지 마십시오.
현재 서버는 인증을 구현하지 않습니다. 신뢰할 수 있는 환경에서만 사용해야 합니다.
특허
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Claude for Desktop 및 기타 MCP 클라이언트와 호환되는 격리된 샌드박스 환경에서 안전한 코드 실행 기능을 제공하는 확장 가능한 메시지 통신 프로토콜 서버입니다.
Related MCP Servers
- -security-license-qualityA Model Context Protocol server built with mcp-framework that allows users to create and manage custom tools for processing data, integrating with the Claude Desktop via CLI.Last updated -325
- Asecurity-licenseAqualityAn MCP server that allows Claude to interact with Discord by providing tools for sending/reading messages and managing server resources through Discord's API.Last updated -19103
- Asecurity-licenseAqualityA server built with mcp-framework that allows users to extend Claude's capabilities by adding custom tools that can be used through the Claude Desktop client.Last updated -331
- -security-license-qualityA server implementation of the Model Context Protocol that allows users to extend Claude's capabilities by creating custom tools that can be used within the Claude Desktop client.