pctx
pctx is the execution layer for agentic tool calls. It auto-converts agent tools and MCP servers into code that runs in secure sandboxes for token-efficient wor
What is pctx?
pctx is the execution layer for agentic tool calls. It auto-converts agent tools and MCP servers into code that runs in secure sandboxes for token-efficient workflows.
Overview of pctx
What it is
pctx is an open source framework that connects AI agents to tools and MCP (Model Context Protocol) servers through a Code Mode interface. It acts as an execution layer for agentic tool calls, automatically converting agent tools and MCP servers into code that runs in secure sandboxes. This approach reduces token usage by replacing sequential tool calling with code execution.
Key features
- Code Mode interface: Tools are exposed as code functions for efficient agent interaction.
- Upstream MCP server aggregation: Connect to multiple MCP servers through a single interface, with persistent upstream sessions across
execute_typescriptcalls. - Simple config with CLI: Create the
pctx.jsonconfig with a simple CLI, managing auth, upstream MCPs, logging, and more. - Secure authentication: Source secrets from environment variables, system keychain, and external commands.
- Sandboxed execution: LLM-generated code runs in an isolated Deno sandbox with restricted network access.
Use cases
- Building AI agents that need to interact with multiple MCP servers without managing individual connections.
- Reducing token consumption in multi-step tool operations by using code execution instead of sequential tool calls.
- Running Code Mode sessions as a stateless HTTP server or as a unified MCP server.
Getting started
Install pctx using one of the following methods: bash # Homebrew brew install portofcontext/tap/pctx # cURL curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/portofcontext/pctx/main/install.sh | sh # npm npm i -g @portofcontext/pctx Start Code Mode for Python SDK: bash pctx start Start Code Mode as a unified MCP server: bash pctx mcp init pctx mcp dev For Python SDK, install the client: bash pip install pctx-client
License and pricing
The license is MIT. The project is open source; pricing is not stated in the provided metadata or README.
Based on the project's public README and repository metadata.