Let’s be honest: Who actually enjoys digging through 500MB log files to find a needle in a haystack? We’ve all been there—production is down, chat messages constantly pop up, and you’re bleary-eyed, scrolling through hundreds of lines of a thread dump. You’re hunting for that one monitor lock holding everything up, or desperately trying to figure out if thread http-nio-8080-exec-1 was already stuck at the exact same line thirty seconds ago.
It’s tedious, error-prone, and—let’s face it—boring work.
But what if your debugging tools didn't just display data, but actually understood it? What if you could simply ask your AI agent (like Claude, Cursor, or Junie): "Hey, why is the database pool hanging?"—and it gave you the answer by running your trusted analysis tools in the background for you?
In this article, I’ll show you how I revitalized TDA (Thread Dump Analyzer), a classic open-source GUI tool for Java Thread Dump Analysis, by integrating it with the new Model Context Protocol (MCP). We’ll explore how an AI Agent, powered by MCP, can directly access your local log files to find deadlocks and identify performance bottlenecks—faster and more accurately than any manual analysis ever could.
Welcome to the era of Agentic Debugging.
Installation and Configuration
You can integrate the TDA MCP server by including this in your mcp.json config
{
"mcpServers": {
"tda": {
"command": "java",
"args": [
"-Djava.awt.headless=true",
"-jar", "path/to/tda.jar",
"--mcp"]
}
}
}
I integrated the MCP into Junie, the AI Assistant inside Intellij, which proved already quite helpful by refactoring the TDA source to be able work with it again and supporting with the MCP Integration.
After the configuration for TDA is successfully integrated, this gets visible in the Junie Settings
If successful, it displays the available commands for the TDA MCP Server. It is important for the Agent to know parse_log always has to be called first and it should use the MCP server for log file parsing and not try to analyse the log files itself, which could cost a lot of tokens. For this, a system prompt is recommended:
When you encounter a log file that appears to contain Java thread dumps:
1. DO NOT try to read or "cat" the entire file if it's large.
2. Use the `tda-analyzer` MCP toolset.
3. First, call `parse_log(path="...")` to initialize
the analysis.
4. Use `get_summary()`, `check_deadlocks()`, and
`find_long_running()` to perform the analysis.
5. Provide your insights based on the structured data returned
by these tools rather than the raw log text.
I added this to .junie/instructions.md in my Home directory. For cursor you would add this to your .cursorrules file.
Using the MCP Server inside an Agent
With this thread dump analysis is ready to go and we can ask Junie to check our thread dumps
In the output you see, Junie is immediately asking the "tda-analyzer" to check the log for thread dumps without trying anything itself. The integration currently can check if the Thread Dumps reported dead locks or have long running threads and can give you a summary about the found thread dumps.
If you run the Agent inside the source code which relates to this thread dumps, the Agent can directly use the thread dump information to start fixing bugs.
Conclusion: Bridging the Gap Between Legacy and AI
Integrating MCP into TDA has transformed a classic, reliable tool into a modern, agentic diagnostic engine. By shifting the burden of manual parsing and cross-referencing to an AI agent, it allows developers to stay in their "flow" and focus on solving the issue rather than grepping through logs.
While the example shown here is straightforward, the real power of this integration shines when dealing with massive production logs where temporal analysis—like finding "hung" threads across multiple snapshots—becomes a matter of seconds, not minutes.
What’s next? I’m planning to further refine the TDA MCP tools and explore deeper integrations with IDEs like Cursor and IntelliJ (via Junie). TDA remains open source, and I’d love to hear your feedback or see your contributions to the MCP module!
Are you ready to stop reading stack traces and start chatting with your JVM? Check out the TDA Release 2.6 on Github and give the TDA MCP server a spin!


Top comments (0)