Get the FREE Ultimate OpenClaw Setup Guide →

open-ptc-agent

An open source implementation of code execution with MCP (Programatic Tool Calling)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio chen-zexi-open-ptc-agent python -m open_ptc_agent.mcp_server \
  --env OPENAI_API_KEY="OpenAI API key (if using OpenAI as LLM provider)" \
  --env DAYTONA_API_KEY="Daytona sandbox API key (optional if using Daytona backend)" \
  --env MCP_CONFIG_PATH="Path to main MCP configuration (config.yaml by default)" \
  --env LLMS_CONFIG_PATH="Path to llms.json if customized"

How to use

Open PTC Agent is a Python-based MCP server that implements Programmatic Tool Calling (PTC), enabling an agent to generate Python code that orchestrates tools inside a sandbox and return only the final results. The server exposes a set of native MCP tools (execute_code, Bash, Read, Write, Edit, Glob, Grep) and middleware components (Subagents, BackgroundSubagent, ViewImage, Filesystem, etc.) so you can build complex workflows that process large data, interact with files, and call external services. To get started, install and run the server, then integrate an LLM or agent frontend that can issue tool calls, discover available MCP tools, and trigger code execution within the Daytona sandbox. You can also leverage the built-in MCP registry and sandboxed tool execution to keep heavy data processing isolated from the model context, returning concise results to the user or downstream systems.

Once running, you can use the Toolkit via the agent interface to perform tasks such as running Python code with MCP tool access, performing shell commands, reading and writing files, performing pattern matching with Glob and Grep, and more. The middleware layers handle asynchronous subagents, image/view support for multimodal LLMs, and persistent task management. This makes it suitable for building data pipelines, analysis tasks, and automated workflows where large data processing happens inside a sandbox and only key outputs are surfaced to the user.

How to install

Prerequisites:\n- Python 3.12 or newer installed on your system\n- Git to clone the repository\n- Optional: Daytona sandbox access key if you plan to run with Daytona backend\n\nStep-by-step installation:\n1) Clone the repository:\nbash\ngit clone https://github.com/Chen-zexi/open-ptc-agent.git\ncd open-ptc-agent\n\n2) Create and activate a Python virtual environment:\nbash\npython -m venv venv\n# On Windows: venv\Scripts\activate\n# On macOS/Linux: source venv/bin/activate\n\n3) Install dependencies:\nbash\npip install -r requirements.txt\n\n4) Configure your environment variables (see mcp_config for placeholders) or create a local config.yaml as needed.\n5) Run the MCP server:\nbash\npython -m open_ptc_agent.mcp_server\n\n6) (Optional) If you plan to use Daytona, ensure your Daytona credentials are configured and accessible by the server.\n\nNotes:\n- If the package name differs in your environment, adjust the module path in the command accordingly.\n- You can also run individual mcp_servers like yfinance_mcp_server.py for quick experiments, but the recommended approach is to run the centralized MCP server module.\n

Additional notes

Tips and troubleshooting:\n- Ensure Python 3.12+ is used to match the project requirements.\n- Set DAYTONA_API_KEY if you plan to rely on Daytona-backed sandbox execution. The MCP tooling will perform code execution within a sandbox to minimize context leakage.\n- When troubleshooting tool discovery, verify that the agent has access to the mcp_servers package and that the module path in the command matches your installation layout.\n- The server exposes core tools (execute_code, Bash, Read, Write, Edit, Glob, Grep). Use execute_code for sandboxed Python execution and use FilesystemMiddleware tools for file operations securely.\n- Review docs/CONFIGURATION.md and CHANGELOG for advanced configuration and latest capabilities.\n

Related MCP Servers

Sponsor this space

Reach thousands of developers