MCP Server Code Execution Mode
M

MCP Server Code Execution Mode

This is a server that implements the MCP code execution mode. Through a single-tool bridge and zero-context discovery mechanism, it reduces the overhead of MCP tool calls from tens of thousands of tokens to about 200 tokens and securely executes Python code in the root container, supporting data science and secure isolation.
3.5 points
7.7K

What is the MCP Code Execution Server?

This is an innovative MCP (Model Context Protocol) server that changes the way AI assistants use tools. Traditional methods require loading descriptions of all tools into the AI's context (possibly consuming over 30,000 tokens), while this server only exposes one core tool: `run_python`. The AI assistant writes Python code to discover, call, and combine other MCP tools, greatly reducing context overhead.

How to use the MCP Code Execution Server?

You only need to configure this server in your AI assistant (such as Claude Desktop), and the AI assistant can use various MCP tools by writing Python code. The server will automatically discover all MCP tools you've configured and execute the code in a secure container sandbox to ensure system security.

Applicable Scenarios

Suitable for complex workflows that require using multiple MCP tools simultaneously, such as data science analysis, file processing, cross-system integration, automation scripts, etc. Especially suitable for users who want AI assistants to write code to combine multiple tools to complete complex tasks.

Main Features

Zero-Context Discovery
AI assistants can dynamically discover available MCP tools without pre-loading descriptions of all tools, reducing context token consumption by over 90%.
Code-First Execution
AI assistants write Python code to call tools, supporting complex logic, loops, and conditional judgments, which is more powerful than simple tool calls.
Secure Sandbox
All code is executed in a container with no network access, a read-only file system, and unprivileged users to ensure system security.
Persistent State
The code execution environment remains persistent, and variables, imports, and function definitions are retained between multiple calls, supporting complex workflows.
Multi-Server Support
Automatically discovers and proxies any standard MCP server, supporting seamless integration of over 100 tools.
Intelligent Tool Search
Provides a fuzzy search function. AI assistants can search for tools by keywords without remembering specific tool names.
Advantages
Significantly reduce context overhead: from over 30,000 tokens to about 200 tokens
More powerful tool combination ability: AI can write complex logic to combine multiple tools
Better security: code is executed in a strictly isolated container
More flexible tool discovery: dynamically discover tools without pre-configuring all tools
Support for complex workflows: support loops, conditional judgments, error handling, etc.
Compatible with the existing MCP ecosystem: can proxy any standard MCP server
Limitations
Requires the AI assistant to have the ability to write code
Initial setup requires configuring the container runtime (Podman/Docker)
Code execution has resource limitations (memory, CPU, time)
Does not support network access (for security reasons)
Requires Python 3.14 or higher

How to Use

Install Dependencies
Ensure that Python 3.14+ and the container runtime (Podman or Docker) are installed on the system.
Install the Server
Use the uv tool to install the MCP Code Execution Server.
Configure the AI Assistant
Add this server to the MCP configuration file of the AI assistant.
Configure MCP Tools
Create a JSON file in the ~/MCPs directory to configure the MCP tools you need.
Start Using
Start the AI assistant. Now it can write Python code to use the configured MCP tools.

Usage Examples

File Processing Workflow
The AI assistant discovers the file system tool, lists files, and searches for files containing specific content.
Cross-System Integration
The AI assistant combines Jira and GitHub tools to automatically create GitHub issues from bugs in Jira.
Data Analysis Task
The AI assistant uses data science tools to process and analyze data files.

Frequently Asked Questions

Is this server secure?
Do I need to learn Python to use it?
Which MCP tools are supported?
Is there a time limit for code execution?
How to add new MCP tools?
What's the difference from the traditional MCP usage method?

Related Resources

GitHub Repository
Project source code and latest updates
Anthropic Official Documentation
Anthropic's official article on code execution and MCP
MCP Protocol Documentation
Official documentation of the Model Context Protocol
Docker MCP Gateway
Docker's blog post on dynamic MCPs
Apple CodeAct Research
Apple's research on code execution AI agents

Installation

Copy the following command to your Client for configuration
{
  "mcpServers": {
    "mcp-server-code-execution-mode": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/elusznik/mcp-server-code-execution-mode",
        "mcp-server-code-execution-mode",
        "run"
      ],
      "env": {
        "MCP_BRIDGE_RUNTIME": "podman"
      }
    }
  }
}
Note: Your key is sensitive information, do not share it with anyone.

Alternatives

A
Acemcp
Acemcp is an MCP server for codebase indexing and semantic search, supporting automatic incremental indexing, multi-encoding file processing, .gitignore integration, and a Web management interface, helping developers quickly search for and understand code context.
Python
6.7K
5 points
B
Blueprint MCP
Blueprint MCP is a chart generation tool based on the Arcade ecosystem. It uses technologies such as Nano Banana Pro to automatically generate visual charts such as architecture diagrams and flowcharts by analyzing codebases and system architectures, helping developers understand complex systems.
Python
6.2K
4 points
M
MCP Agent Mail
MCP Agent Mail is a mail - based coordination layer designed for AI programming agents, providing identity management, message sending and receiving, file reservation, and search functions, supporting asynchronous collaboration and conflict avoidance among multiple agents.
Python
6.7K
5 points
K
Klavis
Klavis AI is an open-source project that provides a simple and easy-to-use MCP (Model Context Protocol) service on Slack, Discord, and Web platforms. It includes various functions such as report generation, YouTube tools, and document conversion, supporting non-technical users and developers to use AI workflows.
TypeScript
13.4K
5 points
M
MCP
The Microsoft official MCP server provides search and access functions for the latest Microsoft technical documentation for AI assistants
12.7K
5 points
A
Aderyn
Aderyn is an open - source Solidity smart contract static analysis tool written in Rust, which helps developers and security researchers discover vulnerabilities in Solidity code. It supports Foundry and Hardhat projects, can generate reports in multiple formats, and provides a VSCode extension.
Rust
10.5K
5 points
D
Devtools Debugger MCP
The Node.js Debugger MCP server provides complete debugging capabilities based on the Chrome DevTools protocol, including breakpoint setting, stepping execution, variable inspection, and expression evaluation.
TypeScript
9.9K
4 points
S
Scrapling
Scrapling is an adaptive web scraping library that can automatically learn website changes and re - locate elements. It supports multiple scraping methods and AI integration, providing high - performance parsing and a developer - friendly experience.
Python
10.5K
5 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
18.0K
4.3 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
17.4K
4.5 points
M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
27.5K
5 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
52.6K
4.3 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
22.2K
5 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
51.1K
4.5 points
M
Minimax MCP Server
The MiniMax Model Context Protocol (MCP) is an official server that supports interaction with powerful text-to-speech, video/image generation APIs, and is suitable for various client tools such as Claude Desktop and Cursor.
Python
35.4K
4.8 points
C
Context7
Context7 MCP is a service that provides real-time, version-specific documentation and code examples for AI programming assistants. It is directly integrated into prompts through the Model Context Protocol to solve the problem of LLMs using outdated information.
TypeScript
74.1K
4.7 points
AIBase
Zhiqi Future, Your AI Solution Think Tank
© 2025AIBase