cd /news/developer-tools/why-my-mcp-server-kept-crashing-the-… · home topics developer-tools article
[ARTICLE · art-90425] src=promptcube3.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Why my MCP server kept crashing the Claude Desktop app

A developer's MCP server crashed the Claude Desktop app due to an out-of-memory error (Exit Code 137), caused by recursive fetching of Jira ticket dependencies and large payloads. After optimizing the fetch logic with a depth cap and queue-based approach, RAM usage dropped from 2.1 GB to 180 MB and stability improved from failing after 12 queries to handling 500+ queries. The developer advises treating AI-generated MCP servers as drafts and manually implementing caps and limits.

read4 min views1 publishedAug 10, 2026
Why my MCP server kept crashing the Claude Desktop app
Image: Promptcube3 (auto-discovered)

ClaudeDesktop, thinking it would be a quick afternoon project. I had the TypeScript code running fine in a standalone terminal, but the moment I linked it to the Claude config file, the whole desktop app started lagging.

Then it happened.

Error: MCP server disconnected unexpectedly. Exit code 137

For those who don't spend their weekends digging through logs, Exit Code 137 is the classic "OOM" (Out Of Memory) signal. The OS killed the process because it was eating RAM like it was free.

The blind spot in the local loop

The frustrating part? My local tests showed the server only used about 150MB. But in the Claude Desktop environment, it spiked to 2GB in under ten minutes. I was using a recursive function to fetch Jira ticket dependencies—a classic "I'll just trust the API" mistake. The AI was requesting nested child issues, which triggered more requests, which triggered more nesting.

I tried to fix it by adding a simple depth limit to the recursion, but the crashes persisted. I suspected the way the MCP server handles the JSON-RPC transport layer.

I felt like I was screaming into a void until I hopped into a Generative AI Forum thread where a few other devs were complaining about the exact same behavior with the mcp-sdk

. One user pointed out that the current SDK version handles large context windows by caching previous responses in a way that doesn't always garbage collect efficiently when the server is hosted as a child process.

The actual fix and the benchmarks

It wasn't just the recursion; it was the payload size. I was sending the entire Jira ticket body—including massive comments and system logs—into the context.

I rewrote the fetch logic to strip everything except the summary and the last three comments. I also switched from a recursive loop to a queue-based approach.

Here is the snippet that actually stopped the bleeding:

async function fetchTickets(ticketIds: string[], depth = 0) {
  if (depth > 2) return []; // Hard cap to prevent OOM
  
  const results = await Promise.all(ticketIds.map(async (id) => {
    const data = await jiraClient.getTicket(id);
    return {
      key: data.key,
      summary: data.fields.summary,
      // Strip the bloat
      snippet: data.fields.description?.substring(0, 200) + "..." 
    };
  }));
  
  return results;
}

The difference was immediate. I ran a benchmark on my local machine using top

to monitor the process:

| Version | Max RAM Usage | Response Time | Stability |

| :--- | :--- | :--- | :--- |

| Original (Recursive) | 2.1 GB | 1.2s (until crash) | Fails after 12 queries |

| Optimized (Queue/Cap) | 180 MB | 0.8s | Stable for 500+ queries |

Why solo debugging is a trap

I could have spent another three days guessing. That's the problem with the current state of AI coding tools; the tools (Cursor, Claude, Windsurf) are so fast at generating code that they often generate bugs faster than we can conceptually map the architecture. You get a working feature, but you don't get the "tribal knowledge" of why it might crash in a specific environment.

Finding a community of people actually shipping things—not just people posting "Top 10 Prompts" lists—is the only way to stay sane. That's why I started spending more time in the PromptCube homepage circles. It's less about "how to prompt" and more about "why is my agent looping on this specific API call?"

Shifting the workflow

This mess taught me that my Workflows were too optimistic. I was relying on the AI to handle the edge cases of API pagination and memory management.

Now, I treat AI-generated MCP servers as "drafts." I don't trust the memory profile until I've manually implemented caps and limits. The AI is great at the boilerplate, but it's terrible at imagining a memory leak in a child process it can't see.

Finding a place to vent and solve

Most AI discussions are too surface-level. They talk about "productivity gains" while ignoring the fact that the tool just hallucinated a library that doesn't exist. I need places where someone will tell me, "Yeah, that's a known bug in the SDK, use this workaround," rather than "Try asking the AI to fix it."

If you're hitting these same walls, check out the Resources section in the community. There are actual logs and implementation patterns there that save you from the "Exit Code 137" nightmare.

To join the PromptCube community, you just need to sign up on the site. It's mostly developers who are tired of the hype and just want to know why their code isn't working. It's the difference between reading a manual and talking to the guy who actually built the machine.

Next Why specialized Vertical AI is actually just 90s software in a →

All Replies (0) #

No replies yet — be the first!

── more in #developer-tools 4 stories · sorted by recency
── more on @claude desktop 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/why-my-mcp-server-ke…] indexed:0 read:4min 2026-08-10 ·