Skip to main content

Code Execution Server

This repository provides a basic implementation of a code execution server, designed primarily for Xmaster (paper, code) and Browse Master (paper code). The full implementation is used in SciMaster.

Due to the proprietary nature of the full code, this repository only includes an open-source framework and the basic components required for code execution. It also includes a simple network search tool implementation.

⚠️ Warning: This is a basic code execution server without virtualization or safety protections. For added security, consider running it within Docker or Apptainer containers as necessary.


🛠️ Setup

Environment

Clone this repository and navigate to the project directory and install the required dependencies:

cd mcp_sandbox/
pip install -r requirements.txt

Tools

  • setup the serper key in configs/web_agent.json
  • setup the models' api key in configs/llm_call.json

🚀 Deploy the Code Execution Server

Step 1: Start the API Server

We will first start the API server used by the tools. This API server proxies all search-related services, including:

  • Serper's Google Search Service
  • A series of Model APIs

Navigate to the api_proxy directory and start the API server:

cd api_proxy
python api_server.py

Step 2: Deploy the Server

Deploy the server by running the following script in the MCP directory:

cd MCP
bash deploy_server.sh

📝 Usage

Sending a Request

To send a request to the server, use the following curl command:

curl -X POST "http://<your-server-url>/execute" \
     -H "Content-Type: application/json" \
     -d '{"code": "<your code here>"}'

⚡ Benchmarking

For benchmarking, you can run the following command to test the server's performance:

bash benchmarking/pressure.sh 100 100 10 benchmarking/script.lua http://127.0.0.1:30008

Example output:

Running 10s test @ http://127.0.0.1:30008/execute
  100 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    50.21ms   47.15ms 296.96ms   53.20%
    Req/Sec    24.13     13.58   130.00     54.99%
  23185 requests in 10.10s, 4.27MB read
Requests/sec:   2295.61
Transfer/sec:    432.74KB

Metadata

Release files for iflow-mcp_sjtu-sai-agents-mcp_sandbox 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp_sjtu-sai-agents-mcp_sandbox 0.1.0
File Size Uploaded
iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0.tar.gz 29.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp_sjtu-sai-agents-mcp_sandbox 0.1.0
File Interpreter ABI Platform
iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 60.5 kB

Release files / iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0.tar.gz

Download URL iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
60a4b31277d0aef8efda4f4944927ee993e70f32d590727ff1253dea1c56fadd
BLAKE2b-256 checksum
How to use checksums
29deb486b3fecd8d0ccb355bc9b9e0c22c6f97d00663f32a8bffc0d9b5d670b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0-py3-none-any.whl

Download URL iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0-py3-none-any.whl
Size 31.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04a14e0886d1c92b94e3b6d7d31935c3baf79db3120169061bf106271f2b1091
BLAKE2b-256 checksum
How to use checksums
3b93e52c196a4caf62907efccff5ed9b22d12cf8956df87b0da3191877989657
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page