SAGE Wrapper — Claude Code MCP server: compress terminal output
A local MCP server that sits between your shell and the agent, handing over a short summary instead of the full log. Useful when test and build noise eats context.
claude mcp add sage -- npx -y psycgod-sageWhat SAGE Wrapper does
SAGE wraps terminal commands. Raw output stays on your machine; the model gets a trimmed version with errors grouped and stack traces cut down. Command history, compression metrics and retry context live in a local database.
MCP is optional here and turned on by hand. Installing the package does nothing on its own — run sage install once after pip install psycgod-sage or npm install -g psycgod-sage, then restart any open agent sessions so they pick up the new instructions. From there, commands go through sage run -- <command>, with shortcuts like sage pytest available.
When a host opens its shell in the wrong directory, point SAGE at the project: sage run --cwd <project> -- <command> or set SAGE_WORKSPACE_CWD. Host apps that block shell tools stay blocked — SAGE cannot re-enable them. MCP also drops out in some stdio sessions, so plain sage run -- <command> is the safer default.
What it helps with
- shrink pytest output to the failing tests
- keep context alive through noisy build logs
- explain the last failed command and get a fix suggestion
- review recent command history
- check how many tokens compression saved
Example prompts for the agent
- Run the tests through SAGE:
sage run -- python -m pytest - Run
sage npm testand show me only the errors - Explain why the last command failed:
sage explain --failed
How to install SAGE Wrapper
Platform CLI
claude mcp add sage -- npx -y psycgod-sagePlatform CLI
codex mcp add sage-wrapper -- npx -y psycgod-sageConfig file
{
"mcpServers": {
"sage-wrapper": {
"command": "npx",
"args": [
"-y",
"psycgod-sage"
]
}
}
}Config file
{
"servers": {
"sage-wrapper": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"psycgod-sage"
]
}
}
}Platform CLI
gemini mcp add sage-wrapper npx -y psycgod-sageStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about SAGE Wrapper
How do I install SAGE Wrapper in Claude Code?
Install and activate the package first: pip install psycgod-sage, then sage install. After that add the MCP server with claude mcp add sage -- npx -y psycgod-sage.
What does SAGE Wrapper do?
It wraps terminal commands, keeps the raw output locally and returns a compact summary to the agent. Context lasts longer and logs stay out of the prompt.
Do I need MCP for SAGE to work?
No. MCP is manual via sage mcp install; the main path is plain sage run -- <command>.