MCP Code Executor

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Allows LLMs to execute Python code within a specified Conda environment with access to libraries and dependencies

MCP代码执行器

MCP 代码执行器是一个 MCP 服务器,允许 LLM 在指定的 Conda 环境中执行 Python 代码。这使得 LLM 能够运行代码并访问 Conda 环境中定义的库和依赖项。

特征

  • 从 LLM 提示执行 Python 代码
  • 在指定的 Conda 环境中运行代码
  • 可配置代码存储目录

先决条件

  • Node.js 已安装
  • Conda 安装
  • 所需的 Conda 环境已创建

设置

  1. 克隆此存储库:
git clone https://github.com/bazinga012/mcp_code_executor.git
  1. 导航到项目目录:
cd mcp_code_executor
  1. 安装 Node.js 依赖项:
npm install
  1. 构建项目:
npm run build

配置

要配置 MCP Code Executor 服务器,请将以下内容添加到 MCP 服务器配置文件中:

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

替换占位符:

  • /path/to/mcp_code_executor为您克隆此存储库的绝对路径
  • /path/to/code/storage为要存储生成的代码的目录
  • your-conda-env为您希望代码在其中运行的 Conda 环境的名称

用法

配置完成后,MCP 代码执行器将允许 LLM 通过在指定的CODE_STORAGE_DIR中生成文件并在CONDA_ENV_NAME定义的 Conda 环境中运行它来执行 Python 代码。

LLM 可以通过在其提示中引用此 MCP 服务器来生成和执行代码。

贡献

欢迎贡献!请打开一个问题或提交一个拉取请求。

执照

该项目已获得 MIT 许可。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

允许 LLM 在指定的 Conda 环境中执行 Python 代码,从而能够访问必要的库和依赖项以实现高效的代码执行。

  1. Features
    1. Prerequisites
      1. Setup
        1. Configuration
          1. Usage
            1. Contributing
              1. License
                ID: 45ix8xode3