- Home
- MCP servers
- Code Execution
Code Execution
- python
22
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"hoangnb24-mcp-code-mode": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/your-working-folder"
]
}
}
}You run a Code Execution MCP Server that lets an AI agent write and execute Python code in a controlled sandbox while calling external MCP tools. This approach reduces back-and-forth tool calls by letting the agent generate a complete script that orchestrates tasks, improves efficiency, and keeps execution isolated for safety.
How to use
Install and configure your MCP server, then run it and connect your MCP client to start sending tasks. You will configure the available MCP tools, supply the execution environment, and provide a task for the agent to perform. The agent will generate Python code that orchestrates tool calls locally and returns the result.
How to install
Prerequisites you need before installing:
- Python 3.11 or newer
- Node.js 20 or newer
- Internet access to install dependencies and packages
- A working directory for the local filesystem tools (optional)
# Create a virtual environment and activate it
python3.11 -m venv .venv
source .venv/bin/activate
# Install server dependencies in editable mode with development extras
pip install -e .[dev]
# Install Node.js dependencies for reference servers
npm install -g npm@latest
Configure the MCP server and run it
Set up your environment and specify the MCP servers you want to interact with. A local filesystem server can be configured to perform local file system operations.
# Copy the example environment file to your working environment
cp .env.example .env
# Create or edit the MCP server configuration to declare the available servers
{
"servers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/your-working-folder"],
"description": "Local file system operations"
}
}
}
Run the server and test
Launch the Code Execution MCP server, then verify the setup with a debug run that simulates an MCP client performing a test task.
python -m mcp_code_mode.executor_server
python scripts/debug_executor.py
Additional setup and checks
Before testing, ensure you have configured the MCP servers in the configuration file and that the test task is defined in the debug script. If you see timeouts or missing tools, restart the server or reconnect the client to refresh the interpreter state. If a tool is missing, double-check the server paths in your configuration and run the necessary npm install steps for Node-based servers.
Available tools
execute_code
Exposes an execute_code tool that runs Python code inside a configured executor (LocalPythonExecutor or Pyodide sandbox) and returns the execution result.