Skip to main content
Glama

squeeze-mcp

An MCP server that runs shell commands for your AI agent and hands back only the part of the output worth reading.

Builds, test runs and installs print thousands of lines. An agent that reads all of them spends its context window on progress bars and download logs, then forgets the instructions you gave it. squeeze keeps:

  • the first few lines and the last ~20 lines,

  • every error, stack frame and failure, with two lines of context on each side,

  • summary lines (3 failed, 41 passed, Compiled with 2 warnings, exit code 1),

and collapses repeated lines (Downloading 1/400 … Downloading 400/400) into one. Nothing is thrown away: the full output stays in memory under a run id, and the agent can search it with grep_output or page through it with read_output.

Example

A made-up test run that prints 402 lines, with one error in the middle:

$ node noisy-test.js
exit 1 · 0.1s · 402 lines, 9 shown · run id r1
Search the full output with grep_output or read_output (id r1).
----
fetch 0/400
  … 199 similar lines
fetch 200/400
Error: connection reset by peer
fetch 201/400
  … 197 similar lines
fetch 399/400
1 failed, 9 passed

Related MCP server: shell-sieve

Install

Requires Node.js 18 or newer.

git clone https://github.com/isaiahagi/squeeze-mcp.git
cd squeeze-mcp
npm install        # also builds dist/

Claude Code

claude mcp add squeeze -- node /absolute/path/to/squeeze-mcp/dist/index.js

Claude Desktop, Cursor, or any client with an mcpServers config

{
  "mcpServers": {
    "squeeze": {
      "command": "node",
      "args": ["/absolute/path/to/squeeze-mcp/dist/index.js"]
    }
  }
}

Then tell your agent once, for example in CLAUDE.md: "Run builds, tests and installs with the squeeze run tool."

Tools

Tool

What it does

run

Runs a command (command, optional cwd, timeout_seconds, budget_lines) and returns the compact output, exit code, duration and a run id.

grep_output

Searches a run's full output with a regular expression, with line numbers and context.

read_output

Returns a range of lines from a run's full output.

squeeze_text

Compacts text you already have, such as a pasted log or stack trace.

list_runs

Lists the runs still kept, newest first.

How the squeezing works

  1. Colour codes are stripped and carriage-return progress redraws are reduced to their final state.

  2. Consecutive lines that differ only in numbers, hashes or timestamps are collapsed to first, count and last.

  3. If the result is still over budget, each line is scored: start and end are always kept, then errors (score 3), lines near errors (2) and summary lines (1) fill the remaining budget.

  4. Gaps are marked with … [N lines omitted], so the agent knows exactly what it has not seen.

The logic is in src/squeeze.ts and has no dependencies, so you can reuse it elsewhere.

Settings

Environment variable

Default

Meaning

SQUEEZE_KEEP_RUNS

30

How many runs to keep in memory.

SQUEEZE_MAX_BYTES

20971520 (20 MB)

Output kept per run. Past this, the first and last halves are kept.

Commands run with CI=1, NO_COLOR=1 and FORCE_COLOR=0 so tools print plain, non-interactive output. Stdin is closed, so a command that waits for input ends instead of hanging.

Safety

run executes shell commands with your user's permissions, exactly like your agent's built-in shell tool. Keep your MCP client's approval prompts on for it, and don't connect it to agents you don't trust.

Development

npm test   # builds, then runs unit tests and end-to-end tests against the real server

License

MIT

Available Tools

5 tools
grep_outputSearch a run's full outputB

Searches the full stored output of an earlier run with a regular expression and returns matching lines with line numbers.

Inputs: id (required), pattern (required), context, ignore_case, +1 more.

list_runsList kept runsB

Lists recent runs whose full output is still kept, newest first.

Inputs: no named parameters.

read_outputRead lines from a run's full outputB

Returns a range of lines from the full stored output of an earlier run.

Inputs: id (required), count, start.

runRun a command, get compact outputA

Runs a shell command and returns a compact view of its output: the first and last lines, every error with nearby context, and summary lines, with repeated lines collapsed. The full output is kept under a run id; use grep_output or read_output to see anything omitted. Prefer this over a plain shell for builds, tests, installs and anything noisy.

Inputs: command (required), cwd, budget_lines, timeout_seconds.

squeeze_textCompact a block of textA

Compacts a log, stack trace or other long text the same way run does, without running anything.

Inputs: text (required), budget_lines.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: run executes and compacts, squeeze_text compacts without executing, read_output retrieves line ranges, grep_output searches by regex, and list_runs discovers runs. The only surface overlap is between grep_output and read_output, but they are clearly differentiated by search vs. range access.

    Naming Consistency4/5

    Four of five tools follow a clear verb_noun pattern (grep_output, read_output, squeeze_text, list_runs), while run is a bare verb. The deviation is minor and still readable, so the set is mostly consistent.

    Tool Count5/5

    Five tools is well-scoped for a focused log/output squeezing server. Each tool serves a distinct part of the workflow—execution, standalone compaction, discovery, and full-output retrieval—with no redundant entries.

    Completeness4/5

    The core lifecycle is covered: run creates stored output, list_runs discovers it, and read_output/grep_output retrieve it, while squeeze_text handles standalone text. Minor gaps exist around run metadata (e.g., exit status/duration) and cleanup/deletion of stored runs, but these are workable omissions.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that executes shell commands and intelligently compresses, filters, and extracts errors from verbose output to save AI agent context windows. It strips ANSI, collapses repetitive lines, and always preserves error information.
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables running commands and capturing their output, then provides only the relevant lines to the model, with features for following long-running processes, outlining files, and summarizing logs.
      7
      24 PyPI
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      It enables AI coding agents to execute shell commands and compact noisy terminal output into token-efficient Markdown, isolate actionable failures, and provide structured error explanations through MCP tools.
      34 npm
      1
      MIT