Repository navigation
Description
What happened?
My config.db grew to about 940MB. Most of it is the activity log.
When I looked inside, I found records far bigger than the 64KB response limit. The biggest single record is 10.75MB, which is about 160 times the cap.
I checked every activity record over 200KB. There are 82 of them, and they are all the same kind:
types of oversized records: {'internal_tool_call': 82}
SIZE MB TYPE TOOL response field len response_truncated
10.75 internal_tool_call call_tool_read 10470961 False
5.14 internal_tool_call call_tool_read 5133653 False
4.98 internal_tool_call call_tool_read 4972547 False
4.82 internal_tool_call call_tool_read 4813426 False
4.70 internal_tool_call call_tool_read 4698651 False
Every one is type: internal_tool_call with tool_name: call_tool_read. Not a single normal tool call is oversized. So regular calls are being truncated correctly, and this one path is not.
Also note the last column. None of these records has response_truncated set, which fits: nothing truncated them, so nothing flagged them.
The truncation code itself looks fine. internal/storage/activity.go has DefaultMaxResponseSize = 64 * 1024 and a truncateResponse(response string, maxSize int) that appends ...[truncated]. It just does not seem to run on this path.
There is a matching comment in internal/httpapi/activity.go:
Arguments, Response and Metadata are unbounded in practice (only Response is truncated, at 64KB)
And internal/server/mcp.go has emitActivityInternalToolCallTruncated, described as being for a handler whose recorded response is larger than what the agent received. So a truncating variant exists for the internal path. It looks like the plain internal emit path is the one that stores the full response.
I have not traced which call site is at fault, so I may have the mechanism wrong. The stored data is what I am sure about.
Expected behavior
An internal_tool_call record should be truncated at activity_max_response_size (64KB by default), the same as a normal tool call, and should get response_truncated: true when that happens.
Steps to reproduce
- Add an upstream with a tool that returns a very large response. I hit this with
cloudflare-workersworkers_get_worker_code, which returns a whole bundled Worker. - Call that tool through mcpproxy's own
call_tool_read, so the record is stored asinternal_tool_call. - Read the newest record back from the
activity_recordsbucket inconfig.db. - The stored
responseis the full size, not 64KB, andresponse_truncatedis not set.
MCPProxy version
MCPProxy v0.63.0 (personal) linux/amd64
Operating system
Linux
Relevant logs
Nothing is logged. It is silent, which is why it went unnoticed for months. Sizes for context:
activity_records 267 MB 10889 records avg 24 KB largest 10.5 MB
server_*_tool_calls 432 MB ~17000 records largest 9.1 MB
Why this matters
The setting is there to bound how big the activity log can get, and this path quietly ignores it. A handful of big calls can add hundreds of MB. My database is 940MB and there is no error anywhere to suggest something is wrong.
Pre-submission checklist
- I searched existing issues and did not find a duplicate.
Activity
antongulin commentedon Sep 2, 2026
Correction to my own report. I cloned the repo and traced it properly, and I got the cause wrong above.
I said regular tool calls are being truncated and this one path is not. That is not right. Nothing is truncated. The truncation code is written and unit-tested but never wired into the write path at all.
At
b4a586a:truncateResponse(internal/storage/activity.go:35) and its exported wrapperTruncateActivityResponse(:535) have zero production callers. The only caller anywhere isinternal/storage/activity_test.go:317.ActivityMaxResponseSize(internal/config/config.go:468, default65536at:1801) is never read. Those two lines are its only mentions in the whole tree.internal/runtime/activity_service.go:617,:896,:981.SaveActivitydoes not truncate either.So the reason all 82 oversized records are
internal_tool_callis not that this path skips a check the others apply. It is thatcall_tool_readproxies whole upstream responses, so it is simply where the large payloads happen to be. A normal tool call returning 10MB would be stored at 10MB too.One more thing I misread.
ResponseTruncatedon the record is not a storage flag. Per the Spec 103 comment atactivity_service.go:855-859it means the recorded response is larger than the one the agent received. That is the opposite direction from storage truncation, so a fix should not just reuse that field without thinking about the two meanings.The observed data in the report is unchanged and still accurate. Only my explanation was wrong.
This makes it a smaller and more contained fix than I first described: apply the existing
TruncateActivityResponseon the write path and feed itActivityMaxResponseSize.ActivityServicealready receives retention config fromruntime.go:329, so the value has a natural home. I am putting a PR together and will link it here.chore(roadmap): mcp-2026-upgrade to P1, activity-storage-bounds task,…
fix(activity): scan before truncating, and keep the built-in cost fla…
fix(activity): apply activity_max_response_size on the write path (#1174
docs(release): notice for the config.db bloat fix and its manual comp…
fix(storage): bound the tool-call history, stop erasing configured ze…
Dumbris commentedon Sep 7, 2026
Fixed by #1174 (activity-log response cap applied on the write path, merged 2026-09-04 as
7a27851e7) and #1214 (per-server tool-call history bounds plusmcpproxy db compact, merged 2026-09-05 asf95fc1428) — thanks for both the report and the PR.Verified on current
main:truncateForStorage(internal/runtime/activity_service.go:258) is now applied at all three record-building sites. The subtlety you raised was kept — the storage cut deliberately does not setResponseTruncated, because that field carries the opposite Spec-103 meaning ("the agent received less") that two cost consumers read as "exclude from delivered traffic".Run
mcpproxy db compactto reclaim space already written.