- Home
- MCP servers
- Code Execution
Code Execution
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 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": {
"marc-shade-code-execution-mcp": {
"command": "/mnt/agentic-system/.venv/bin/python3",
"args": [
"/mnt/agentic-system/mcp-servers/code-execution-mcp/src/code_execution_mcp/server.py"
]
}
}
}You use the Code Execution MCP to run Python code inside a secure sandbox, discover tools on demand, and return summarized results. This approach minimizes token usage while keeping your data private and processing fast, making it ideal for AI-driven workflows that need flexible, on-demand tool integration.
How to use
To operate, you run code inside a protected sandbox, request tool definitions only when you need them, and work with summaries rather than full datasets. Your workflow can progressively discover tools by category, sanitize sensitive data before it leaves the sandbox, and save reusable code snippets as skills for future sessions. When you execute code, the system returns concise results that you can feed back into subsequent steps, enabling efficient, scalable AI-assisted processing.
How to install
cd /mnt/agentic-system/mcp-servers/code-execution-mcp
pip install -e .
Additional sections
Configuration, security, and practical usage notes follow to help you set up and operate the Code Execution MCP effectively.
Configuration
{
"mcpServers": {
"code_execution": {
"command": "/mnt/agentic-system/.venv/bin/python3",
"args": ["/mnt/agentic-system/mcp-servers/code-execution-mcp/src/code_execution_mcp/server.py"],
"disabled": false
}
}
}
Security notes
Code runs inside a sandbox with restricted builtins and no network access. Resources are limited to prevent runaway execution, and file access is confined to the workspace directory. This setup helps protect your environment while still enabling powerful on-demand tool usage.
Usage tips
-
Use progressive tool discovery to search for tools by query without loading definitions. Retrieve summaries first, then load full definitions only when you need them. Group tools by category such as security, memory, or cluster.
-
Sanitize PII before processing to replace sensitive data with tokens. Restore tokens only when you are about to call a tool that requires the actual data.
-
Save reusable code as skills to build compound capabilities over time and share them across sessions.
Architecture overview
The Code Execution MCP structure includes a sandboxed workspace for files, a skills store for reusable snippets, a tools registry organized by category, and a server component that executes code in a controlled environment.
Troubleshooting
If you encounter issues starting the server, verify that the Python interpreter path and server script path are correct in the configuration. Ensure the sandbox has the necessary permissions to read and write within the workspace directory. Check that the sandbox’s resource limits are not exceeded and that there is no network access from within the sandbox.
Available tools
execute_code
Run Python code inside a secure sandbox with resource limits and restricted builtins.
search_tools
Progressively discover tools by search queries without loading full tool definitions.
get_tool_definition
Load full details of a tool when you need it, after initial summaries.
save_skill
Persist reusable code snippets to build and reuse skills across sessions.
load_skill
Load a saved skill for use in future code execution.
list_skills
List all saved skills available for reuse.
sanitize_pii
Detect and tokenize PII in text to protect sensitive data during processing.
restore_pii
Restore tokenized PII when you need actual data for tool calls.
write_workspace_file
Persist data to the sandbox workspace for long-term storage.
read_workspace_file
Read data from the sandbox workspace.
list_workspace_files
List files in the sandbox workspace to understand available data.
get_execution_stats
Provide environment statistics and resource usage of the sandbox.