pctx
by portofcontext·★ 252·Score 49
pctx is a Rust-based framework that connects AI agents to tools and MCP servers through Code Mode for secure, token-efficient workflows.
Overview
pctx serves as an execution layer for agentic tool calls, automatically converting agent tools and MCP servers into code that runs in secure Deno sandboxes. It provides a unified interface to multiple upstream MCP servers, handling authentication and exposing tools through Code Mode, which reduces token usage by up to 98.7% for multi-step operations by replacing sequential tool calls with code execution in isolated environments.
Try asking AI
After installing, here are 5 things you can ask your AI assistant:
When to choose this
Choose pctx when you need to connect AI agents to multiple MCP services through a unified interface and want to optimize token usage by executing code in a sandbox rather than making sequential tool calls.
When NOT to choose this
Avoid pctx if you need fine-grained control over tool execution, have very specific tool requirements that can't be expressed through code, or require custom sandboxing beyond what Deno provides.
Comparable tools
Installation
# 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/pctxFor Claude Desktop:
{
"mcpServers": {
"pctx": {
"command": "pctx",
"args": ["mcp", "start", "--stdio"]
}
}
}FAQ
- What is Code Mode?
- Code Mode replaces sequential tool calling with code execution. Instead of an agent calling tools one at a time, it writes code that executes in a sandbox, significantly reducing token usage for multi-step operations.
- How does pctx ensure security?
- LLM-generated code runs in an isolated Deno sandbox with restricted access to filesystem, environment, and network (beyond allowed hosts). MCP clients are authenticated in pctx so LLMs never see authentication credentials.
On Hacker News
Recent discussion from the developer community.
- Story by pmkelly4444 · 2025-11-19
- Story by pmkelly4444 · 2025-12-22
Compare pctx with
Last updated · Auto-generated from public README + GitHub signals.