<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Arnav Gupta</title>
    <description>The latest articles on DEV Community by Arnav Gupta (@ar9avg).</description>
    <link>https://dev.to/ar9avg</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4254486%2F43d85bab-9982-437c-bea9-a5d95902f69a.png</url>
      <title>DEV Community: Arnav Gupta</title>
      <link>https://dev.to/ar9avg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ar9avg"/>
    <language>en</language>
    <item>
      <title>My Mac Kept Freezing Because of 555 Idle MCP Servers</title>
      <dc:creator>Arnav Gupta</dc:creator>
      <pubDate>Fri, 20 Nov 2026 00:12:01 +0000</pubDate>
      <link>https://dev.to/ar9avg/my-mac-kept-freezing-because-of-555-idle-mcp-servers-321c</link>
      <guid>https://dev.to/ar9avg/my-mac-kept-freezing-because-of-555-idle-mcp-servers-321c</guid>
      <description>&lt;p&gt;My Mac kept freezing while I ran coding agents&lt;/p&gt;

&lt;p&gt;It has 24 GB of RAM. Swap sat at 38.7 GB out of 39.9&lt;/p&gt;

&lt;p&gt;Nothing heavy was open. Just a few agent sessions, or so I thought&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each agent session starts its own copy of every MCP server in its global config&lt;/li&gt;
&lt;li&gt;Desktop agent apps keep old sessions alive for days, and their MCP servers stay up with them&lt;/li&gt;
&lt;li&gt;My Mac had 94 sessions holding 555 MCP server processes&lt;/li&gt;
&lt;li&gt;Moving servers into project configs and closing old sessions fixes most of it&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;prismor discover mcp --prune --stop&lt;/code&gt; ended 373 copies in 6 seconds and gave me back 21 GB of swap&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. What was running
&lt;/h2&gt;

&lt;p&gt;My cleanup script flagged 287 processes. Most were two lines repeated about a hundred times each:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm exec get-an-expert-agent@latest
npm exec @microsoft/clarity-mcp-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both are MCP servers. I had started neither by hand&lt;/p&gt;

&lt;p&gt;So I walked each process up to its parent and counted:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;94 agent sessions still alive, holding 3.9 GB&lt;/li&gt;
&lt;li&gt;105 copies of colab-mcp at 1.5 GB&lt;/li&gt;
&lt;li&gt;178 processes for get-an-expert at 508 MB&lt;/li&gt;
&lt;li&gt;178 processes for clarity at 492 MB&lt;/li&gt;
&lt;li&gt;94 copies of termmirror at 252 MB&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That makes 555 MCP server processes, about a third of everything running on my machine&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpoj502lulxs2zvnf2xyy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpoj502lulxs2zvnf2xyy.png" alt="94 idle sessions, 555 MCP server processes: bar chart of resident memory and process counts by server" width="744" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Those memory numbers sit on the low side. Most of these processes had idled for days, so macOS had pushed them into swap. And ps leaves swap out&lt;/p&gt;

&lt;h2&gt;
  
  
  2. My first guess was wrong
&lt;/h2&gt;

&lt;p&gt;I blamed npx. It wraps each server in npm exec, and I assumed that wrapper swallowed the shutdown signal and left orphans behind&lt;/p&gt;

&lt;p&gt;So I tested it. My script started a stand-in session and launched a server over stdio. Then it killed that session with SIGKILL to fake a crash&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[direct]  session owns 2 processes:
    npm exec get-an-expert-agent@latest
    node .../get-an-expert-agent
[direct]  5s after the session is killed: 0 still running
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both exited. Once a session dies, its server's stdin closes and any stdio server shuts down&lt;/p&gt;

&lt;p&gt;Then I checked parents. All 555 servers had a live agent process above them. Those sessions were open and idle&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Real cause
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg35tw93fl3zmil34g19f.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg35tw93fl3zmil34g19f.jpg" alt="Illustration: three workstations with sleeping computers, each connected to its own stack of MCP servers" width="600" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Three things stack up&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One copy per session.&lt;/strong&gt; Each stdio MCP server runs as a child of whichever session launched it. Ten sessions means ten copies of every server&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Global config.&lt;/strong&gt; I had four servers in the top-level mcpServers of ~/.claude.json. So every session in every project started all four. Most of those sessions made zero calls to Clarity or Colab&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sessions that stay open.&lt;/strong&gt; Claude's desktop app keeps each sidebar session running, MCP children included. 78 of my 94 sessions were over a day old, and my oldest had run for 156 hours&lt;/p&gt;

