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.
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
Maintainer
Works with
Installation
Manual Installation
npx pctxConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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)
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 | shInitialize 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 initRegister 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.comStart 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 --stdioConfigure 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.
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.
Pctx Alternatives — Similar Coding Agents Servers
Looking for alternatives to Pctx? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
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.
Set Up Pctx in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.