Skip to main content
Glama
lu-zhengda

mcp-python-exec-sandbox

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
UV_PATHNoPath to uv binaryuv
MAX_TIMEOUTNoMaximum allowed timeout in seconds300
PYTHON_VERSIONNoPython version for execution3.13
DEFAULT_TIMEOUTNoDefault timeout in seconds30
SANDBOX_BACKENDNonative | docker | nonenative on Linux, docker on macOS
MAX_OUTPUT_BYTESNoMaximum output size in bytes102400

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tasks
{
  "list": {},
  "cancel": {},
  "requests": {
    "tools": {
      "call": {}
    },
    "prompts": {
      "get": {}
    },
    "resources": {
      "read": {}
    }
  }
}
tools
{
  "listChanged": true
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
execute_pythonA

Execute a Python script with automatic dependency management.

The script can include PEP 723 inline metadata (# /// script blocks) for declaring dependencies. Additional dependencies can also be passed via the dependencies parameter and will be merged.

Args: script: Python source code to execute. May include PEP 723 metadata. dependencies: Extra PEP 508 dependency specifiers to make available. timeout_seconds: Maximum execution time (1-300, default 30).

Returns: Formatted output with stdout, stderr, exit code, and duration.

Example - simple script:

execute_python(script="print('hello')")

Example - with dependencies parameter:

execute_python(
    script="import requests; print(requests.get('https://example.com').status_code)",
    dependencies=["requests>=2.32"]
)

Example - with inline dependency metadata (preferred for multiple deps):

execute_python(script='''
# /// script
# dependencies = ["pandas>=2.2", "numpy>=1.26"]
# ///

import pandas as pd
import numpy as np
print(pd.DataFrame({"a": np.arange(5)}).describe())
''')

Always pin dependency versions (e.g. "pandas>=2.2" instead of "pandas") for reproducible results.

The inline metadata block (# /// script ... # ///) is the recommended way to declare dependencies directly in the script (see PEP 723: https://peps.python.org/pep-0723/). The dependencies parameter is a simpler alternative when you just need to add a few packages. Both accept standard pip-style version specifiers like "requests>=2.28" or "pandas" (see PEP 508: https://peps.python.org/pep-0508/).

check_environmentA

Check the execution environment and report status.

Returns information about Python version, uv version, platform, sandbox configuration, and cache status.

validate_scriptA

Validate a Python script's PEP 723 metadata and dependencies without executing it.

Checks metadata syntax, dependency format, and requires-python compatibility.

Args: script: Python source code to validate. May include inline dependency metadata (# /// script blocks, see https://peps.python.org/pep-0723/). dependencies: Extra dependency specifiers to validate, using standard pip-style format like "requests>=2.28" (see https://peps.python.org/pep-0508/).

Returns: Validation result with metadata details or error information.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lu-zhengda/mcp-python-exec-sandbox'

If you have feedback or need assistance with the MCP directory API, please join our Discord server