&lt;p&gt;And npx doubles the bill. Each npx server is two processes, and its wrapper eats about as much memory as the server itself&lt;/p&gt;

&lt;p&gt;Check: count MCP processes by parent&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ps -axo pid,ppid,etime,command | grep -E 'npm exec|mcp' | grep -v grep | awk '{print $2}' | sort | uniq -c | sort -rn | head
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Red flag: those parent PIDs repeat over and over, and each one belongs to an agent&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Fixes that work today
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Move servers out of global config and into each project's .mcp.json. Biggest win by far&lt;/li&gt;
&lt;li&gt;Close sessions once they're done. /exit in the CLI, or close them in the desktop app&lt;/li&gt;
&lt;li&gt;Install npx servers once with &lt;code&gt;npm i -g &amp;lt;package&amp;gt;&lt;/code&gt; and point config at that binary. Half as many processes&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. What I added to Prismor
&lt;/h2&gt;

&lt;p&gt;Prismor already sees each tool call my agents make, so it knows which MCP servers get used. I built three things on top of that&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;See it.&lt;/strong&gt; &lt;code&gt;prismor discover mcp&lt;/code&gt; now lists each server with its running copies, their memory and how many sessions called it in the last 7 days&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm10v3hulhtf9dnna0i56.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm10v3hulhtf9dnna0i56.png" alt="Terminal screenshot of prismor discover mcp listing running MCP server copies, memory, usage and config" width="744" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On my Mac one screen showed it all. Three servers ran about 90 copies each, with zero calls all week. Prismor flags those&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clean it up.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;prismor discover mcp --prune --stop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Facf512vzsl3tppsj1nq4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Facf512vzsl3tppsj1nq4.jpg" alt="Illustration: idle MCP servers being lifted off a conveyor into a recycling bin" width="600" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;--prune saves a backup, then drops flagged servers from global config. New sessions stop starting them&lt;/li&gt;
&lt;li&gt;--stop ends copies running right now. Open sessions keep going and lose those servers' tools, which costs nothing when nobody calls them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both commands show their plan and ask before acting&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stop idle servers I keep.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fag8elqk1qj7rg2cih4c4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fag8elqk1qj7rg2cih4c4.jpg" alt="Illustration: an MCP gateway pausing an idle server while keeping the others connected" width="600" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some servers I do call now and then. Prismor's MCP gateway can stop those after a quiet period (--idle-timeout). Agents still see their tools, and my next call starts the server again in about a quarter of a second&lt;/p&gt;

&lt;p&gt;I leave it off for servers that hold state between calls, like one keeping a browser open&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Does it work?
&lt;/h2&gt;

&lt;p&gt;I tested each fix in an isolated rig: 10 stand-in sessions with 4 real MCP servers each, 3 of them never called&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmucti9c91c5686a5iv63.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmucti9c91c5686a5iv63.png" alt="Bar chart: 10 sessions with 4 MCP servers each, memory held by the servers across baseline, prune, stop and gateway modes" width="744" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Baseline: 40 processes, 1,484 MB&lt;/li&gt;
&lt;li&gt;After --prune: 10 processes, 401 MB (−73%)&lt;/li&gt;
&lt;li&gt;After --stop: 10 processes, 401 MB, with all sessions still running&lt;/li&gt;
&lt;li&gt;Gateway with idle stop: 10 processes, 145 MB (−90%)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then I ran it on my own Mac. 373 copies ended in 6 seconds&lt;/p&gt;

&lt;p&gt;Swap dropped from 38.3 GB to 17.2 GB, and every open session kept running&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Usage counts cover Claude Code today. Other agents show copies and memory without usage&lt;/li&gt;
&lt;li&gt;ps leaves out swapped memory, so on a busy machine real savings run higher than what Prismor reports&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install prismor
prismor discover mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prismor is open source: &lt;a href="https://github.com/PrismorSec/prismor" rel="noopener noreferrer"&gt;https://github.com/PrismorSec/prismor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://prismor.dev" rel="noopener noreferrer"&gt;https://prismor.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>devtools</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
