Labsco
MCP SERVER

Context-Pipe

by luismichio

Unix pipes for tool output: chain filters and refineries between a tool call and the model, so what reaches the context window is the distilled version, not the raw dump.

Codebase Context Packing & Compression
Summary
Filters the output before the model ever sees it.

Asking a model to ignore boilerplate still costs the tokens; removing the boilerplate upstream does not. Doing that as composable subprocesses rather than a bespoke filter per tool is the part worth borrowing — a pipe is defined in config, versioned, and reused across projects. The accounting is what keeps it honest: every run records bytes in, bytes out and latency, so you can check the saving rather than assume it. Note the shape of the dependency: this is the switchboard, and the actual compression comes from a refinery you install next to it.

What it is

An orchestration layer that sits between tool output and the model. Its one rule is the shell's: a node reads stdin, transforms, and writes stdout — so a binary, a shell command, a script or another MCP tool are all valid nodes, and a named sequence of them is a pipe. Logs, scrape output and inter-agent handoffs pass through the pipe and arrive compressed.

What you get
  • Eight tools exposing the whole surface — `pipe_run`, `pipe_run_dynamic`, `pipe_read_file`, `pipe_analyze_file`, `pipe_list_shadow_tools`, `pipe_agent_handoff`, `get_pipe_stats`, `pipe_onboard`
  • Named pipes resolved automatically by three trigger types — a tool-name regex, a payload-size threshold, or a default fallback — defined in a config file at project level and optionally merged with a global one, with no code change to add or re-route a pipe
  • A live capability manifest combining your configured pipes with curated tools already on PATH, so the agent knows what it can chain rather than guessing — `pipe_list_shadow_tools`
  • Accounting on every run: bytes in, bytes out and latency per node, so a claim about context saved is a measurement rather than an assertion — `get_pipe_stats`
  • Protected agent-to-agent handoff, so one agent's long analysis is refined before it becomes another's input — `pipe_agent_handoff`
  • Interceptor hooks that apply pipes transparently after every tool call, without the agent having to invoke a pipe explicitly — supported across Cursor, VS Code, Claude Code, Windsurf, Cline and others
  • T-pipe stream splitting, which writes a raw copy to disk at any point in the chain without interrupting it — so the distilled output reaches the model and the full version is still on disk
  • A CLI mirroring the same surface for terminal-first work, including a subcommand that makes any registered MCP server pipeable from the shell
  • Subprocess execution with shell invocation disabled by default, and a per-node timeout guard — `PIPE_NODE_TIMEOUT_MS`
Requirements

No account and no key. Python — the package is `mcp-context-pipe` (0.5.11 in pyproject) and the documented install creates a virtual environment first, because MCP client configs need an explicit interpreter path. The orchestrator alone will chain shell and binary nodes; the compression itself comes from a refinery, and the documented pairing is semantic-sift, installed alongside it. Configuration lives in a pipes file with a global override at your home directory; `PIPE_CONFIG_PATH` points at it, `PIPE_NODE_TIMEOUT_MS` caps each node, and arbitrary shell nodes in dynamic pipes stay disabled unless you enable them. Onboarding auto-detects your IDE, and a verify call reports the health of every component.

Setup effort

One command — pip install mcp-context-pipe "semantic-sift[neural]"