MCP Code Executor Server
A robust Model Context Protocol (MCP) server that enables AI agents to execute code across multiple programming languages in a secure, isolated environment.
🚀 Overview
MCP Code Executor Server standardizes how AI models connect to various programming runtimes by exposing a unified MCP tool endpoint. It allows AI assistants to:
- Submit code in a supported language.
- Execute it in a controlled, sandboxed environment.
- Receive output, including compilation or runtime errors.
🔑 Key Features
- Multi-Language Support: Java, Python, JavaScript, TypeScript, and C++.
- Secure Execution: Isolated containers with resource limits (CPU, memory, timeouts).
- MCP Integration: Conformant MCP server for seamless client discovery.
- Automatic Compilation: Handles compile-and-run for Java, C++, and TypeScript.
- Detailed Error Feedback: Returns both compile-time and runtime error messages.
- Resource Cleanup: Automatically deletes temporary files and enforces execution timeouts.
📐 Architecture
The MCP Code Executor Server follows a client-server model:
- MCP Client: Protocol client that connects to this server.
- MCP Server: This application, exposing code-execution tools.
- Sandboxed Runtimes: Containers or isolated processes per request.
🏁 Getting Started
Prerequisites
- Java 17+
- Python 3.8+
- Node.js & npm
- g++ or another C++ compiler
Local Setup
Clone the repository:
git clone https://github.com/yourusername/mcp-code-executor-server.git cd mcp-code-executor-server
Build & Run:
# Build the project ./mvnw clean package # Start the server ./mvnw spring-boot:run
The server listens on port 8080 by default.
Using Docker
For isolation, run in Docker:
# Build Docker image
docker build -t mcp-code-executor .
# Run container
docker run -p 8080:8080 mcp-code-executor
Or with Docker Compose:
docker-compose up -d
🛠️ Connecting MCP Clients
- Start your MCP-compatible AI client.
- Point it to
http://localhost:8080
. - Discover and invoke the
code-execution
tool.
Example MCP request:
{
"language": "python",
"code": "print('Hello, world!')nprint('hello again')"
}
🤝 Contributing
Contributions are welcome!.
📄 License
Apache License 2.0. See the LICENSE file for details.
Code Executor Server
Project Details
- mouadenna/mcp-code-executor-server
- MIT License
- Last Updated: 5/5/2025
Recomended MCP Servers
A Model Context Protocol (MCP) server that helps read GitHub repository structure and important files.
AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is...
MCP Server for Worldpay APIs
Local MCP server implementation for Starwind UI that you can use with Cursor, Windsurf, and other AI tools
A Model Context Protocol (MCP) server implementation that provides network control and management capabilities through the ONOS SDN...
This project provides an MCP (Multi-Channel Pipeline) server that acts as a wrapper for the MLB Stats API....
This MCP server provides browser automation capabilities through Puppeteer, allowing interaction with both new browser instances and existing...
Providing real-time and historical Crypto Fear & Greed Index data
Model Context Protocol Servers