This is a solid approach. The head/tail truncation pattern is elegant — keeping the context where errors usually surface while dropping the noisy middle. I've been thinking about a similar problem from a different angle: when you're running long scraping jobs via MCP, the log output can get massive. A token-aware middleware like mcp-headroom could slot right into that pipeline.
Curious — have you tested this with Docker build outputs? Those tend to be the worst offenders for context bloat.
Makes sense. Docker build logs are probably the worst test case — layer cache hits/misses create massive repetitive output. Would be curious to hear how it handles that if you integrate it.
Opportunity Biz
Building MCP-native data tools on Apify. Scraping, automation, AI agent infrastructure.
This is a solid approach. The head/tail truncation pattern is elegant — keeping the context where errors usually surface while dropping the noisy middle. I've been thinking about a similar problem from a different angle: when you're running long scraping jobs via MCP, the log output can get massive. A token-aware middleware like mcp-headroom could slot right into that pipeline.
Curious — have you tested this with Docker build outputs? Those tend to be the worst offenders for context bloat.