Skip to main content

A code execution server with MCP support

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0.tar.gz (29.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 60a4b31277d0aef8efda4f4944927ee993e70f32d590727ff1253dea1c56fadd
MD5 81b68ceb8c2cb8c15fe56035d96eb9ce
BLAKE2b-256 29deb486b3fecd8d0ccb355bc9b9e0c22c6f97d00663f32a8bffc0d9b5d670b8

See more details on using hashes here.

File details

Details for the file iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for iflow_mcp_sjtu_sai_agents_mcp_sandbox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04a14e0886d1c92b94e3b6d7d31935c3baf79db3120169061bf106271f2b1091
MD5 78f3e7913fc1253b19c5b220b3f79f6d
BLAKE2b-256 3b93e52c196a4caf62907efccff5ed9b22d12cf8956df87b0da3191877989657

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page