Pctx

v1.0.0Coding Agentsstable

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.

ai-agentsapiinfrastructurelocal-developmentmcp
Share:
254
Stars
0
Downloads
0
Weekly
0/5

What is Pctx?

Pctx is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 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.

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.

This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • pctx is the execution layer for agentic tool calls. It auto-

Use Cases

Execute agent tools and MCP servers in secure sandboxes.
Auto-convert agent tools into efficient sandboxed code.
Optimize token usage for agentic tool execution.
portofcontext

Maintainer

LicenseMIT
Languagerust
Versionv1.0.0
UpdatedMay 19, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx pctx

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Pctx

pctx (Port of Context) is an execution layer for agentic tool calls that converts agent tools and MCP servers into code functions running inside secure sandboxes, dramatically reducing token usage by replacing sequential tool-call round trips with efficient in-sandbox code execution. Instead of the agent calling tools one at a time and waiting for responses, pctx exposes tools as callable code functions that the agent can batch and execute in a single sandbox run. Teams building multi-step AI agent workflows use pctx to aggregate multiple upstream MCP servers through a single unified interface with persistent sessions, lower latency, and significantly reduced token overhead.

Prerequisites

  • Homebrew (macOS/Linux), curl, or npm for installation
  • An MCP-compatible client such as Claude Desktop or Claude Code
  • Python 3.9+ if using the pctx-client Python SDK
  • A pctx account or local configuration (managed via pctx.json)
1

Install pctx

Install pctx using your preferred method. Homebrew is recommended on macOS; the npm package works on all platforms.

# Homebrew (macOS/Linux)
brew install portofcontext/tap/pctx

# npm (all platforms)
npm i -g @portofcontext/pctx

# cURL installer
curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/portofcontext/pctx/main/install.sh | sh
2

Initialize the MCP configuration

Run `pctx mcp init` to create a `pctx.json` configuration file. This interactive command sets up authentication, logging, and upstream MCP server connections.

pctx mcp init
3

Register upstream MCP servers

Add the MCP servers you want to aggregate through pctx. Each registered server's tools will be available as code functions inside the execution sandbox.

pctx mcp add filesystem /path/to/filesystem-server
pctx mcp add github https://github-mcp.example.com
4

Start pctx in stdio MCP server mode

Launch pctx as an stdio MCP server so your AI client can connect to it. In this mode, pctx aggregates all registered upstream MCPs through a single interface.

pctx mcp start --stdio
5

Configure your MCP client to use pctx

Add pctx as the MCP server in your client configuration. pctx will expose all aggregated tools and enable code-mode sandbox execution.

6

Use the Python SDK to define custom tools

If you want to expose custom Python functions as pctx tools, install the pctx-client SDK and decorate your functions with @tool.

pip install pctx-client

from pctx_client import Pctx, tool

@tool
def analyze_data(filepath: str) -> str:
    """Analyze a data file and return summary statistics."""
    # your implementation here
    ...

pctx = Pctx(tools=[analyze_data])

Pctx Examples

Client configuration

Add pctx as the MCP server in claude_desktop_config.json. pctx will aggregate all configured upstream MCP servers through this single connection.

{
  "mcpServers": {
    "pctx": {
      "command": "pctx",
      "args": ["mcp", "start", "--stdio"]
    }
  }
}

Prompts to try

Use these prompts to leverage pctx's code-mode execution and multi-MCP aggregation.

- "Read all TypeScript files in src/ and count the lines in each"
- "Search GitHub for issues labeled 'bug' and summarize the top 5"
- "Run these 10 file operations as a batch without waiting between each step"
- "List all tools available across my connected MCP servers"
- "Execute a multi-step workflow: fetch the API response, parse it, and write the results to a file"

Troubleshooting Pctx

pctx mcp init fails with authentication error

pctx sources secrets from environment variables, the system keychain, and external commands as configured in pctx.json. Ensure your credentials are available in one of these sources. Re-run `pctx mcp init` to reconfigure and follow the prompts to provide valid credentials.

Upstream MCP server tools are not visible after adding them

After running `pctx mcp add`, restart the pctx server with `pctx mcp start --stdio`. The tool list is built at startup from all registered upstream servers. Verify the server URL or command is correct by running `pctx mcp dev` to start in HTTP debug mode and inspect the tool output.

Sandbox execution times out on long-running tool calls

pctx sandboxes enforce execution time limits for security. For long-running operations, break them into smaller batches or use the pctx-client SDK to configure a higher timeout. Check the pctx.json configuration for sandbox timeout settings and increase the limit for your use case.

Frequently Asked Questions about Pctx

What is Pctx?

Pctx is a Model Context Protocol (MCP) server that 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. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Pctx?

Follow the installation instructions on the Pctx GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Pctx?

Pctx works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Pctx free to use?

Yes, Pctx is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Coding Agents MCP Servers

Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "pctx": { "command": "npx", "args": ["-y", "pctx"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Pctx?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides