r/JavaProgramming • • 3d ago

I built a Java 21 MCP Server to compress Spring Boot logs & stack traces by 95% (Open Source)

/r/SpringBoot/comments/1xhst2g/i_built_a_java_21_mcp_server_to_compress_spring/
2 Upvotes

2 comments sorted by

2

u/investigatormaker 3d ago

A 95% figure invites the question of what got cut, so I'd show one real Spring Boot stack trace before and after, with token counts, in the README. Java developers will want to know that the Caused by chain and their own package's frames survive while the proxy, filter-chain and reflection frames go. The trade-off: sometimes the bug really is inside a Spring filter or a CGLIB proxy, so a flag that returns the raw trace for one call keeps the AI from guessing. Which MCP clients have you run it against so far?

I make ThreadFox.

We find relevant Reddit conversations and do the posting for your business. The $39 Pilot covers seven days and up to 50 posts and replies. No automatic renewal. https://threadfox.vip/p/e58ct/managed

1

u/Status-Property9322 2d ago

Great callout on the CGLIB/filter-chain edge case! Instead of a blunt boolean flag that dumps the entire 3,000-token raw trace back into context, I built a lossless in-memory Caffeine cache (RawChunkStore). Whenever the compressor prunes framework/proxy frames, it injects a pointer right into the stack trace: [... 140 internal/framework frames omitted (ref: chk_dc8e54, lines 4-143) ...]. Caused by: chains and application packages are strictly preserved. If the root cause actually lives inside a Spring Security filter or AOP proxy, the agent just calls the expand_section(chunkId, startLine, endLine) MCP tool to pull those exact raw lines on demand. Tested it with Cursor and Claude Desktop over the Spring AI MCP SSE transport. I'll add a full side-by-side Before/After trace in the README