BM

bazinga012/mcp_code_executor

Developer tools

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

211 stars 43 forks 품질 65 트렌드 17MIT

bazinga012/mcp_code_executor는 https://github.com/bazinga012/mcp_code_executor.에서 가져온 MCP 서버 후보입니다.

개요

bazinga012/mcp_code_executor는 https://github.com/bazinga012/mcp_code_executor.에서 가져온 MCP 서버 후보입니다.

개요(AI 번역)

MCP 코드 실행 서버는 LLM이 지정된 Python 환경에서 Python 코드를 실행할 수 있도록 하는 MCP 서버입니다. 이를 통해 LLM은 환경에서 정의된 라이브러리와 의존성에 접근할 수 있는 코드를 실행할 수 있습니다. 또한 토큰 한도를 초과할 수 있는 대규모 코드 블록을 처리하기 위한 점진적 코드 생성도 지원합니다.

특징

  • LLM 프롬프트에서 파이썬 코드 실행
  • 토큰 제한을 극복하기 위한 점진적 코드 생성 지원
  • 지정된 환경(Conda, virtualenv, UV virtualenv) 내에서 코드를 실행하기
  • 필요 시 의존성 설치
  • 패키지가 이미 설치되어 있는지 확인
  • 런타임에 환경을 동적으로 구성
  • 구성 가능한 코드 저장 디렉터리

선수 조건

  • Node.js 설치됨
  • 다음 중 하나:
  • 원하는 Conda 환경을 구축한 Conda 설치
  • Python virtualenv
  • UV virtualenv

준비

  1. 이 저장소를 복제:

  2. 프로젝트 디렉터리로 이동하기:

  3. Node.js 의존성 설치:

  4. 프로젝트 구축:

구성

MCP 코드 실행 서버를 구성하려면 MCP 서버 구성 파일에 다음 사항을 추가하세요:

Node.js 사용해

Docker 사용

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

README

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

MCP Code Executor

The MCP Code Executor is an MCP server that allows LLMs to execute Python code within a specified Python environment. This enables LLMs to run code with access to libraries and dependencies defined in the environment. It also supports incremental code generation for handling large code blocks that may exceed token limits.

Features

  • Execute Python code from LLM prompts
  • Support for incremental code generation to overcome token limitations
  • Run code within a specified environment (Conda, virtualenv, or UV virtualenv)
  • Install dependencies when needed
  • Check if packages are already installed
  • Dynamically configure the environment at runtime
  • Configurable code storage directory

Prerequisites

  • Node.js installed
  • One of the following:
    • Conda installed with desired Conda environment created
    • Python virtualenv
    • UV virtualenv

Setup

  1. Clone this repository:
git clone https://github.com/bazinga012/mcp_code_executor.git
  1. Navigate to the project directory:
cd mcp_code_executor
  1. Install the Node.js dependencies:
npm install
  1. Build the project:
npm run build

Configuration

To configure the MCP Code Executor server, add the following to your MCP servers configuration file:

Using Node.js

{
  "mcpServers": {
    "mcp-code-executor": {
      "command": "node",
      "args": [
        "/path/to/mcp_code_executor/build/index.js" 
      ],
      "env": {
        "CODE_STORAGE_DIR": "/path/to/code/storage",
        "ENV_TYPE": "conda",
        "CONDA_ENV_NAME": "your-conda-env"
      }
    }
  }
}

Using Docker

{
  "mcpServers": {
    "mcp-code-executor": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "mcp-code-executor"
      ]
    }
  }
}

Note: The Dockerfile has been tested with the venv-uv environment type only. Other environment types may require additional configuration.

Environment Variables

Required Variables

  • CODE_STORAGE_DIR: Directory where the generated code will be stored

Environment Type (choose one setup)

  • For Conda:

    • ENV_TYPE: Set to conda
    • CONDA_ENV_NAME: Name of the Conda environment to use
  • For Standard Virtualenv:

    • ENV_TYPE: Set to venv
    • VENV_PATH: Path to the virtualenv directory
  • For UV Virtualenv:

    • ENV_TYPE: Set to venv-uv
    • UV_VENV_PATH: Path to the UV virtualenv directory

Available Tools

The MCP Code Executor provides the following tools to LLMs:

1. execute_code

Executes Python code in the configured environment. Best for short code snippets.

GitHub에서 전체 README 보기

설치

docker run -i --rm mcp-code-executor
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "mcp-code-executor": { "command": "node", "args": [ "/path/to/mcp_code_executor/build/index.js" ], "env": { "CODE_STORAGE_DIR": "/path/to/code/storage", "ENV_TYPE": "conda", "CONDA_ENV_NAME": "your-conda-env" } } } }