makefile-mcp: Output Caching, Pagination, and Search
I’ve been using makefile-mcp as part of my standard coding workflow for a while now. It exposes Makefile targets as MCP tools, so an agent can run your test suite, build your project, lint your code, whatever you’ve got in your Makefile. I wrote about it briefly in my practical MCP use post and used it as the QA backbone when I built Evergreen.
The one persistent annoyance was output truncation. Run a big test suite or a verbose build and the response would blow past what the MCP client could handle. The server would truncate from the front, which meant you’d lose the beginning of the output. That’s usually where the actual errors are.
The Fix: Server-Side Output Cache
The server now caches the full stdout and stderr from every execution. The tool response only includes the last 50 lines (configurable with --tail-lines) along with an execution_id and stats about the full output (total lines, total characters). The idea is that the tail is enough for the agent to understand what happened in most cases, and when it isn’t, it can ask for more.
Two new tools handle retrieval:
get_output takes an execution_id, a stream (stdout or stderr), and a line range. So if the agent sees a test failure at line 847, it can grab lines 830-860 to see the context. Basic pagination.
search_output does a case-insensitive substring search across the cached output. It returns matching lines with surrounding context and line numbers. Useful for finding specific error messages, assertion failures, or warnings in a wall of build output.
The cache holds the last 20 executions by default (--max-cached-executions), so the agent can refer back to previous runs. This turns out to be surprisingly useful when you’re iterating on a fix. Run the tests, look at the failure, make a change, run again, compare the output from the last two runs.
Other Updates
Beyond the caching feature, makefile-mcp got the same infrastructure treatment I applied across all my MCP servers this week: a proper test suite (38 tests), GitHub Actions CI, pre-commit hooks with ruff for linting and formatting, and uvx support so you can run it with:
uvx --from git+https://github.com/wdm0006/makefile-mcp makefile-mcp
No cloning, no virtual environment, no fussing. Just point your MCP client at that command and go.
Links:
Stay in the loop
Get notified when I publish new posts. No spam, unsubscribe anytime.