mcp_code_executor

mcp_code_executor

3.6

If you are the rightful owner of mcp_code_executor and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Code Executor is a server that enables LLMs to execute Python code within a specified environment, supporting incremental code generation and dependency management.

The MCP Code Executor is a Model Context Protocol (MCP) server designed to facilitate the execution of Python code by Language Model Machines (LLMs) within a defined Python environment. This server allows LLMs to run code with access to necessary libraries and dependencies, which are specified in the environment. It supports incremental code generation, which is particularly useful for handling large code blocks that may exceed token limits. The server can dynamically configure the environment at runtime, install dependencies as needed, and check if packages are already installed. It also provides a configurable directory for code storage, ensuring that generated code is organized and accessible.

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
  • Dynamically configure the environment at runtime

Tools

  1. execute_code

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

  2. install_dependencies

    Installs Python packages in the environment.

  3. check_installed_packages

    Checks if packages are already installed in the environment.

  4. configure_environment

    Dynamically changes the environment configuration.

  5. get_environment_config

    Gets the current environment configuration.

  6. initialize_code_file

    Creates a new Python file with initial content.

  7. append_to_code_file

    Appends content to an existing Python code file.

  8. execute_code_file

    Executes an existing Python file.

  9. read_code_file

    Reads the content of an existing Python code file.